[
  {
    "path": ".editorconfig",
    "content": "root = true\n\n[*]\ncharset = utf-8\nindent_style = tab\ninsert_final_newline = true\ntrim_trailing_whitespace = true\n\n[package.json]\nindent_style = space\ntab_width = 2\n\n[*.yaml]\nindent_style = space\ntab_width = 2\n\n[*.md]\nindent_style = space\ntab_width = 2\n"
  },
  {
    "path": ".gitignore",
    "content": "node_modules\noutput\nyarn-error.log\ndist\n"
  },
  {
    "path": ".npmignore",
    "content": ".vscode\nimg\ninputs\noutput\ntest\n"
  },
  {
    "path": ".vscode/launch.json",
    "content": "{\n    // Use IntelliSense to learn about possible attributes.\n    // Hover to view descriptions of existing attributes.\n    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387\n    \"version\": \"0.2.0\",\n    \"configurations\": [\n\t\t{\n\t\t\t\"args\": [\n\t\t\t\t\"-u\",\n\t\t\t\t\"bdd\",\n\t\t\t\t\"--timeout\",\n\t\t\t\t\"999999\",\n\t\t\t\t\"--colors\",\n\t\t\t\t\"${workspaceFolder}/test\"\n\t\t\t],\n\t\t\t\"internalConsoleOptions\": \"openOnSessionStart\",\n\t\t\t\"name\": \"Mocha Tests\",\n\t\t\t\"program\": \"${workspaceFolder}/node_modules/mocha/bin/_mocha\",\n\t\t\t\"request\": \"launch\",\n\t\t\t\"skipFiles\": [\n\t\t\t\t\"<node_internals>/**\"\n\t\t\t],\n\t\t\t\"type\": \"pwa-node\"\n\t\t},\n        {\n            \"type\": \"node\",\n            \"request\": \"launch\",\n            \"name\": \"Launch Program\",\n            \"skipFiles\": [\n                \"<node_internals>/**\"\n            ],\n\t\t\t\"program\": \"${workspaceFolder}/index.js\",\n\t\t\t\"args\": [\"-i\", \"inputs/easy.rhy\", \"out.mid\"]\n        }\n    ]\n}\n"
  },
  {
    "path": "LICENSE",
    "content": "The Nestup License \n\nCopyright (c) 2021 Sam Tarakajian and Alex Van Gils\n\nNestup has mixed license terms, with different terms for commercial and \nnon-commercial use. For non-commercial use, Nestup is licensed under a \nmodified MIT License which excludes the permission to sublicense or sell copies.\n\nFor commercial use, contact the copyright holders or instead release your \napplications under the GNU General Public License v.3, which means, amongst \nother things, that you must make the source code of your Applications available.\n\nNon-Commercial License:\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this \nsoftware and associated documentation files (the \"Software\"), to deal in the Software \nwithout restriction, including without limitation the rights to use, copy, modify, \nmerge, publish, or distribute the Software, and to permit persons to whom the Software \nis furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in \nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\nCommercial License:\n\n                    GNU GENERAL PUBLIC LICENSE\n                       Version 3, 29 June 2007\n\n Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>\n Everyone is permitted to copy and distribute verbatim copies\n of this license document, but changing it is not allowed.\n\n                            Preamble\n\n  The GNU General Public License is a free, copyleft license for\nsoftware and other kinds of works.\n\n  The licenses for most software and other practical works are designed\nto take away your freedom to share and change the works.  By contrast,\nthe GNU General Public License is intended to guarantee your freedom to\nshare and change all versions of a program--to make sure it remains free\nsoftware for all its users.  We, the Free Software Foundation, use the\nGNU General Public License for most of our software; it applies also to\nany other work released this way by its authors.  You can apply it to\nyour programs, too.\n\n  When we speak of free software, we are referring to freedom, not\nprice.  Our General Public Licenses are designed to make sure that you\nhave the freedom to distribute copies of free software (and charge for\nthem if you wish), that you receive source code or can get it if you\nwant it, that you can change the software or use pieces of it in new\nfree programs, and that you know you can do these things.\n\n  To protect your rights, we need to prevent others from denying you\nthese rights or asking you to surrender the rights.  Therefore, you have\ncertain responsibilities if you distribute copies of the software, or if\nyou modify it: responsibilities to respect the freedom of others.\n\n  For example, if you distribute copies of such a program, whether\ngratis or for a fee, you must pass on to the recipients the same\nfreedoms that you received.  You must make sure that they, too, receive\nor can get the source code.  And you must show them these terms so they\nknow their rights.\n\n  Developers that use the GNU GPL protect your rights with two steps:\n(1) assert copyright on the software, and (2) offer you this License\ngiving you legal permission to copy, distribute and/or modify it.\n\n  For the developers' and authors' protection, the GPL clearly explains\nthat there is no warranty for this free software.  For both users' and\nauthors' sake, the GPL requires that modified versions be marked as\nchanged, so that their problems will not be attributed erroneously to\nauthors of previous versions.\n\n  Some devices are designed to deny users access to install or run\nmodified versions of the software inside them, although the manufacturer\ncan do so.  This is fundamentally incompatible with the aim of\nprotecting users' freedom to change the software.  The systematic\npattern of such abuse occurs in the area of products for individuals to\nuse, which is precisely where it is most unacceptable.  Therefore, we\nhave designed this version of the GPL to prohibit the practice for those\nproducts.  If such problems arise substantially in other domains, we\nstand ready to extend this provision to those domains in future versions\nof the GPL, as needed to protect the freedom of users.\n\n  Finally, every program is threatened constantly by software patents.\nStates should not allow patents to restrict development and use of\nsoftware on general-purpose computers, but in those that do, we wish to\navoid the special danger that patents applied to a free program could\nmake it effectively proprietary.  To prevent this, the GPL assures that\npatents cannot be used to render the program non-free.\n\n  The precise terms and conditions for copying, distribution and\nmodification follow.\n\n                       TERMS AND CONDITIONS\n\n  0. Definitions.\n\n  \"This License\" refers to version 3 of the GNU General Public License.\n\n  \"Copyright\" also means copyright-like laws that apply to other kinds of\nworks, such as semiconductor masks.\n\n  \"The Program\" refers to any copyrightable work licensed under this\nLicense.  Each licensee is addressed as \"you\".  \"Licensees\" and\n\"recipients\" may be individuals or organizations.\n\n  To \"modify\" a work means to copy from or adapt all or part of the work\nin a fashion requiring copyright permission, other than the making of an\nexact copy.  The resulting work is called a \"modified version\" of the\nearlier work or a work \"based on\" the earlier work.\n\n  A \"covered work\" means either the unmodified Program or a work based\non the Program.\n\n  To \"propagate\" a work means to do anything with it that, without\npermission, would make you directly or secondarily liable for\ninfringement under applicable copyright law, except executing it on a\ncomputer or modifying a private copy.  Propagation includes copying,\ndistribution (with or without modification), making available to the\npublic, and in some countries other activities as well.\n\n  To \"convey\" a work means any kind of propagation that enables other\nparties to make or receive copies.  Mere interaction with a user through\na computer network, with no transfer of a copy, is not conveying.\n\n  An interactive user interface displays \"Appropriate Legal Notices\"\nto the extent that it includes a convenient and prominently visible\nfeature that (1) displays an appropriate copyright notice, and (2)\ntells the user that there is no warranty for the work (except to the\nextent that warranties are provided), that licensees may convey the\nwork under this License, and how to view a copy of this License.  If\nthe interface presents a list of user commands or options, such as a\nmenu, a prominent item in the list meets this criterion.\n\n  1. Source Code.\n\n  The \"source code\" for a work means the preferred form of the work\nfor making modifications to it.  \"Object code\" means any non-source\nform of a work.\n\n  A \"Standard Interface\" means an interface that either is an official\nstandard defined by a recognized standards body, or, in the case of\ninterfaces specified for a particular programming language, one that\nis widely used among developers working in that language.\n\n  The \"System Libraries\" of an executable work include anything, other\nthan the work as a whole, that (a) is included in the normal form of\npackaging a Major Component, but which is not part of that Major\nComponent, and (b) serves only to enable use of the work with that\nMajor Component, or to implement a Standard Interface for which an\nimplementation is available to the public in source code form.  A\n\"Major Component\", in this context, means a major essential component\n(kernel, window system, and so on) of the specific operating system\n(if any) on which the executable work runs, or a compiler used to\nproduce the work, or an object code interpreter used to run it.\n\n  The \"Corresponding Source\" for a work in object code form means all\nthe source code needed to generate, install, and (for an executable\nwork) run the object code and to modify the work, including scripts to\ncontrol those activities.  However, it does not include the work's\nSystem Libraries, or general-purpose tools or generally available free\nprograms which are used unmodified in performing those activities but\nwhich are not part of the work.  For example, Corresponding Source\nincludes interface definition files associated with source files for\nthe work, and the source code for shared libraries and dynamically\nlinked subprograms that the work is specifically designed to require,\nsuch as by intimate data communication or control flow between those\nsubprograms and other parts of the work.\n\n  The Corresponding Source need not include anything that users\ncan regenerate automatically from other parts of the Corresponding\nSource.\n\n  The Corresponding Source for a work in source code form is that\nsame work.\n\n  2. Basic Permissions.\n\n  All rights granted under this License are granted for the term of\ncopyright on the Program, and are irrevocable provided the stated\nconditions are met.  This License explicitly affirms your unlimited\npermission to run the unmodified Program.  The output from running a\ncovered work is covered by this License only if the output, given its\ncontent, constitutes a covered work.  This License acknowledges your\nrights of fair use or other equivalent, as provided by copyright law.\n\n  You may make, run and propagate covered works that you do not\nconvey, without conditions so long as your license otherwise remains\nin force.  You may convey covered works to others for the sole purpose\nof having them make modifications exclusively for you, or provide you\nwith facilities for running those works, provided that you comply with\nthe terms of this License in conveying all material for which you do\nnot control copyright.  Those thus making or running the covered works\nfor you must do so exclusively on your behalf, under your direction\nand control, on terms that prohibit them from making any copies of\nyour copyrighted material outside their relationship with you.\n\n  Conveying under any other circumstances is permitted solely under\nthe conditions stated below.  Sublicensing is not allowed; section 10\nmakes it unnecessary.\n\n  3. Protecting Users' Legal Rights From Anti-Circumvention Law.\n\n  No covered work shall be deemed part of an effective technological\nmeasure under any applicable law fulfilling obligations under article\n11 of the WIPO copyright treaty adopted on 20 December 1996, or\nsimilar laws prohibiting or restricting circumvention of such\nmeasures.\n\n  When you convey a covered work, you waive any legal power to forbid\ncircumvention of technological measures to the extent such circumvention\nis effected by exercising rights under this License with respect to\nthe covered work, and you disclaim any intention to limit operation or\nmodification of the work as a means of enforcing, against the work's\nusers, your or third parties' legal rights to forbid circumvention of\ntechnological measures.\n\n  4. Conveying Verbatim Copies.\n\n  You may convey verbatim copies of the Program's source code as you\nreceive it, in any medium, provided that you conspicuously and\nappropriately publish on each copy an appropriate copyright notice;\nkeep intact all notices stating that this License and any\nnon-permissive terms added in accord with section 7 apply to the code;\nkeep intact all notices of the absence of any warranty; and give all\nrecipients a copy of this License along with the Program.\n\n  You may charge any price or no price for each copy that you convey,\nand you may offer support or warranty protection for a fee.\n\n  5. Conveying Modified Source Versions.\n\n  You may convey a work based on the Program, or the modifications to\nproduce it from the Program, in the form of source code under the\nterms of section 4, provided that you also meet all of these conditions:\n\n    a) The work must carry prominent notices stating that you modified\n    it, and giving a relevant date.\n\n    b) The work must carry prominent notices stating that it is\n    released under this License and any conditions added under section\n    7.  This requirement modifies the requirement in section 4 to\n    \"keep intact all notices\".\n\n    c) You must license the entire work, as a whole, under this\n    License to anyone who comes into possession of a copy.  This\n    License will therefore apply, along with any applicable section 7\n    additional terms, to the whole of the work, and all its parts,\n    regardless of how they are packaged.  This License gives no\n    permission to license the work in any other way, but it does not\n    invalidate such permission if you have separately received it.\n\n    d) If the work has interactive user interfaces, each must display\n    Appropriate Legal Notices; however, if the Program has interactive\n    interfaces that do not display Appropriate Legal Notices, your\n    work need not make them do so.\n\n  A compilation of a covered work with other separate and independent\nworks, which are not by their nature extensions of the covered work,\nand which are not combined with it such as to form a larger program,\nin or on a volume of a storage or distribution medium, is called an\n\"aggregate\" if the compilation and its resulting copyright are not\nused to limit the access or legal rights of the compilation's users\nbeyond what the individual works permit.  Inclusion of a covered work\nin an aggregate does not cause this License to apply to the other\nparts of the aggregate.\n\n  6. Conveying Non-Source Forms.\n\n  You may convey a covered work in object code form under the terms\nof sections 4 and 5, provided that you also convey the\nmachine-readable Corresponding Source under the terms of this License,\nin one of these ways:\n\n    a) Convey the object code in, or embodied in, a physical product\n    (including a physical distribution medium), accompanied by the\n    Corresponding Source fixed on a durable physical medium\n    customarily used for software interchange.\n\n    b) Convey the object code in, or embodied in, a physical product\n    (including a physical distribution medium), accompanied by a\n    written offer, valid for at least three years and valid for as\n    long as you offer spare parts or customer support for that product\n    model, to give anyone who possesses the object code either (1) a\n    copy of the Corresponding Source for all the software in the\n    product that is covered by this License, on a durable physical\n    medium customarily used for software interchange, for a price no\n    more than your reasonable cost of physically performing this\n    conveying of source, or (2) access to copy the\n    Corresponding Source from a network server at no charge.\n\n    c) Convey individual copies of the object code with a copy of the\n    written offer to provide the Corresponding Source.  This\n    alternative is allowed only occasionally and noncommercially, and\n    only if you received the object code with such an offer, in accord\n    with subsection 6b.\n\n    d) Convey the object code by offering access from a designated\n    place (gratis or for a charge), and offer equivalent access to the\n    Corresponding Source in the same way through the same place at no\n    further charge.  You need not require recipients to copy the\n    Corresponding Source along with the object code.  If the place to\n    copy the object code is a network server, the Corresponding Source\n    may be on a different server (operated by you or a third party)\n    that supports equivalent copying facilities, provided you maintain\n    clear directions next to the object code saying where to find the\n    Corresponding Source.  Regardless of what server hosts the\n    Corresponding Source, you remain obligated to ensure that it is\n    available for as long as needed to satisfy these requirements.\n\n    e) Convey the object code using peer-to-peer transmission, provided\n    you inform other peers where the object code and Corresponding\n    Source of the work are being offered to the general public at no\n    charge under subsection 6d.\n\n  A separable portion of the object code, whose source code is excluded\nfrom the Corresponding Source as a System Library, need not be\nincluded in conveying the object code work.\n\n  A \"User Product\" is either (1) a \"consumer product\", which means any\ntangible personal property which is normally used for personal, family,\nor household purposes, or (2) anything designed or sold for incorporation\ninto a dwelling.  In determining whether a product is a consumer product,\ndoubtful cases shall be resolved in favor of coverage.  For a particular\nproduct received by a particular user, \"normally used\" refers to a\ntypical or common use of that class of product, regardless of the status\nof the particular user or of the way in which the particular user\nactually uses, or expects or is expected to use, the product.  A product\nis a consumer product regardless of whether the product has substantial\ncommercial, industrial or non-consumer uses, unless such uses represent\nthe only significant mode of use of the product.\n\n  \"Installation Information\" for a User Product means any methods,\nprocedures, authorization keys, or other information required to install\nand execute modified versions of a covered work in that User Product from\na modified version of its Corresponding Source.  The information must\nsuffice to ensure that the continued functioning of the modified object\ncode is in no case prevented or interfered with solely because\nmodification has been made.\n\n  If you convey an object code work under this section in, or with, or\nspecifically for use in, a User Product, and the conveying occurs as\npart of a transaction in which the right of possession and use of the\nUser Product is transferred to the recipient in perpetuity or for a\nfixed term (regardless of how the transaction is characterized), the\nCorresponding Source conveyed under this section must be accompanied\nby the Installation Information.  But this requirement does not apply\nif neither you nor any third party retains the ability to install\nmodified object code on the User Product (for example, the work has\nbeen installed in ROM).\n\n  The requirement to provide Installation Information does not include a\nrequirement to continue to provide support service, warranty, or updates\nfor a work that has been modified or installed by the recipient, or for\nthe User Product in which it has been modified or installed.  Access to a\nnetwork may be denied when the modification itself materially and\nadversely affects the operation of the network or violates the rules and\nprotocols for communication across the network.\n\n  Corresponding Source conveyed, and Installation Information provided,\nin accord with this section must be in a format that is publicly\ndocumented (and with an implementation available to the public in\nsource code form), and must require no special password or key for\nunpacking, reading or copying.\n\n  7. Additional Terms.\n\n  \"Additional permissions\" are terms that supplement the terms of this\nLicense by making exceptions from one or more of its conditions.\nAdditional permissions that are applicable to the entire Program shall\nbe treated as though they were included in this License, to the extent\nthat they are valid under applicable law.  If additional permissions\napply only to part of the Program, that part may be used separately\nunder those permissions, but the entire Program remains governed by\nthis License without regard to the additional permissions.\n\n  When you convey a copy of a covered work, you may at your option\nremove any additional permissions from that copy, or from any part of\nit.  (Additional permissions may be written to require their own\nremoval in certain cases when you modify the work.)  You may place\nadditional permissions on material, added by you to a covered work,\nfor which you have or can give appropriate copyright permission.\n\n  Notwithstanding any other provision of this License, for material you\nadd to a covered work, you may (if authorized by the copyright holders of\nthat material) supplement the terms of this License with terms:\n\n    a) Disclaiming warranty or limiting liability differently from the\n    terms of sections 15 and 16 of this License; or\n\n    b) Requiring preservation of specified reasonable legal notices or\n    author attributions in that material or in the Appropriate Legal\n    Notices displayed by works containing it; or\n\n    c) Prohibiting misrepresentation of the origin of that material, or\n    requiring that modified versions of such material be marked in\n    reasonable ways as different from the original version; or\n\n    d) Limiting the use for publicity purposes of names of licensors or\n    authors of the material; or\n\n    e) Declining to grant rights under trademark law for use of some\n    trade names, trademarks, or service marks; or\n\n    f) Requiring indemnification of licensors and authors of that\n    material by anyone who conveys the material (or modified versions of\n    it) with contractual assumptions of liability to the recipient, for\n    any liability that these contractual assumptions directly impose on\n    those licensors and authors.\n\n  All other non-permissive additional terms are considered \"further\nrestrictions\" within the meaning of section 10.  If the Program as you\nreceived it, or any part of it, contains a notice stating that it is\ngoverned by this License along with a term that is a further\nrestriction, you may remove that term.  If a license document contains\na further restriction but permits relicensing or conveying under this\nLicense, you may add to a covered work material governed by the terms\nof that license document, provided that the further restriction does\nnot survive such relicensing or conveying.\n\n  If you add terms to a covered work in accord with this section, you\nmust place, in the relevant source files, a statement of the\nadditional terms that apply to those files, or a notice indicating\nwhere to find the applicable terms.\n\n  Additional terms, permissive or non-permissive, may be stated in the\nform of a separately written license, or stated as exceptions;\nthe above requirements apply either way.\n\n  8. Termination.\n\n  You may not propagate or modify a covered work except as expressly\nprovided under this License.  Any attempt otherwise to propagate or\nmodify it is void, and will automatically terminate your rights under\nthis License (including any patent licenses granted under the third\nparagraph of section 11).\n\n  However, if you cease all violation of this License, then your\nlicense from a particular copyright holder is reinstated (a)\nprovisionally, unless and until the copyright holder explicitly and\nfinally terminates your license, and (b) permanently, if the copyright\nholder fails to notify you of the violation by some reasonable means\nprior to 60 days after the cessation.\n\n  Moreover, your license from a particular copyright holder is\nreinstated permanently if the copyright holder notifies you of the\nviolation by some reasonable means, this is the first time you have\nreceived notice of violation of this License (for any work) from that\ncopyright holder, and you cure the violation prior to 30 days after\nyour receipt of the notice.\n\n  Termination of your rights under this section does not terminate the\nlicenses of parties who have received copies or rights from you under\nthis License.  If your rights have been terminated and not permanently\nreinstated, you do not qualify to receive new licenses for the same\nmaterial under section 10.\n\n  9. Acceptance Not Required for Having Copies.\n\n  You are not required to accept this License in order to receive or\nrun a copy of the Program.  Ancillary propagation of a covered work\noccurring solely as a consequence of using peer-to-peer transmission\nto receive a copy likewise does not require acceptance.  However,\nnothing other than this License grants you permission to propagate or\nmodify any covered work.  These actions infringe copyright if you do\nnot accept this License.  Therefore, by modifying or propagating a\ncovered work, you indicate your acceptance of this License to do so.\n\n  10. Automatic Licensing of Downstream Recipients.\n\n  Each time you convey a covered work, the recipient automatically\nreceives a license from the original licensors, to run, modify and\npropagate that work, subject to this License.  You are not responsible\nfor enforcing compliance by third parties with this License.\n\n  An \"entity transaction\" is a transaction transferring control of an\norganization, or substantially all assets of one, or subdividing an\norganization, or merging organizations.  If propagation of a covered\nwork results from an entity transaction, each party to that\ntransaction who receives a copy of the work also receives whatever\nlicenses to the work the party's predecessor in interest had or could\ngive under the previous paragraph, plus a right to possession of the\nCorresponding Source of the work from the predecessor in interest, if\nthe predecessor has it or can get it with reasonable efforts.\n\n  You may not impose any further restrictions on the exercise of the\nrights granted or affirmed under this License.  For example, you may\nnot impose a license fee, royalty, or other charge for exercise of\nrights granted under this License, and you may not initiate litigation\n(including a cross-claim or counterclaim in a lawsuit) alleging that\nany patent claim is infringed by making, using, selling, offering for\nsale, or importing the Program or any portion of it.\n\n  11. Patents.\n\n  A \"contributor\" is a copyright holder who authorizes use under this\nLicense of the Program or a work on which the Program is based.  The\nwork thus licensed is called the contributor's \"contributor version\".\n\n  A contributor's \"essential patent claims\" are all patent claims\nowned or controlled by the contributor, whether already acquired or\nhereafter acquired, that would be infringed by some manner, permitted\nby this License, of making, using, or selling its contributor version,\nbut do not include claims that would be infringed only as a\nconsequence of further modification of the contributor version.  For\npurposes of this definition, \"control\" includes the right to grant\npatent sublicenses in a manner consistent with the requirements of\nthis License.\n\n  Each contributor grants you a non-exclusive, worldwide, royalty-free\npatent license under the contributor's essential patent claims, to\nmake, use, sell, offer for sale, import and otherwise run, modify and\npropagate the contents of its contributor version.\n\n  In the following three paragraphs, a \"patent license\" is any express\nagreement or commitment, however denominated, not to enforce a patent\n(such as an express permission to practice a patent or covenant not to\nsue for patent infringement).  To \"grant\" such a patent license to a\nparty means to make such an agreement or commitment not to enforce a\npatent against the party.\n\n  If you convey a covered work, knowingly relying on a patent license,\nand the Corresponding Source of the work is not available for anyone\nto copy, free of charge and under the terms of this License, through a\npublicly available network server or other readily accessible means,\nthen you must either (1) cause the Corresponding Source to be so\navailable, or (2) arrange to deprive yourself of the benefit of the\npatent license for this particular work, or (3) arrange, in a manner\nconsistent with the requirements of this License, to extend the patent\nlicense to downstream recipients.  \"Knowingly relying\" means you have\nactual knowledge that, but for the patent license, your conveying the\ncovered work in a country, or your recipient's use of the covered work\nin a country, would infringe one or more identifiable patents in that\ncountry that you have reason to believe are valid.\n\n  If, pursuant to or in connection with a single transaction or\narrangement, you convey, or propagate by procuring conveyance of, a\ncovered work, and grant a patent license to some of the parties\nreceiving the covered work authorizing them to use, propagate, modify\nor convey a specific copy of the covered work, then the patent license\nyou grant is automatically extended to all recipients of the covered\nwork and works based on it.\n\n  A patent license is \"discriminatory\" if it does not include within\nthe scope of its coverage, prohibits the exercise of, or is\nconditioned on the non-exercise of one or more of the rights that are\nspecifically granted under this License.  You may not convey a covered\nwork if you are a party to an arrangement with a third party that is\nin the business of distributing software, under which you make payment\nto the third party based on the extent of your activity of conveying\nthe work, and under which the third party grants, to any of the\nparties who would receive the covered work from you, a discriminatory\npatent license (a) in connection with copies of the covered work\nconveyed by you (or copies made from those copies), or (b) primarily\nfor and in connection with specific products or compilations that\ncontain the covered work, unless you entered into that arrangement,\nor that patent license was granted, prior to 28 March 2007.\n\n  Nothing in this License shall be construed as excluding or limiting\nany implied license or other defenses to infringement that may\notherwise be available to you under applicable patent law.\n\n  12. No Surrender of Others' Freedom.\n\n  If conditions are imposed on you (whether by court order, agreement or\notherwise) that contradict the conditions of this License, they do not\nexcuse you from the conditions of this License.  If you cannot convey a\ncovered work so as to satisfy simultaneously your obligations under this\nLicense and any other pertinent obligations, then as a consequence you may\nnot convey it at all.  For example, if you agree to terms that obligate you\nto collect a royalty for further conveying from those to whom you convey\nthe Program, the only way you could satisfy both those terms and this\nLicense would be to refrain entirely from conveying the Program.\n\n  13. Use with the GNU Affero General Public License.\n\n  Notwithstanding any other provision of this License, you have\npermission to link or combine any covered work with a work licensed\nunder version 3 of the GNU Affero General Public License into a single\ncombined work, and to convey the resulting work.  The terms of this\nLicense will continue to apply to the part which is the covered work,\nbut the special requirements of the GNU Affero General Public License,\nsection 13, concerning interaction through a network will apply to the\ncombination as such.\n\n  14. Revised Versions of this License.\n\n  The Free Software Foundation may publish revised and/or new versions of\nthe GNU General Public License from time to time.  Such new versions will\nbe similar in spirit to the present version, but may differ in detail to\naddress new problems or concerns.\n\n  Each version is given a distinguishing version number.  If the\nProgram specifies that a certain numbered version of the GNU General\nPublic License \"or any later version\" applies to it, you have the\noption of following the terms and conditions either of that numbered\nversion or of any later version published by the Free Software\nFoundation.  If the Program does not specify a version number of the\nGNU General Public License, you may choose any version ever published\nby the Free Software Foundation.\n\n  If the Program specifies that a proxy can decide which future\nversions of the GNU General Public License can be used, that proxy's\npublic statement of acceptance of a version permanently authorizes you\nto choose that version for the Program.\n\n  Later license versions may give you additional or different\npermissions.  However, no additional obligations are imposed on any\nauthor or copyright holder as a result of your choosing to follow a\nlater version.\n\n  15. Disclaimer of Warranty.\n\n  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY\nAPPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT\nHOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM \"AS IS\" WITHOUT WARRANTY\nOF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,\nTHE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\nPURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM\nIS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF\nALL NECESSARY SERVICING, REPAIR OR CORRECTION.\n\n  16. Limitation of Liability.\n\n  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING\nWILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS\nTHE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY\nGENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE\nUSE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF\nDATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD\nPARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),\nEVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF\nSUCH DAMAGES.\n\n  17. Interpretation of Sections 15 and 16.\n\n  If the disclaimer of warranty and limitation of liability provided\nabove cannot be given local legal effect according to their terms,\nreviewing courts shall apply local law that most closely approximates\nan absolute waiver of all civil liability in connection with the\nProgram, unless a warranty or assumption of liability accompanies a\ncopy of the Program in return for a fee.\n\n                     END OF TERMS AND CONDITIONS\n"
  },
  {
    "path": "README.md",
    "content": "# Nestup, the Nested Tuplet Generator [[]_[]]\n\nIt's Nestup! The domain specific language for describing and generating nested tuplets, just like you've always wanted. It also can divide anything that has dimension.\n\n## Cheat Sheet\n\n| Nestup_example_expression     | Description | Piano_roll |\n| ----------- | ----------- | ----------- |\n| `[4]`      | One event, 4 beats long | ![](./img/cheat-01.png)\n| `[[2] [2]]`   | Two events, each 2 beats long | ![](./img/cheat-02.png)\n| `[3 [2] [3]]` | Two events, squeezed into 3 beats. The first will have length `2/5` of 3 beats, and the second will have length `3/5` of 3 beats. | ![](./img/cheat-03.png)\n|`[[] []] [2, 3/7 [] []]`|Four events, with the second two events scaled at a ratio of `3:7` to the first two. |![](./img/cheat-scale2.png)\n| `[4] {3}` | Three events, evenly spaced over 4 beats (aka a triplet over 4 beats) | ![](./img/cheat-04.png)\n| `[4] {3} [4] {5}` | A 3:4 triplet followed by a 5:4 quintuplet | ![](./img/cheat-05.png)\n| `[4] {3 2 {3} }` | A triplet, where the second event has been itself subdivided into a triplet. A total of 5 note events | ![](./img/cheat-06.png)\n| `[4] {3 2:2 {5} }` | A triplet, where the second and third beat have been replaced with a quintuplet over that same time. A total of 6 events | ![](./img/cheat-07.png) |\n| `[4 [1] ['] [1]]` | Three equally long notes in the space of 4 beats (aka a triplet), where the second note is a rest | ![](./img/cheat-08.png) |\n| `[4 [1] [1] _ [1] [1]]` | Four notes in the space of four beats, The second note is tied to the third. | ![](./img/cheat-09.png) |\n| `[4 {5 2 [] _ 3 [] }]` | Five notes in the space of four beats, where the second note is tied to the third. | ![](./img/cheat-10.png) |\n| `[3] {3 > 1/2}` | Three notes in the space of three beats, offset by half a beat. | ![](./img/cheat-11.png) |\n| `['4] [2]` | An empty container, four beats long, followed by a note two beats long. | ![](./img/cheat-12.png) |\n\n## Where am I?\n\nThis repo is the home for the Nestup language and the documentation for the language itself. If you are looking for the Ableton Live device, you can find that [here](https://gum.co/nestup), and if you are looking for the online playground, you can find that [here](https://nestup.cutelab.nyc).\n\n## Why Nestup?\n\nMost DAWs and other music software are designed to facilitate creating music with rhythmic subdivisions that divide in twos and into threes. However, there are many types of music in the world, such as tabla rhythms from Indian classical music, rhythms by musicians such as Tigran Hamasyan, drawing from Armenian folk traditions, or the nested tuplets common to \"New Complexity\" composers like Brian Ferneyhough, that do not divide solely into twos and threes. Most of these rhythms are rather difficult, or at least tedious, to program in any DAW. \n\n![nested quintuplet](img/nested-tup-ex.png \"Figure 1\")\n\nWith Nestup, programming such a rhythm can be quite easy:\n```\n[2] {5\n  4:2 {3}\n}\n```\n![nested quintuplet](img/nested-tup-ex2.png \"Figure 2\")\n\nIn addition, DAWs that employ looping clips, for example Ableton Live or Logic Pro, facilitate the creation of clips that are defined by a number of 16th note subdivisions, making a looping clip of a \"[fragmentary rhythm](https://www.instagram.com/p/CFxKMSMAS22/?utm_source=ig_web_copy_link)\" very difficult to create.\n\nNestup is designed to be a simple and expressive solution for these and other rhythmic needs.\n\n## Dividing Containers\n\nIn Nestup, we describe containers which are divided into parts. For the purposes of this documentation, where we are talking about music, those containers are generally periods of time, and those parts are generally experienced as events in time.\n\nMusic notation, and in particular \"western\" music notation, has its own conventions for describing the rhythmic subdivion of events in time.\n\nThe Nestup language is simple in that it ignores many of these conventions. That is, Nestup doesn't care if you are in compound or simple meter, or whether the tuplet is described in sixteenth notes or eighth notes. A musician writing in Nestup simply describes when events (such as musical notes or rhythmic attacks) occur in a given period of time.\n\n![5 against 4 eighth notes, followed by two quarter notes](img/ex-5-4.png \"Figure 3\")\n\nIn the above figure, we see a measure of common time, where the first two beats of the measure contain 5 eighth notes in the space of 4 eighth notes, and the second half of the measure contains a quarter note on each beat.\n\nThis could be rendered in multiple ways in Nestup, depending on the user's preference. One rendering of this rhythm could be:\n```\n[4\n    [] {5}\n    [] {2}\n]\n```\nAnother way to write it could be:\n\n```\n[4] {4\n      1:2 [] {5}\n}\n```\n\nNestup doesn't have an explicit notion of beats or time signatures, it simply divides containers (of time) and generates events. So, Nestup could render this rhythm in at least these two ways. Let's take a closer look at what these examples are doing.\n\n## What These Examples Are Doing\n\n1. Here, we specify a **container** `[]`, with a **size** of 4, with `[4]`.\n\n2. A container can contain child containers—in our first example, our container contains two containers, `[]` and `[]`, of equal size.\n\n3. A container can be subvidided equally using the **subdivider** `{}`. In our first example, the first child container is subdivided into 5 subdivisions with `{5}`, and the second child is subdivided into 2 with `{2}`.\n\nIn our second example, we describe the rhythm a little differently.\n\n1. We start, as in the first example, by specifying a container of size 4 with `[4]`.\n\n2. This container is subdivided into 4 subdivisions with `{4}`.\n\n3. A child container can be placed within those subdivisions, by specifying that container's **range**—where it should start, and how long it should continue. In the second example, the ranged container is placed on the first subdivision, stretched across two subdivisions, with `1:2 []`.\n\n4. Finally, that ranged container is subdivided into 5 subdivisions with `{5}`.\n\nBoth of these examples gives us the rhythm from Figure 1: five evenly spaced events followed by two evenly spaced events that take up the same amount of time as the first five.\n\n\n## How Nestup Works\n\nWe can now take a step back and describe the Nestup language systematically, starting from its most simple expression.\n\n### The Container\n\n```\n[]\n```\nThe **container,** specified by the square brackets `[]`, defines a period of time, for example, a beat or a measure. If you are using Nestup to generate musical rhythms in a DAW like Ableton Live, the simple expression `[]` will generate one note spanning one beat in the DAW's global time signature. This is because every container has a **size**, which is by default 1. If you wanted your container to be 4 beats long, like a whole note in a 4/4 time signature, you would define the container size with `[4]`. *The container size can be any positive integer.*\n\nOur `[4]` gives us a rhythm like:\n\n![a whole note](img/ex-1.png \"Figure 2\") or, in the piano roll, ![a whole note in piano roll](img/pno-roll-1.png \"Figure 4\") \n\n#### Flexible Container\nA container can be divided into child containers, for example, `[[2] [2]]` will divide the container into two. Those child containers have a size of 2, and since the parent container has been given no explicit size, it is **flexible**, and inherits its size from the sum of its children's sizes—in this case, a size of 4. \n\n![two half notes in piano roll](img/pno-roll-2.png \"Figure 5\") \n\nTo give another example, `[[3] [2]]` will give us a container of size 5, for example, a five beat long rhythm, with a note spanning three beats and a note spanning two beats, like:\n\n![[[3][2]] in piano roll](img/pno-roll-3.png \"Figure 6\") \n\n#### Fixed Container\n\nWhat if you wanted to specify the size of the parent container to be 4, but keep the 3:2 porportion of the child containers? \n\nYou can do this by specifying a size of the parent container, making it a **fixed container**, as with\n```\n[4 [3] [2]]\n```\n![[4[3][2]] in piano roll](img/pno-roll-4.png \"Figure 7\") \n\nWith a combination of fixed and flexible parent and child containers, we can generate a wide variety of rhythms.\n\n\n#### Container Scale\n\nYou can also **scale** the size of a container by a ratio of two positive integers. It cannot be a decimal number. For example,\n```\n[2 [] []] [2, 3/5[] []]\n```\nwould generate a container of size two with two child containers, followed by a second container of size two with two child containers, this second one being 3/5 the size of the first.\n\n![container scale in piano roll](img/pno-roll-6.png \"Figure 8\") \n\nIn this way, Nestup facilitates the creation of looping clips with fragmentary meters in DAWs such as Ableton Live. Note that in the figure above, the end point of the loop is off of Ableton's \"grid.\"\n\nNote: if you wish to scale a container and want to maintain its flexible size, simply writing a comma `,` followed by the desired ratio will add a container scale while maintaining the container's flexibility. For example, `[,8/3 [] []]`. \n\nThis would be a container of size 2, because it is a parent container with children whose sizes sum to 2. That size is then multiplied by 8/3 to produce its final size.\n\n\n### The Subdivider\n\nA positive integer wrapped in curly braces `{}` evenly divides a container into that many subdivisions. For example, `[4] {3}` might be rendered in conventional western musical notation as:\n\n![a half-note triplet](img/ex-3.png \"Figure 9\")\n\nIn the same way, `[4] {1}` gives us:\n\n![a whole note](img/ex-1.png \"Figure 10\")\n\nAnd `[4] {13}` gives us:\n\n![a 13-let](img/ex-13.png \"Figure 11\")\n\n*Warning:* A container can only be subdivided with the subdivider if it has no child containers. For example, the expression `[[]] {3}` **is not valid.**\n\nIf you are subdividing a container of size 1 with no sibling containers, you can leave off the preceding `[]`. For example, `[] {5}` and `{5}` are equivalent. However, `{5} {5}` or `{5} [] {4}` **are not valid.**\n\n#### Ranged Containers\n\nOnce you’ve subdivided a container, you can place more containers within those subdivisions. To place one of these ranged containers, you first specify a **range** for the container. The range includes a **start** and a **length.** The range length, written after the colon `:`, is used to stretch that ranged container across multiple subdivisions, but defaults to 1 subdivision if not otherwise specified. \n\nFor example, to place the container `[[2] [1]]` on the first beat of a container subdivided into 3 parts, you would write:\n```\n[] {3 1 [[2] [1]]}\n```\n![ranged container](img/pno-roll-7.png \"Figure 12\")\n\n`[] {3 1:2 [[2] [1]]}` would stretch the container across two subdivisions. \n\n![range, length](img/pno-roll-8.png \"Figure 13\")\n\n#### Ranged Container Shorthand\n\nIf you want to place a ranged container of size 1, you can simply declare the range start, or the range start and length, and the ranged container of size 1 will be implied.\n\nFor example, the following two expressions are equivalent:\n\n```\n[] {8\n  1 []\n  2 []\n  3 []\n  4:5 []\n}\n```\nand\n```\n[] {8\n  1\n  2\n  3\n  4:5\n}\n```\n![range shorthand](img/pno-shorthand.png \"Figure 14\")\n\n*Warning:* The size of the ranged container will always be determined by its range expression. For this reason, you can not give a ranged container a fixed size: `{3 1 [2]}` **is not valid**. Additionally, a ranged container cannot have siblings: `{3 1 [] []}` **is not valid**, though it can have children, as demonstrated in the examples above.\n\n### Empty Containers\n\nUp until this point, we have described containers full of rhythmic events. What if we want to describe a period of time that is empty?\n\n```\n['4]\n```\nThe expression above describes a container of size 4 which is empty. We can see such an empty container in context below:\n\n```\n[4] {3}\n['4]\n[2]\n```\n![empty](img/pno-empty-1.png \"Figure 15\")\n\nThe **Empty Container** shares many characteristics with its non-empty counterpart: it has a container size, it can have a scale expressed as a ratio of two positive integers, and it can be subdivided using `{}` expressions. \n\nHowever, the empty container cannot have children. Why? Because the child containers would fill the empty container and it would no longer be empty. Therefore, if you write `['4[2]['3]]`, this will throw a syntax error. The correct form of this expression is `[4[2]['3]]`.\n\nIt is perfectly possible to add rhythmic events into an empty container, however. You simply need to use the subdivider `{}`. Take for instance:\n\n```\n['4] {16\n  1 {2}\n  8 {3}\n  16\n}\n```\n![empty 2](img/pno-empty-2.png \"Figure 16\")\n\n#### Rests\n\nA common use for an empty container is for adding rests.\n\nFor example,\n```\n[]\n[']\n[3] {5\n  2 [']\n  4:2 [']\n}\n```\n![rests](img/pno-roll-10.png \"Figure 17\") \n\n### Ties and Rotations\n\nNestup has two additional features to help you generate rhythms: the ability to combine two adjascent containers, in a manner similar to a \"tie\" in western classical music notation, and the ability to \"rotate\" rhythmic events forward or backward in a subdivided container.\n\n\n#### Ties\n\nIn Nestup, ties are written using the underscore `_` and connect sibling containers. When used, the subdivision before and after are combined. \n\nFor example:\n`[3] {5} _ [] {3}` will give us:\n\n![tie](img/pno-roll-9.png \"Figure 18\")\n\n#### Rotation\n\nOnce you've subdivided a container, you can offset those subdivisions forward or backward using the rotation operators `>` or `<`. The **distance** of a rotation is defined in terms of the number of subdivisions, for example, if you've divided a container into 10 subdivisions, then rotating forward by 5 would have the effect of rotating all subdivisions forward by half of the parent container. \n\nYou can see this demonstrated in the colored visualizer element along the bottom of the Ableton Live Nestup device in the following example:\n\n\n![rotate-first](img/first-rotate.gif \"Figure 19\")\n\nRotating in this subdivided container by 10 would have the same effect as not rotating at all. Rotations can be fractions, so you can rotate by 1/2 of 1 subdivision. This can be a nice way to achieve syncopation.\n\n![rotate-diagram](img/rotationDiagram.png \"Figure 20\")\n*It could be helpful to visualize a grid of subdivisions, shifted over by the rotation distance*\n\nFor example, to place a snare drum on beats \"2\" and \"4\" of a 4/4 measure, you might write the following expression:\n\n```\n['4] {4\n  2\n  4\n}\n```\nWith **Rotation**, you could achieve a snare drum hitting on \"2\" and \"4\" with the following expression:\n```\n[4] {2 > 1/2}\n```\nIn this second example, we've made two subdivisions (rather than four) of the parent container, and then used the character `>` to offset the start of those subdivisions by 1/2 of one subdivision.\n\nIt is also possible to offset a rhythm backwards with `<`, by any ratio of one subdivision. For example:\n\n```\n[4] {3}\n[4] {3 < 1/3}\n```\n![rotate](img/pno-rotate.png \"Figure 21\")\n\nYou can see in the preceeding example that it appears as if there is a rest at the beginning of the second container. This is due to the first event of the subdivided second container being pushed past the beginning of the container and wrapping around the end of that container. \n\nThis wrap-around effect can be seen in the following animation using the Ableton Live Nestup device. As the rotation distance approaches 1 (3/3), the final event in the container gets closer to wrapping around to the beginning of the container.\n\n![rotate-anim](img/rotate.gif \"Figure 22\")\n\n______\n## Ableton-specific documentation\n\nIf you are using the [Nestup Max For Live device](https://gum.co/nestup) to parse your Nestup expressions, please visit the Nestup Max for Live Device Reference [here](https://nestup.s3.amazonaws.com/Manual+Versions/Nestup+Max+for+Live+Device+Reference+-+v1.0.1.pdf). You can find the Live device for purchase [here](https://gum.co/nestup). Thank you, have fun, and be in touch!\n"
  },
  {
    "path": "build/grammar.js",
    "content": "// Generated automatically by nearley, version 2.19.6\n// http://github.com/Hardmath123/nearley\n(function () {\nfunction id(x) { return x[0]; }\n\nconst moo = require(\"moo\");\n\nconst lexer = moo.compile({\n  ws: { match: /\\s+/, lineBreaks: true },\n  number: /[0-9]+/,\n  word: /[a-z]+/,\n  lp: /\\(/,\n  comma: /,/,\n  rp: /\\)/,\n  lb: /\\{/,\n  rb: /\\}/\n});\nvar grammar = {\n    Lexer: lexer,\n    ParserRules: [\n    {\"name\": \"tuple$ebnf$1\", \"symbols\": [\"_\"], \"postprocess\": id},\n    {\"name\": \"tuple$ebnf$1\", \"symbols\": [], \"postprocess\": function(d) {return null;}},\n    {\"name\": \"tuple$ebnf$2\", \"symbols\": [\"_\"], \"postprocess\": id},\n    {\"name\": \"tuple$ebnf$2\", \"symbols\": [], \"postprocess\": function(d) {return null;}},\n    {\"name\": \"tuple$ebnf$3\", \"symbols\": [\"_\"], \"postprocess\": id},\n    {\"name\": \"tuple$ebnf$3\", \"symbols\": [], \"postprocess\": function(d) {return null;}},\n    {\"name\": \"tuple\", \"symbols\": [\"tuple$ebnf$1\", \"extension\", \"tuple$ebnf$2\", \"structure\", \"tuple$ebnf$3\"], \"postprocess\": d => {return { extension: d[1], structure: d[3] }}},\n    {\"name\": \"extension$ebnf$1\", \"symbols\": [\"_\"], \"postprocess\": id},\n    {\"name\": \"extension$ebnf$1\", \"symbols\": [], \"postprocess\": function(d) {return null;}},\n    {\"name\": \"extension$ebnf$2\", \"symbols\": [\"_\"], \"postprocess\": id},\n    {\"name\": \"extension$ebnf$2\", \"symbols\": [], \"postprocess\": function(d) {return null;}},\n    {\"name\": \"extension$ebnf$3\", \"symbols\": [\"_\"], \"postprocess\": id},\n    {\"name\": \"extension$ebnf$3\", \"symbols\": [], \"postprocess\": function(d) {return null;}},\n    {\"name\": \"extension$ebnf$4\", \"symbols\": [\"_\"], \"postprocess\": id},\n    {\"name\": \"extension$ebnf$4\", \"symbols\": [], \"postprocess\": function(d) {return null;}},\n    {\"name\": \"extension\", \"symbols\": [(lexer.has(\"lp\") ? {type: \"lp\"} : lp), \"extension$ebnf$1\", \"index\", \"extension$ebnf$2\", (lexer.has(\"comma\") ? {type: \"comma\"} : comma), \"extension$ebnf$3\", \"length\", \"extension$ebnf$4\", (lexer.has(\"rp\") ? {type: \"rp\"} : rp)], \"postprocess\": d => {return { index: d[2], length: d[6] }}},\n    {\"name\": \"structure$ebnf$1\", \"symbols\": [\"_\"], \"postprocess\": id},\n    {\"name\": \"structure$ebnf$1\", \"symbols\": [], \"postprocess\": function(d) {return null;}},\n    {\"name\": \"structure$ebnf$2\", \"symbols\": [\"_\"], \"postprocess\": id},\n    {\"name\": \"structure$ebnf$2\", \"symbols\": [], \"postprocess\": function(d) {return null;}},\n    {\"name\": \"structure$ebnf$3\", \"symbols\": []},\n    {\"name\": \"structure$ebnf$3\", \"symbols\": [\"structure$ebnf$3\", \"tuple\"], \"postprocess\": function arrpush(d) {return d[0].concat([d[1]]);}},\n    {\"name\": \"structure$ebnf$4\", \"symbols\": [\"_\"], \"postprocess\": id},\n    {\"name\": \"structure$ebnf$4\", \"symbols\": [], \"postprocess\": function(d) {return null;}},\n    {\"name\": \"structure$ebnf$5\", \"symbols\": [\"_\"], \"postprocess\": id},\n    {\"name\": \"structure$ebnf$5\", \"symbols\": [], \"postprocess\": function(d) {return null;}},\n    {\"name\": \"structure\", \"symbols\": [(lexer.has(\"lb\") ? {type: \"lb\"} : lb), \"structure$ebnf$1\", \"division\", \"structure$ebnf$2\", \"structure$ebnf$3\", \"structure$ebnf$4\", (lexer.has(\"rb\") ? {type: \"rb\"} : rb), \"structure$ebnf$5\"], \"postprocess\": d => {return { division: d[2], subtuples: d[4] }}},\n    {\"name\": \"index\", \"symbols\": [(lexer.has(\"number\") ? {type: \"number\"} : number)], \"postprocess\": d => parseInt(d.join(\"\"))},\n    {\"name\": \"length\", \"symbols\": [(lexer.has(\"number\") ? {type: \"number\"} : number)], \"postprocess\": d => parseInt(d.join(\"\"))},\n    {\"name\": \"division\", \"symbols\": [(lexer.has(\"number\") ? {type: \"number\"} : number)], \"postprocess\": d => parseInt(d.join(\"\"))},\n    {\"name\": \"_\", \"symbols\": [(lexer.has(\"ws\") ? {type: \"ws\"} : ws)], \"postprocess\": d => { return null; }}\n]\n  , ParserStart: \"tuple\"\n}\nif (typeof module !== 'undefined'&& typeof module.exports !== 'undefined') {\n   module.exports = grammar;\n} else {\n   window.grammar = grammar;\n}\n})();\n"
  },
  {
    "path": "cli.js",
    "content": "const fs = require(\"fs\");\nconst path = require(\"path\");\nconst { RhythmParser, Nestup } = require(\"./index\");\nconst writeOnsetsAsMidi = require(\"./src/trackWriter\");\nconst { program } = require('commander');\nprogram.version('0.1.0');\n\nprogram\n\t.requiredOption('-i, --input <input>', 'input rhythm file (required)')\n\t.option('-w, --watch <destination>', 'output directory for watch mode')\n\t.parse(process.argv);\n\nfunction process(text, outputFilePath) {\n\tconst parser = new RhythmParser();\n\tconst parseTree = parser.parse(text);\n\tconst nestup = new Nestup(parseTree);\n\twriteOnsetsAsMidi(nestup, \"C3\", 512, outputFilePath);\n}\n\nfunction makeOutName(container, prefix) {\n\tif (container) {\n\t\tconst outName = `out-${Date.now()}`;\n\t\treturn path.join(container, outName);\n\t} else {\n\t\treturn prefix;\n\t}\n}\n\nlet outName = makeOutName(program.watch, program.args[0]);\nlet lastModTime = fs.statSync(program.input).mtime;\n\n// Process straight through\nconsole.log(program.input);\nfs.readFile(program.input, { encoding: \"utf8\" }, (err, contents) => {\n\tif (err) throw err;\n\tprocess(contents, outName);\n});\n\n// Watch mode\nif (program.watch) {\n\tlet location = path.dirname(program.input);\n\tconsole.log(`Watching ${program.input} for file changes`);\n\tfs.watch(\n\t\tprogram.input,\n\t\t{ persistent: true, encoding: \"utf8\" },\n\t\t(eventType, filename) => {\n\t\t\tif (eventType === \"change\") {\n\t\t\t\tconst inpath = path.join(location, filename);\n\t\t\t\tconst nmodtime = fs.statSync(inpath).mtime;\n\t\t\t\tif (nmodtime.getTime() !== lastModTime.getTime()) {\n\t\t\t\t\tlastModTime = nmodtime;\n\t\t\t\t\toutName = makeOutName(program.watch, program.args[0]);\n\t\t\t\t\tconsole.log(`Change detected, writing to ${outName}`);\n\t\t\t\t\tfs.readFile(path.join(location, filename), { encoding: \"utf8\" }, (err, contents) => {\n\t\t\t\t\t\tif (err) throw err;\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tprocess(contents, outName);\n\t\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\t\tconsole.error(e);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t)\n}\n"
  },
  {
    "path": "grammar/grammar.ne",
    "content": "# Add the moo lexer\n@{%\nconst moo = require(\"moo\");\n\nconst lexer = moo.compile({\n  ws: { match: /\\s+/, lineBreaks: true },\n  unsigned_integer_tk: /[0-9]+/,\n  word: /[a-z]+/,\n  lp: /\\(/,\n  comma: /,/,\n  rp: /\\)/,\n  lb: /\\{/,\n  rb: /\\}/,\n  ls: /\\[/,\n  rs: /\\]/,\n  underscore: /_/,\n  colon: /:/,\n  prime: /'/,\n  gt: />/,\n  lt: /</,\n  comment: /\\/\\/.*?$/,\n  slash: /\\//,\n});\n%}\n\n# Requires\n@{%\nconst Fraction = require(\"fraction.js\");\n%}\n\n# Default structures\n@{%\n// Beat ratio\nconst dbr = new Fraction(1);\n// Container size\nconst dpd = { length: 4, beatRatio: dbr };\n%}\n\n# Pass your lexer object using the @lexer option:\n@lexer lexer\n\n# A nestup is zero or more containers\nnestup ->\n\t  _:* {% d => [] %}\n\t| container_list_or_subdivisions _:* {% d => d[0] %}\n\ncontainer_list_or_subdivisions ->\n\t  _:* subdivisions {% d => { return [{ dimension: undefined, subdivisions: d[1] }] } %}\n\t| container_list {% d => d[0] %}\n\n# The containers can be tied together\ncontainer_list ->\n\t  container\n\t| container container_list {% d => { return [d[0]].concat(d[1]) } %}\n\t| container _:* %underscore container_list {% d => { d[0].tie = true; return [d[0]].concat(d[3]); } %}\n\n# A container can be sized or unsized (necessary for ranged containers)\ncontainer ->\n\t  _:* sized_container {% d => d[1] %}\n\t| _:* unsized_container {% d => d[1] %}\n\n# All containers must have either subcontainers or subdivisions, but not both\nsized_container ->\n\t  sized_contents_with_subcontainers {% d => d[0] %}\n\t| sized_contents _:* subdivisions {% d => { return { dimension: d[0].dimension, empty: d[0].empty, subdivisions: d[2] }} %}\n\t| sized_contents {% d => d[0] %}\n\nunsized_container ->\n\t  unsized_contents_with_subcontainers {% d => d[0] %}\n\t| unsized_contents _:* subdivisions {% d => { return { dimension: d[0].dimension, empty: d[0].empty, subdivisions: d[2] }} %}\n\t| unsized_contents {% d => d[0] %}\n\n# Sized contents have explicit dimension\nsized_contents ->\n\t  %ls _:* dimension _:* %rs {% d => { return { dimension: d[2] }} %}\n\t| %ls _:* %prime _:* dimension _:* %rs {% d => { return { dimension: d[4], empty: true }} %}\n\nsized_contents_with_subcontainers ->\n\t  %ls _:* dimension container_list_or_subdivisions _:* %rs {% d => { return { dimension: d[2], contents: d[3] }} %}\n\n# Unsized contents have no explicit dimension, only contents\nunsized_contents ->\n\t  %ls _:* %rs {% d => { return { dimension: undefined, subdivisions: {division: 1} }} %}\n\t| %ls _:* %prime _:* %rs {% d => { return { dimension: undefined, empty: true, subdivisions: {division: 1} }} %}\n\nunsized_contents_with_subcontainers ->\n\t%ls container_list_or_subdivisions _:* %rs {% d => { return { dimension: { proportionality: \"+\", scale: 1 }, contents: d[1] }} %}\n\n# Container dimension must include at least one of proportionality or scale\ndimension ->\n\t  integer {% d => { return { proportionality: d[0], scale: new Fraction(1) }} %}\n\t| %comma _:* ratio {% d => { return { proportionality: \"+\", scale: d[2] }} %}\n\t| integer _:* %comma _:* ratio {% d => { return { proportionality: d[0], scale: d[4] }} %}\n\n# Subdivisions is just a subdivision number followed by a list of ranged containers\nsubdivisions ->\n\t  %lb _:* integer ranged_container_list:? _:* %rb {% d => {return { division: d[2], ranges: d[3] }} %}\n\t| %lb _:* rotation ranged_container_list:? _:* %rb {% d => {return { division: 1, rotation: d[2], ranges: d[3] }} %}\n\t| %lb _:* integer _:* rotation ranged_container_list:? _:* %rb {% d => {return { division: d[2], rotation: d[4], ranges: d[5] }} %}\n\nrotation ->\n\t  %lt _:* ratio {% d => d[2].mul(-1) %}\n\t| %gt _:* ratio {% d => d[2] %}\n\n# Ranged containers can also be tied\nranged_container_list ->\n\t  ranged_container {% d => [d[0]] %}\n\t| ranged_container ranged_container_list {% d => [d[0]].concat(d[1]) %}\n\t| ranged_container _:* %underscore ranged_container_list {% d => { d[0].container.tie = true; return [d[0]].concat(d[3]); } %}\n\n# A ranged container is a range followed by an unsized container, or a range followed by subdivisions\nranged_container ->\n\t  _:* range _:* unsized_container {% d => {return { range: d[1], container: d[3] }} %}\n\t| _:* range _:* subdivisions {% d => {return { range: d[1], container: { dimension: undefined, subdivisions: d[3] } }} %}\n\t| _:* range {% d => {return { range: d[1], container: { dimension: undefined, subdivisions: {division: 1} } }}%}\n\n# A range is an index followed by an optional length (defaults to 1)\nrange ->\n\t  integer {% d => {return { index: d[0], length: 1 }} %}\n\t| integer _:* %colon _:* integer {% d => {return { index: d[0], length: d[4] }} %}\n\n# A rational number is two integers separated by a slash\nratio ->\n\t  integer {% d => new Fraction(d[0])  %}\n\t| integer _:* %slash _:* integer {% d => new Fraction(d[0], d[4])  %}\n\n# An integer is, well, an integer\ninteger -> %unsigned_integer_tk {% d => parseInt(d.join(\"\")) %}\n\n# Whitespace\n_ ->\n\t  %ws {% d => { return null; } %}\n\t| %comment {% d => { return null; } %}\n"
  },
  {
    "path": "grammar.html",
    "content": "<!DOCTYPE html>\n<html>\n<head>\n<meta charset=\"UTF-8\">\n<style type=\"text/css\">\nsvg.railroad-diagram {\n    background-color: hsl(30,20%,95%);\n}\nsvg.railroad-diagram path {\n    stroke-width: 3;\n    stroke: black;\n    fill: rgba(0,0,0,0);\n}\nsvg.railroad-diagram text {\n    font: bold 14px monospace;\n    text-anchor: middle;\n}\nsvg.railroad-diagram text.label {\n    text-anchor: start;\n}\nsvg.railroad-diagram text.comment {\n    font: italic 12px monospace;\n}\nsvg.railroad-diagram rect {\n    stroke-width: 3;\n    stroke: black;\n    fill: hsl(120,100%,90%);\n}\n\n</style>\n</head>\n<body>\n<h1><code>nestup</code></h1>\n<div>\n<svg class=\"railroad-diagram\" width=\"469\" height=\"121\" viewBox=\"0 0 469 121\">\n<g transform=\"translate(.5 .5)\">\n<path d=\"M 20 31 v 20 m 10 -20 v 20 m -10 -10 h 20.5\"></path>\n<g>\n<path d=\"M40 41h0\"></path>\n<path d=\"M428 41h0\"></path>\n<path d=\"M40 41h20\"></path>\n<g>\n<path d=\"M60 41h130\"></path>\n<path d=\"M278 41h130\"></path>\n<g>\n<path d=\"M190 41h0\"></path>\n<path d=\"M278 41h0\"></path>\n<path d=\"M190 41a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10\"></path>\n<g>\n<path d=\"M210 21h48\"></path>\n</g>\n<path d=\"M258 21a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10\"></path>\n<path d=\"M190 41h20\"></path>\n<g>\n<path d=\"M210 41h0\"></path>\n<path d=\"M258 41h0\"></path>\n<path d=\"M210 41h10\"></path>\n<g>\n<path d=\"M220 41h0\"></path>\n<path d=\"M248 41h0\"></path>\n<rect x=\"220\" y=\"30\" width=\"28\" height=\"22\"></rect>\n<text x=\"234\" y=\"45\">&#95;</text>\n</g>\n<path d=\"M248 41h10\"></path>\n<path d=\"M220 41a10 10 0 0 0 -10 10v0a10 10 0 0 0 10 10\"></path>\n<g>\n<path d=\"M220 61h28\"></path>\n</g>\n<path d=\"M248 61a10 10 0 0 0 10 -10v0a10 10 0 0 0 -10 -10\"></path>\n</g>\n<path d=\"M258 41h20\"></path>\n</g>\n</g>\n<path d=\"M408 41h20\"></path>\n<path d=\"M40 41a10 10 0 0 1 10 10v29a10 10 0 0 0 10 10\"></path>\n<g>\n<path d=\"M60 90h0\"></path>\n<path d=\"M408 90h0\"></path>\n<path d=\"M60 90h10\"></path>\n<g>\n<path d=\"M70 90h0\"></path>\n<path d=\"M330 90h0\"></path>\n<rect x=\"70\" y=\"79\" width=\"260\" height=\"22\"></rect>\n<text x=\"200\" y=\"94\">container&#95;list&#95;or&#95;subdivisions</text>\n</g>\n<path d=\"M330 90h10\"></path>\n<g>\n<path d=\"M340 90h0\"></path>\n<path d=\"M408 90h0\"></path>\n<path d=\"M340 90a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10\"></path>\n<g>\n<path d=\"M360 70h28\"></path>\n</g>\n<path d=\"M388 70a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10\"></path>\n<path d=\"M340 90h20\"></path>\n<g>\n<path d=\"M360 90h0\"></path>\n<path d=\"M388 90h0\"></path>\n<rect x=\"360\" y=\"79\" width=\"28\" height=\"22\"></rect>\n<text x=\"374\" y=\"94\">&#95;</text>\n</g>\n<path d=\"M388 90h20\"></path>\n</g>\n</g>\n<path d=\"M408 90a10 10 0 0 0 10 -10v-29a10 10 0 0 1 10 -10\"></path>\n</g>\n<path d=\"M 428 41 h 20 m -10 -10 v 20 m 10 -20 v 20\"></path>\n</g>\n</svg>\n\n</div>\n<h1><code>container_list_or_subdivisions</code></h1>\n<div>\n<svg class=\"railroad-diagram\" width=\"325\" height=\"102\" viewBox=\"0 0 325 102\">\n<g transform=\"translate(.5 .5)\">\n<path d=\"M 20 31 v 20 m 10 -20 v 20 m -10 -10 h 20.5\"></path>\n<g>\n<path d=\"M40 41h0\"></path>\n<path d=\"M284 41h0\"></path>\n<path d=\"M40 41h20\"></path>\n<g>\n<path d=\"M60 41h0\"></path>\n<path d=\"M264 41h0\"></path>\n<g>\n<path d=\"M60 41h0\"></path>\n<path d=\"M128 41h0\"></path>\n<path d=\"M60 41a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10\"></path>\n<g>\n<path d=\"M80 21h28\"></path>\n</g>\n<path d=\"M108 21a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10\"></path>\n<path d=\"M60 41h20\"></path>\n<g>\n<path d=\"M80 41h0\"></path>\n<path d=\"M108 41h0\"></path>\n<rect x=\"80\" y=\"30\" width=\"28\" height=\"22\"></rect>\n<text x=\"94\" y=\"45\">&#95;</text>\n</g>\n<path d=\"M108 41h20\"></path>\n</g>\n<path d=\"M128 41h10\"></path>\n<g>\n<path d=\"M138 41h0\"></path>\n<path d=\"M254 41h0\"></path>\n<rect x=\"138\" y=\"30\" width=\"116\" height=\"22\"></rect>\n<text x=\"196\" y=\"45\">subdivisions</text>\n</g>\n<path d=\"M254 41h10\"></path>\n</g>\n<path d=\"M264 41h20\"></path>\n<path d=\"M40 41a10 10 0 0 1 10 10v10a10 10 0 0 0 10 10\"></path>\n<g>\n<path d=\"M60 71h26\"></path>\n<path d=\"M238 71h26\"></path>\n<path d=\"M86 71h10\"></path>\n<g>\n<path d=\"M96 71h0\"></path>\n<path d=\"M228 71h0\"></path>\n<rect x=\"96\" y=\"60\" width=\"132\" height=\"22\"></rect>\n<text x=\"162\" y=\"75\">container&#95;list</text>\n</g>\n<path d=\"M228 71h10\"></path>\n</g>\n<path d=\"M264 71a10 10 0 0 0 10 -10v-10a10 10 0 0 1 10 -10\"></path>\n</g>\n<path d=\"M 284 41 h 20 m -10 -10 v 20 m 10 -20 v 20\"></path>\n</g>\n</svg>\n\n</div>\n<h1><code>container_list</code></h1>\n<div>\n<svg class=\"railroad-diagram\" width=\"573\" height=\"132\" viewBox=\"0 0 573 132\">\n<g transform=\"translate(.5 .5)\">\n<path d=\"M 20 21 v 20 m 10 -20 v 20 m -10 -10 h 20.5\"></path>\n<g>\n<path d=\"M40 31h0\"></path>\n<path d=\"M532 31h0\"></path>\n<path d=\"M40 31h20\"></path>\n<g>\n<path d=\"M60 31h170\"></path>\n<path d=\"M342 31h170\"></path>\n<path d=\"M230 31h10\"></path>\n<g>\n<path d=\"M240 31h0\"></path>\n<path d=\"M332 31h0\"></path>\n<rect x=\"240\" y=\"20\" width=\"92\" height=\"22\"></rect>\n<text x=\"286\" y=\"35\">container</text>\n</g>\n<path d=\"M332 31h10\"></path>\n</g>\n<path d=\"M512 31h20\"></path>\n<path d=\"M40 31a10 10 0 0 1 10 10v10a10 10 0 0 0 10 10\"></path>\n<g>\n<path d=\"M60 61h94\"></path>\n<path d=\"M418 61h94\"></path>\n<path d=\"M154 61h10\"></path>\n<g>\n<path d=\"M164 61h0\"></path>\n<path d=\"M256 61h0\"></path>\n<rect x=\"164\" y=\"50\" width=\"92\" height=\"22\"></rect>\n<text x=\"210\" y=\"65\">container</text>\n</g>\n<path d=\"M256 61h10\"></path>\n<path d=\"M266 61h10\"></path>\n<g>\n<path d=\"M276 61h0\"></path>\n<path d=\"M408 61h0\"></path>\n<rect x=\"276\" y=\"50\" width=\"132\" height=\"22\"></rect>\n<text x=\"342\" y=\"65\">container&#95;list</text>\n</g>\n<path d=\"M408 61h10\"></path>\n</g>\n<path d=\"M512 61a10 10 0 0 0 10 -10v-10a10 10 0 0 1 10 -10\"></path>\n<path d=\"M40 31a10 10 0 0 1 10 10v50a10 10 0 0 0 10 10\"></path>\n<g>\n<path d=\"M60 101h0\"></path>\n<path d=\"M512 101h0\"></path>\n<path d=\"M60 101h10\"></path>\n<g>\n<path d=\"M70 101h0\"></path>\n<path d=\"M162 101h0\"></path>\n<rect x=\"70\" y=\"90\" width=\"92\" height=\"22\"></rect>\n<text x=\"116\" y=\"105\">container</text>\n</g>\n<path d=\"M162 101h10\"></path>\n<g>\n<path d=\"M172 101h0\"></path>\n<path d=\"M240 101h0\"></path>\n<path d=\"M172 101a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10\"></path>\n<g>\n<path d=\"M192 81h28\"></path>\n</g>\n<path d=\"M220 81a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10\"></path>\n<path d=\"M172 101h20\"></path>\n<g>\n<path d=\"M192 101h0\"></path>\n<path d=\"M220 101h0\"></path>\n<rect x=\"192\" y=\"90\" width=\"28\" height=\"22\"></rect>\n<text x=\"206\" y=\"105\">&#95;</text>\n</g>\n<path d=\"M220 101h20\"></path>\n</g>\n<path d=\"M240 101h10\"></path>\n<g>\n<path d=\"M250 101h0\"></path>\n<path d=\"M350 101h0\"></path>\n<rect x=\"250\" y=\"90\" width=\"100\" height=\"22\" rx=\"10\" ry=\"10\"></rect>\n<text x=\"300\" y=\"105\">underscore</text>\n</g>\n<path d=\"M350 101h10\"></path>\n<path d=\"M360 101h10\"></path>\n<g>\n<path d=\"M370 101h0\"></path>\n<path d=\"M502 101h0\"></path>\n<rect x=\"370\" y=\"90\" width=\"132\" height=\"22\"></rect>\n<text x=\"436\" y=\"105\">container&#95;list</text>\n</g>\n<path d=\"M502 101h10\"></path>\n</g>\n<path d=\"M512 101a10 10 0 0 0 10 -10v-50a10 10 0 0 1 10 -10\"></path>\n</g>\n<path d=\"M 532 31 h 20 m -10 -10 v 20 m 10 -20 v 20\"></path>\n</g>\n</svg>\n\n</div>\n<h1><code>container</code></h1>\n<div>\n<svg class=\"railroad-diagram\" width=\"365\" height=\"112\" viewBox=\"0 0 365 112\">\n<g transform=\"translate(.5 .5)\">\n<path d=\"M 20 31 v 20 m 10 -20 v 20 m -10 -10 h 20.5\"></path>\n<g>\n<path d=\"M40 41h0\"></path>\n<path d=\"M324 41h0\"></path>\n<path d=\"M40 41h20\"></path>\n<g>\n<path d=\"M60 41h8\"></path>\n<path d=\"M296 41h8\"></path>\n<g>\n<path d=\"M68 41h0\"></path>\n<path d=\"M136 41h0\"></path>\n<path d=\"M68 41a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10\"></path>\n<g>\n<path d=\"M88 21h28\"></path>\n</g>\n<path d=\"M116 21a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10\"></path>\n<path d=\"M68 41h20\"></path>\n<g>\n<path d=\"M88 41h0\"></path>\n<path d=\"M116 41h0\"></path>\n<rect x=\"88\" y=\"30\" width=\"28\" height=\"22\"></rect>\n<text x=\"102\" y=\"45\">&#95;</text>\n</g>\n<path d=\"M116 41h20\"></path>\n</g>\n<path d=\"M136 41h10\"></path>\n<g>\n<path d=\"M146 41h0\"></path>\n<path d=\"M286 41h0\"></path>\n<rect x=\"146\" y=\"30\" width=\"140\" height=\"22\"></rect>\n<text x=\"216\" y=\"45\">sized&#95;container</text>\n</g>\n<path d=\"M286 41h10\"></path>\n</g>\n<path d=\"M304 41h20\"></path>\n<path d=\"M40 41a10 10 0 0 1 10 10v20a10 10 0 0 0 10 10\"></path>\n<g>\n<path d=\"M60 81h0\"></path>\n<path d=\"M304 81h0\"></path>\n<g>\n<path d=\"M60 81h0\"></path>\n<path d=\"M128 81h0\"></path>\n<path d=\"M60 81a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10\"></path>\n<g>\n<path d=\"M80 61h28\"></path>\n</g>\n<path d=\"M108 61a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10\"></path>\n<path d=\"M60 81h20\"></path>\n<g>\n<path d=\"M80 81h0\"></path>\n<path d=\"M108 81h0\"></path>\n<rect x=\"80\" y=\"70\" width=\"28\" height=\"22\"></rect>\n<text x=\"94\" y=\"85\">&#95;</text>\n</g>\n<path d=\"M108 81h20\"></path>\n</g>\n<path d=\"M128 81h10\"></path>\n<g>\n<path d=\"M138 81h0\"></path>\n<path d=\"M294 81h0\"></path>\n<rect x=\"138\" y=\"70\" width=\"156\" height=\"22\"></rect>\n<text x=\"216\" y=\"85\">unsized&#95;container</text>\n</g>\n<path d=\"M294 81h10\"></path>\n</g>\n<path d=\"M304 81a10 10 0 0 0 10 -10v-20a10 10 0 0 1 10 -10\"></path>\n</g>\n<path d=\"M 324 41 h 20 m -10 -10 v 20 m 10 -20 v 20\"></path>\n</g>\n</svg>\n\n</div>\n<h1><code>sized_container</code></h1>\n<div>\n<svg class=\"railroad-diagram\" width=\"477\" height=\"102\" viewBox=\"0 0 477 102\">\n<g transform=\"translate(.5 .5)\">\n<path d=\"M 20 21 v 20 m 10 -20 v 20 m -10 -10 h 20.5\"></path>\n<g>\n<path d=\"M40 31h0\"></path>\n<path d=\"M436 31h0\"></path>\n<path d=\"M40 31h20\"></path>\n<g>\n<path d=\"M60 31h26\"></path>\n<path d=\"M390 31h26\"></path>\n<path d=\"M86 31h10\"></path>\n<g>\n<path d=\"M96 31h0\"></path>\n<path d=\"M380 31h0\"></path>\n<rect x=\"96\" y=\"20\" width=\"284\" height=\"22\"></rect>\n<text x=\"238\" y=\"35\">sized&#95;contents&#95;with&#95;subcontainers</text>\n</g>\n<path d=\"M380 31h10\"></path>\n</g>\n<path d=\"M416 31h20\"></path>\n<path d=\"M40 31a10 10 0 0 1 10 10v20a10 10 0 0 0 10 10\"></path>\n<g>\n<path d=\"M60 71h0\"></path>\n<path d=\"M416 71h0\"></path>\n<path d=\"M60 71h10\"></path>\n<g>\n<path d=\"M70 71h0\"></path>\n<path d=\"M202 71h0\"></path>\n<rect x=\"70\" y=\"60\" width=\"132\" height=\"22\"></rect>\n<text x=\"136\" y=\"75\">sized&#95;contents</text>\n</g>\n<path d=\"M202 71h10\"></path>\n<g>\n<path d=\"M212 71h0\"></path>\n<path d=\"M280 71h0\"></path>\n<path d=\"M212 71a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10\"></path>\n<g>\n<path d=\"M232 51h28\"></path>\n</g>\n<path d=\"M260 51a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10\"></path>\n<path d=\"M212 71h20\"></path>\n<g>\n<path d=\"M232 71h0\"></path>\n<path d=\"M260 71h0\"></path>\n<rect x=\"232\" y=\"60\" width=\"28\" height=\"22\"></rect>\n<text x=\"246\" y=\"75\">&#95;</text>\n</g>\n<path d=\"M260 71h20\"></path>\n</g>\n<path d=\"M280 71h10\"></path>\n<g>\n<path d=\"M290 71h0\"></path>\n<path d=\"M406 71h0\"></path>\n<rect x=\"290\" y=\"60\" width=\"116\" height=\"22\"></rect>\n<text x=\"348\" y=\"75\">subdivisions</text>\n</g>\n<path d=\"M406 71h10\"></path>\n</g>\n<path d=\"M416 71a10 10 0 0 0 10 -10v-20a10 10 0 0 1 10 -10\"></path>\n</g>\n<path d=\"M 436 31 h 20 m -10 -10 v 20 m 10 -20 v 20\"></path>\n</g>\n</svg>\n\n</div>\n<h1><code>unsized_container</code></h1>\n<div>\n<svg class=\"railroad-diagram\" width=\"493\" height=\"132\" viewBox=\"0 0 493 132\">\n<g transform=\"translate(.5 .5)\">\n<path d=\"M 20 21 v 20 m 10 -20 v 20 m -10 -10 h 20.5\"></path>\n<g>\n<path d=\"M40 31h0\"></path>\n<path d=\"M452 31h0\"></path>\n<path d=\"M40 31h20\"></path>\n<g>\n<path d=\"M60 31h26\"></path>\n<path d=\"M406 31h26\"></path>\n<path d=\"M86 31h10\"></path>\n<g>\n<path d=\"M96 31h0\"></path>\n<path d=\"M396 31h0\"></path>\n<rect x=\"96\" y=\"20\" width=\"300\" height=\"22\"></rect>\n<text x=\"246\" y=\"35\">unsized&#95;contents&#95;with&#95;subcontainers</text>\n</g>\n<path d=\"M396 31h10\"></path>\n</g>\n<path d=\"M432 31h20\"></path>\n<path d=\"M40 31a10 10 0 0 1 10 10v20a10 10 0 0 0 10 10\"></path>\n<g>\n<path d=\"M60 71h0\"></path>\n<path d=\"M432 71h0\"></path>\n<path d=\"M60 71h10\"></path>\n<g>\n<path d=\"M70 71h0\"></path>\n<path d=\"M218 71h0\"></path>\n<rect x=\"70\" y=\"60\" width=\"148\" height=\"22\"></rect>\n<text x=\"144\" y=\"75\">unsized&#95;contents</text>\n</g>\n<path d=\"M218 71h10\"></path>\n<g>\n<path d=\"M228 71h0\"></path>\n<path d=\"M296 71h0\"></path>\n<path d=\"M228 71a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10\"></path>\n<g>\n<path d=\"M248 51h28\"></path>\n</g>\n<path d=\"M276 51a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10\"></path>\n<path d=\"M228 71h20\"></path>\n<g>\n<path d=\"M248 71h0\"></path>\n<path d=\"M276 71h0\"></path>\n<rect x=\"248\" y=\"60\" width=\"28\" height=\"22\"></rect>\n<text x=\"262\" y=\"75\">&#95;</text>\n</g>\n<path d=\"M276 71h20\"></path>\n</g>\n<path d=\"M296 71h10\"></path>\n<g>\n<path d=\"M306 71h0\"></path>\n<path d=\"M422 71h0\"></path>\n<rect x=\"306\" y=\"60\" width=\"116\" height=\"22\"></rect>\n<text x=\"364\" y=\"75\">subdivisions</text>\n</g>\n<path d=\"M422 71h10\"></path>\n</g>\n<path d=\"M432 71a10 10 0 0 0 10 -10v-20a10 10 0 0 1 10 -10\"></path>\n<path d=\"M40 31a10 10 0 0 1 10 10v50a10 10 0 0 0 10 10\"></path>\n<g>\n<path d=\"M60 101h102\"></path>\n<path d=\"M330 101h102\"></path>\n<path d=\"M162 101h10\"></path>\n<g>\n<path d=\"M172 101h0\"></path>\n<path d=\"M320 101h0\"></path>\n<rect x=\"172\" y=\"90\" width=\"148\" height=\"22\"></rect>\n<text x=\"246\" y=\"105\">unsized&#95;contents</text>\n</g>\n<path d=\"M320 101h10\"></path>\n</g>\n<path d=\"M432 101a10 10 0 0 0 10 -10v-50a10 10 0 0 1 10 -10\"></path>\n</g>\n<path d=\"M 452 31 h 20 m -10 -10 v 20 m 10 -20 v 20\"></path>\n</g>\n</svg>\n\n</div>\n<h1><code>sized_contents</code></h1>\n<div>\n<svg class=\"railroad-diagram\" width=\"481\" height=\"72\" viewBox=\"0 0 481 72\">\n<g transform=\"translate(.5 .5)\">\n<path d=\"M 20 31 v 20 m 10 -20 v 20 m -10 -10 h 20.5\"></path>\n<g>\n<path d=\"M40 41h0\"></path>\n<path d=\"M440 41h0\"></path>\n<path d=\"M40 41h20\"></path>\n<g>\n<path d=\"M60 41h0\"></path>\n<path d=\"M420 41h0\"></path>\n<path d=\"M60 41h10\"></path>\n<g>\n<path d=\"M70 41h0\"></path>\n<path d=\"M106 41h0\"></path>\n<rect x=\"70\" y=\"30\" width=\"36\" height=\"22\" rx=\"10\" ry=\"10\"></rect>\n<text x=\"88\" y=\"45\">ls</text>\n</g>\n<path d=\"M106 41h10\"></path>\n<g>\n<path d=\"M116 41h0\"></path>\n<path d=\"M184 41h0\"></path>\n<path d=\"M116 41a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10\"></path>\n<g>\n<path d=\"M136 21h28\"></path>\n</g>\n<path d=\"M164 21a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10\"></path>\n<path d=\"M116 41h20\"></path>\n<g>\n<path d=\"M136 41h0\"></path>\n<path d=\"M164 41h0\"></path>\n<rect x=\"136\" y=\"30\" width=\"28\" height=\"22\"></rect>\n<text x=\"150\" y=\"45\">&#95;</text>\n</g>\n<path d=\"M164 41h20\"></path>\n</g>\n<path d=\"M184 41h10\"></path>\n<g>\n<path d=\"M194 41h0\"></path>\n<path d=\"M286 41h0\"></path>\n<rect x=\"194\" y=\"30\" width=\"92\" height=\"22\"></rect>\n<text x=\"240\" y=\"45\">dimension</text>\n</g>\n<path d=\"M286 41h10\"></path>\n<g>\n<path d=\"M296 41h0\"></path>\n<path d=\"M364 41h0\"></path>\n<path d=\"M296 41a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10\"></path>\n<g>\n<path d=\"M316 21h28\"></path>\n</g>\n<path d=\"M344 21a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10\"></path>\n<path d=\"M296 41h20\"></path>\n<g>\n<path d=\"M316 41h0\"></path>\n<path d=\"M344 41h0\"></path>\n<rect x=\"316\" y=\"30\" width=\"28\" height=\"22\"></rect>\n<text x=\"330\" y=\"45\">&#95;</text>\n</g>\n<path d=\"M344 41h20\"></path>\n</g>\n<path d=\"M364 41h10\"></path>\n<g>\n<path d=\"M374 41h0\"></path>\n<path d=\"M410 41h0\"></path>\n<rect x=\"374\" y=\"30\" width=\"36\" height=\"22\" rx=\"10\" ry=\"10\"></rect>\n<text x=\"392\" y=\"45\">rs</text>\n</g>\n<path d=\"M410 41h10\"></path>\n</g>\n<path d=\"M420 41h20\"></path>\n</g>\n<path d=\"M 440 41 h 20 m -10 -10 v 20 m 10 -20 v 20\"></path>\n</g>\n</svg>\n\n</div>\n<h1><code>sized_contents_with_subcontainers</code></h1>\n<div>\n<svg class=\"railroad-diagram\" width=\"781\" height=\"112\" viewBox=\"0 0 781 112\">\n<g transform=\"translate(.5 .5)\">\n<path d=\"M 20 31 v 20 m 10 -20 v 20 m -10 -10 h 20.5\"></path>\n<g>\n<path d=\"M40 41h0\"></path>\n<path d=\"M740 41h0\"></path>\n<path d=\"M40 41h20\"></path>\n<g>\n<path d=\"M60 41h0\"></path>\n<path d=\"M720 41h0\"></path>\n<path d=\"M60 41h10\"></path>\n<g>\n<path d=\"M70 41h0\"></path>\n<path d=\"M106 41h0\"></path>\n<rect x=\"70\" y=\"30\" width=\"36\" height=\"22\" rx=\"10\" ry=\"10\"></rect>\n<text x=\"88\" y=\"45\">ls</text>\n</g>\n<path d=\"M106 41h10\"></path>\n<g>\n<path d=\"M116 41h0\"></path>\n<path d=\"M184 41h0\"></path>\n<path d=\"M116 41a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10\"></path>\n<g>\n<path d=\"M136 21h28\"></path>\n</g>\n<path d=\"M164 21a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10\"></path>\n<path d=\"M116 41h20\"></path>\n<g>\n<path d=\"M136 41h0\"></path>\n<path d=\"M164 41h0\"></path>\n<rect x=\"136\" y=\"30\" width=\"28\" height=\"22\"></rect>\n<text x=\"150\" y=\"45\">&#95;</text>\n</g>\n<path d=\"M164 41h20\"></path>\n</g>\n<path d=\"M184 41h10\"></path>\n<g>\n<path d=\"M194 41h0\"></path>\n<path d=\"M286 41h0\"></path>\n<rect x=\"194\" y=\"30\" width=\"92\" height=\"22\"></rect>\n<text x=\"240\" y=\"45\">dimension</text>\n</g>\n<path d=\"M286 41h10\"></path>\n<g>\n<path d=\"M296 41h0\"></path>\n<path d=\"M596 41h0\"></path>\n<path d=\"M296 41a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10\"></path>\n<g>\n<path d=\"M316 21h260\"></path>\n</g>\n<path d=\"M576 21a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10\"></path>\n<path d=\"M296 41h20\"></path>\n<g>\n<path d=\"M316 41h0\"></path>\n<path d=\"M576 41h0\"></path>\n<rect x=\"316\" y=\"30\" width=\"260\" height=\"22\"></rect>\n<text x=\"446\" y=\"45\">container&#95;list&#95;or&#95;subdivisions</text>\n</g>\n<path d=\"M576 41h20\"></path>\n</g>\n<g>\n<path d=\"M596 41h0\"></path>\n<path d=\"M664 41h0\"></path>\n<path d=\"M596 41a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10\"></path>\n<g>\n<path d=\"M616 21h28\"></path>\n</g>\n<path d=\"M644 21a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10\"></path>\n<path d=\"M596 41h20\"></path>\n<g>\n<path d=\"M616 41h0\"></path>\n<path d=\"M644 41h0\"></path>\n<rect x=\"616\" y=\"30\" width=\"28\" height=\"22\"></rect>\n<text x=\"630\" y=\"45\">&#95;</text>\n</g>\n<path d=\"M644 41h20\"></path>\n</g>\n<path d=\"M664 41h10\"></path>\n<g>\n<path d=\"M674 41h0\"></path>\n<path d=\"M710 41h0\"></path>\n<rect x=\"674\" y=\"30\" width=\"36\" height=\"22\" rx=\"10\" ry=\"10\"></rect>\n<text x=\"692\" y=\"45\">rs</text>\n</g>\n<path d=\"M710 41h10\"></path>\n</g>\n<path d=\"M720 41h20\"></path>\n<path d=\"M40 41a10 10 0 0 1 10 10v20a10 10 0 0 0 10 10\"></path>\n<g>\n<path d=\"M60 81h90\"></path>\n<path d=\"M630 81h90\"></path>\n<path d=\"M150 81h10\"></path>\n<g>\n<path d=\"M160 81h0\"></path>\n<path d=\"M196 81h0\"></path>\n<rect x=\"160\" y=\"70\" width=\"36\" height=\"22\" rx=\"10\" ry=\"10\"></rect>\n<text x=\"178\" y=\"85\">ls</text>\n</g>\n<path d=\"M196 81h10\"></path>\n<g>\n<path d=\"M206 81h0\"></path>\n<path d=\"M506 81h0\"></path>\n<path d=\"M206 81a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10\"></path>\n<g>\n<path d=\"M226 61h260\"></path>\n</g>\n<path d=\"M486 61a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10\"></path>\n<path d=\"M206 81h20\"></path>\n<g>\n<path d=\"M226 81h0\"></path>\n<path d=\"M486 81h0\"></path>\n<rect x=\"226\" y=\"70\" width=\"260\" height=\"22\"></rect>\n<text x=\"356\" y=\"85\">container&#95;list&#95;or&#95;subdivisions</text>\n</g>\n<path d=\"M486 81h20\"></path>\n</g>\n<g>\n<path d=\"M506 81h0\"></path>\n<path d=\"M574 81h0\"></path>\n<path d=\"M506 81a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10\"></path>\n<g>\n<path d=\"M526 61h28\"></path>\n</g>\n<path d=\"M554 61a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10\"></path>\n<path d=\"M506 81h20\"></path>\n<g>\n<path d=\"M526 81h0\"></path>\n<path d=\"M554 81h0\"></path>\n<rect x=\"526\" y=\"70\" width=\"28\" height=\"22\"></rect>\n<text x=\"540\" y=\"85\">&#95;</text>\n</g>\n<path d=\"M554 81h20\"></path>\n</g>\n<path d=\"M574 81h10\"></path>\n<g>\n<path d=\"M584 81h0\"></path>\n<path d=\"M620 81h0\"></path>\n<rect x=\"584\" y=\"70\" width=\"36\" height=\"22\" rx=\"10\" ry=\"10\"></rect>\n<text x=\"602\" y=\"85\">rs</text>\n</g>\n<path d=\"M620 81h10\"></path>\n</g>\n<path d=\"M720 81a10 10 0 0 0 10 -10v-20a10 10 0 0 1 10 -10\"></path>\n</g>\n<path d=\"M 740 41 h 20 m -10 -10 v 20 m 10 -20 v 20\"></path>\n</g>\n</svg>\n\n</div>\n<h1><code>unsized_contents</code></h1>\n<div>\n<svg class=\"railroad-diagram\" width=\"301\" height=\"72\" viewBox=\"0 0 301 72\">\n<g transform=\"translate(.5 .5)\">\n<path d=\"M 20 31 v 20 m 10 -20 v 20 m -10 -10 h 20.5\"></path>\n<g>\n<path d=\"M40 41h0\"></path>\n<path d=\"M260 41h0\"></path>\n<path d=\"M40 41h20\"></path>\n<g>\n<path d=\"M60 41h0\"></path>\n<path d=\"M240 41h0\"></path>\n<path d=\"M60 41h10\"></path>\n<g>\n<path d=\"M70 41h0\"></path>\n<path d=\"M106 41h0\"></path>\n<rect x=\"70\" y=\"30\" width=\"36\" height=\"22\" rx=\"10\" ry=\"10\"></rect>\n<text x=\"88\" y=\"45\">ls</text>\n</g>\n<path d=\"M106 41h10\"></path>\n<g>\n<path d=\"M116 41h0\"></path>\n<path d=\"M184 41h0\"></path>\n<path d=\"M116 41a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10\"></path>\n<g>\n<path d=\"M136 21h28\"></path>\n</g>\n<path d=\"M164 21a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10\"></path>\n<path d=\"M116 41h20\"></path>\n<g>\n<path d=\"M136 41h0\"></path>\n<path d=\"M164 41h0\"></path>\n<rect x=\"136\" y=\"30\" width=\"28\" height=\"22\"></rect>\n<text x=\"150\" y=\"45\">&#95;</text>\n</g>\n<path d=\"M164 41h20\"></path>\n</g>\n<path d=\"M184 41h10\"></path>\n<g>\n<path d=\"M194 41h0\"></path>\n<path d=\"M230 41h0\"></path>\n<rect x=\"194\" y=\"30\" width=\"36\" height=\"22\" rx=\"10\" ry=\"10\"></rect>\n<text x=\"212\" y=\"45\">rs</text>\n</g>\n<path d=\"M230 41h10\"></path>\n</g>\n<path d=\"M240 41h20\"></path>\n</g>\n<path d=\"M 260 41 h 20 m -10 -10 v 20 m 10 -20 v 20\"></path>\n</g>\n</svg>\n\n</div>\n<h1><code>unsized_contents_with_subcontainers</code></h1>\n<div>\n<svg class=\"railroad-diagram\" width=\"601\" height=\"72\" viewBox=\"0 0 601 72\">\n<g transform=\"translate(.5 .5)\">\n<path d=\"M 20 31 v 20 m 10 -20 v 20 m -10 -10 h 20.5\"></path>\n<g>\n<path d=\"M40 41h0\"></path>\n<path d=\"M560 41h0\"></path>\n<path d=\"M40 41h20\"></path>\n<g>\n<path d=\"M60 41h0\"></path>\n<path d=\"M540 41h0\"></path>\n<path d=\"M60 41h10\"></path>\n<g>\n<path d=\"M70 41h0\"></path>\n<path d=\"M106 41h0\"></path>\n<rect x=\"70\" y=\"30\" width=\"36\" height=\"22\" rx=\"10\" ry=\"10\"></rect>\n<text x=\"88\" y=\"45\">ls</text>\n</g>\n<path d=\"M106 41h10\"></path>\n<g>\n<path d=\"M116 41h0\"></path>\n<path d=\"M416 41h0\"></path>\n<path d=\"M116 41a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10\"></path>\n<g>\n<path d=\"M136 21h260\"></path>\n</g>\n<path d=\"M396 21a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10\"></path>\n<path d=\"M116 41h20\"></path>\n<g>\n<path d=\"M136 41h0\"></path>\n<path d=\"M396 41h0\"></path>\n<rect x=\"136\" y=\"30\" width=\"260\" height=\"22\"></rect>\n<text x=\"266\" y=\"45\">container&#95;list&#95;or&#95;subdivisions</text>\n</g>\n<path d=\"M396 41h20\"></path>\n</g>\n<g>\n<path d=\"M416 41h0\"></path>\n<path d=\"M484 41h0\"></path>\n<path d=\"M416 41a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10\"></path>\n<g>\n<path d=\"M436 21h28\"></path>\n</g>\n<path d=\"M464 21a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10\"></path>\n<path d=\"M416 41h20\"></path>\n<g>\n<path d=\"M436 41h0\"></path>\n<path d=\"M464 41h0\"></path>\n<rect x=\"436\" y=\"30\" width=\"28\" height=\"22\"></rect>\n<text x=\"450\" y=\"45\">&#95;</text>\n</g>\n<path d=\"M464 41h20\"></path>\n</g>\n<path d=\"M484 41h10\"></path>\n<g>\n<path d=\"M494 41h0\"></path>\n<path d=\"M530 41h0\"></path>\n<rect x=\"494\" y=\"30\" width=\"36\" height=\"22\" rx=\"10\" ry=\"10\"></rect>\n<text x=\"512\" y=\"45\">rs</text>\n</g>\n<path d=\"M530 41h10\"></path>\n</g>\n<path d=\"M540 41h20\"></path>\n</g>\n<path d=\"M 560 41 h 20 m -10 -10 v 20 m 10 -20 v 20\"></path>\n</g>\n</svg>\n\n</div>\n<h1><code>dimension</code></h1>\n<div>\n<svg class=\"railroad-diagram\" width=\"513\" height=\"212\" viewBox=\"0 0 513 212\">\n<g transform=\"translate(.5 .5)\">\n<path d=\"M 20 21 v 20 m 10 -20 v 20 m -10 -10 h 20.5\"></path>\n<g>\n<path d=\"M40 31h0\"></path>\n<path d=\"M472 31h0\"></path>\n<path d=\"M40 31h20\"></path>\n<g>\n<path d=\"M60 31h148\"></path>\n<path d=\"M304 31h148\"></path>\n<path d=\"M208 31h10\"></path>\n<g>\n<path d=\"M218 31h0\"></path>\n<path d=\"M294 31h0\"></path>\n<rect x=\"218\" y=\"20\" width=\"76\" height=\"22\"></rect>\n<text x=\"256\" y=\"35\">integer</text>\n</g>\n<path d=\"M294 31h10\"></path>\n</g>\n<path d=\"M452 31h20\"></path>\n<path d=\"M40 31a10 10 0 0 1 10 10v20a10 10 0 0 0 10 10\"></path>\n<g>\n<path d=\"M60 71h82\"></path>\n<path d=\"M370 71h82\"></path>\n<path d=\"M142 71h10\"></path>\n<g>\n<path d=\"M152 71h0\"></path>\n<path d=\"M212 71h0\"></path>\n<rect x=\"152\" y=\"60\" width=\"60\" height=\"22\" rx=\"10\" ry=\"10\"></rect>\n<text x=\"182\" y=\"75\">comma</text>\n</g>\n<path d=\"M212 71h10\"></path>\n<g>\n<path d=\"M222 71h0\"></path>\n<path d=\"M290 71h0\"></path>\n<path d=\"M222 71a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10\"></path>\n<g>\n<path d=\"M242 51h28\"></path>\n</g>\n<path d=\"M270 51a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10\"></path>\n<path d=\"M222 71h20\"></path>\n<g>\n<path d=\"M242 71h0\"></path>\n<path d=\"M270 71h0\"></path>\n<rect x=\"242\" y=\"60\" width=\"28\" height=\"22\"></rect>\n<text x=\"256\" y=\"75\">&#95;</text>\n</g>\n<path d=\"M270 71h20\"></path>\n</g>\n<path d=\"M290 71h10\"></path>\n<g>\n<path d=\"M300 71h0\"></path>\n<path d=\"M360 71h0\"></path>\n<rect x=\"300\" y=\"60\" width=\"60\" height=\"22\"></rect>\n<text x=\"330\" y=\"75\">ratio</text>\n</g>\n<path d=\"M360 71h10\"></path>\n</g>\n<path d=\"M452 71a10 10 0 0 0 10 -10v-20a10 10 0 0 1 10 -10\"></path>\n<path d=\"M40 31a10 10 0 0 1 10 10v60a10 10 0 0 0 10 10\"></path>\n<g>\n<path d=\"M60 111h0\"></path>\n<path d=\"M452 111h0\"></path>\n<path d=\"M60 111h10\"></path>\n<g>\n<path d=\"M70 111h0\"></path>\n<path d=\"M146 111h0\"></path>\n<rect x=\"70\" y=\"100\" width=\"76\" height=\"22\"></rect>\n<text x=\"108\" y=\"115\">integer</text>\n</g>\n<path d=\"M146 111h10\"></path>\n<g>\n<path d=\"M156 111h0\"></path>\n<path d=\"M224 111h0\"></path>\n<path d=\"M156 111a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10\"></path>\n<g>\n<path d=\"M176 91h28\"></path>\n</g>\n<path d=\"M204 91a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10\"></path>\n<path d=\"M156 111h20\"></path>\n<g>\n<path d=\"M176 111h0\"></path>\n<path d=\"M204 111h0\"></path>\n<rect x=\"176\" y=\"100\" width=\"28\" height=\"22\"></rect>\n<text x=\"190\" y=\"115\">&#95;</text>\n</g>\n<path d=\"M204 111h20\"></path>\n</g>\n<path d=\"M224 111h10\"></path>\n<g>\n<path d=\"M234 111h0\"></path>\n<path d=\"M294 111h0\"></path>\n<rect x=\"234\" y=\"100\" width=\"60\" height=\"22\" rx=\"10\" ry=\"10\"></rect>\n<text x=\"264\" y=\"115\">comma</text>\n</g>\n<path d=\"M294 111h10\"></path>\n<g>\n<path d=\"M304 111h0\"></path>\n<path d=\"M372 111h0\"></path>\n<path d=\"M304 111a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10\"></path>\n<g>\n<path d=\"M324 91h28\"></path>\n</g>\n<path d=\"M352 91a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10\"></path>\n<path d=\"M304 111h20\"></path>\n<g>\n<path d=\"M324 111h0\"></path>\n<path d=\"M352 111h0\"></path>\n<rect x=\"324\" y=\"100\" width=\"28\" height=\"22\"></rect>\n<text x=\"338\" y=\"115\">&#95;</text>\n</g>\n<path d=\"M352 111h20\"></path>\n</g>\n<path d=\"M372 111h10\"></path>\n<g>\n<path d=\"M382 111h0\"></path>\n<path d=\"M442 111h0\"></path>\n<rect x=\"382\" y=\"100\" width=\"60\" height=\"22\"></rect>\n<text x=\"412\" y=\"115\">ratio</text>\n</g>\n<path d=\"M442 111h10\"></path>\n</g>\n<path d=\"M452 111a10 10 0 0 0 10 -10v-60a10 10 0 0 1 10 -10\"></path>\n<path d=\"M40 31a10 10 0 0 1 10 10v90a10 10 0 0 0 10 10\"></path>\n<g>\n<path d=\"M60 141h160\"></path>\n<path d=\"M292 141h160\"></path>\n<path d=\"M220 141h10\"></path>\n<g>\n<path d=\"M230 141h0\"></path>\n<path d=\"M282 141h0\"></path>\n<rect x=\"230\" y=\"130\" width=\"52\" height=\"22\" rx=\"10\" ry=\"10\"></rect>\n<text x=\"256\" y=\"145\">plus</text>\n</g>\n<path d=\"M282 141h10\"></path>\n</g>\n<path d=\"M452 141a10 10 0 0 0 10 -10v-90a10 10 0 0 1 10 -10\"></path>\n<path d=\"M40 31a10 10 0 0 1 10 10v130a10 10 0 0 0 10 10\"></path>\n<g>\n<path d=\"M60 181h12\"></path>\n<path d=\"M440 181h12\"></path>\n<path d=\"M72 181h10\"></path>\n<g>\n<path d=\"M82 181h0\"></path>\n<path d=\"M134 181h0\"></path>\n<rect x=\"82\" y=\"170\" width=\"52\" height=\"22\" rx=\"10\" ry=\"10\"></rect>\n<text x=\"108\" y=\"185\">plus</text>\n</g>\n<path d=\"M134 181h10\"></path>\n<g>\n<path d=\"M144 181h0\"></path>\n<path d=\"M212 181h0\"></path>\n<path d=\"M144 181a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10\"></path>\n<g>\n<path d=\"M164 161h28\"></path>\n</g>\n<path d=\"M192 161a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10\"></path>\n<path d=\"M144 181h20\"></path>\n<g>\n<path d=\"M164 181h0\"></path>\n<path d=\"M192 181h0\"></path>\n<rect x=\"164\" y=\"170\" width=\"28\" height=\"22\"></rect>\n<text x=\"178\" y=\"185\">&#95;</text>\n</g>\n<path d=\"M192 181h20\"></path>\n</g>\n<path d=\"M212 181h10\"></path>\n<g>\n<path d=\"M222 181h0\"></path>\n<path d=\"M282 181h0\"></path>\n<rect x=\"222\" y=\"170\" width=\"60\" height=\"22\" rx=\"10\" ry=\"10\"></rect>\n<text x=\"252\" y=\"185\">comma</text>\n</g>\n<path d=\"M282 181h10\"></path>\n<g>\n<path d=\"M292 181h0\"></path>\n<path d=\"M360 181h0\"></path>\n<path d=\"M292 181a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10\"></path>\n<g>\n<path d=\"M312 161h28\"></path>\n</g>\n<path d=\"M340 161a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10\"></path>\n<path d=\"M292 181h20\"></path>\n<g>\n<path d=\"M312 181h0\"></path>\n<path d=\"M340 181h0\"></path>\n<rect x=\"312\" y=\"170\" width=\"28\" height=\"22\"></rect>\n<text x=\"326\" y=\"185\">&#95;</text>\n</g>\n<path d=\"M340 181h20\"></path>\n</g>\n<path d=\"M360 181h10\"></path>\n<g>\n<path d=\"M370 181h0\"></path>\n<path d=\"M430 181h0\"></path>\n<rect x=\"370\" y=\"170\" width=\"60\" height=\"22\"></rect>\n<text x=\"400\" y=\"185\">ratio</text>\n</g>\n<path d=\"M430 181h10\"></path>\n</g>\n<path d=\"M452 181a10 10 0 0 0 10 -10v-130a10 10 0 0 1 10 -10\"></path>\n</g>\n<path d=\"M 472 31 h 20 m -10 -10 v 20 m 10 -20 v 20\"></path>\n</g>\n</svg>\n\n</div>\n<h1><code>subdivisions</code></h1>\n<div>\n<svg class=\"railroad-diagram\" width=\"693\" height=\"112\" viewBox=\"0 0 693 112\">\n<g transform=\"translate(.5 .5)\">\n<path d=\"M 20 31 v 20 m 10 -20 v 20 m -10 -10 h 20.5\"></path>\n<g>\n<path d=\"M40 41h0\"></path>\n<path d=\"M652 41h0\"></path>\n<path d=\"M40 41h20\"></path>\n<g>\n<path d=\"M60 41h82\"></path>\n<path d=\"M550 41h82\"></path>\n<path d=\"M142 41h10\"></path>\n<g>\n<path d=\"M152 41h0\"></path>\n<path d=\"M188 41h0\"></path>\n<rect x=\"152\" y=\"30\" width=\"36\" height=\"22\" rx=\"10\" ry=\"10\"></rect>\n<text x=\"170\" y=\"45\">lb</text>\n</g>\n<path d=\"M188 41h10\"></path>\n<g>\n<path d=\"M198 41h0\"></path>\n<path d=\"M426 41h0\"></path>\n<path d=\"M198 41a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10\"></path>\n<g>\n<path d=\"M218 21h188\"></path>\n</g>\n<path d=\"M406 21a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10\"></path>\n<path d=\"M198 41h20\"></path>\n<g>\n<path d=\"M218 41h0\"></path>\n<path d=\"M406 41h0\"></path>\n<rect x=\"218\" y=\"30\" width=\"188\" height=\"22\"></rect>\n<text x=\"312\" y=\"45\">ranged&#95;container&#95;list</text>\n</g>\n<path d=\"M406 41h20\"></path>\n</g>\n<g>\n<path d=\"M426 41h0\"></path>\n<path d=\"M494 41h0\"></path>\n<path d=\"M426 41a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10\"></path>\n<g>\n<path d=\"M446 21h28\"></path>\n</g>\n<path d=\"M474 21a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10\"></path>\n<path d=\"M426 41h20\"></path>\n<g>\n<path d=\"M446 41h0\"></path>\n<path d=\"M474 41h0\"></path>\n<rect x=\"446\" y=\"30\" width=\"28\" height=\"22\"></rect>\n<text x=\"460\" y=\"45\">&#95;</text>\n</g>\n<path d=\"M474 41h20\"></path>\n</g>\n<path d=\"M494 41h10\"></path>\n<g>\n<path d=\"M504 41h0\"></path>\n<path d=\"M540 41h0\"></path>\n<rect x=\"504\" y=\"30\" width=\"36\" height=\"22\" rx=\"10\" ry=\"10\"></rect>\n<text x=\"522\" y=\"45\">rb</text>\n</g>\n<path d=\"M540 41h10\"></path>\n</g>\n<path d=\"M632 41h20\"></path>\n<path d=\"M40 41a10 10 0 0 1 10 10v20a10 10 0 0 0 10 10\"></path>\n<g>\n<path d=\"M60 81h0\"></path>\n<path d=\"M632 81h0\"></path>\n<path d=\"M60 81h10\"></path>\n<g>\n<path d=\"M70 81h0\"></path>\n<path d=\"M106 81h0\"></path>\n<rect x=\"70\" y=\"70\" width=\"36\" height=\"22\" rx=\"10\" ry=\"10\"></rect>\n<text x=\"88\" y=\"85\">lb</text>\n</g>\n<path d=\"M106 81h10\"></path>\n<g>\n<path d=\"M116 81h0\"></path>\n<path d=\"M184 81h0\"></path>\n<path d=\"M116 81a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10\"></path>\n<g>\n<path d=\"M136 61h28\"></path>\n</g>\n<path d=\"M164 61a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10\"></path>\n<path d=\"M116 81h20\"></path>\n<g>\n<path d=\"M136 81h0\"></path>\n<path d=\"M164 81h0\"></path>\n<rect x=\"136\" y=\"70\" width=\"28\" height=\"22\"></rect>\n<text x=\"150\" y=\"85\">&#95;</text>\n</g>\n<path d=\"M164 81h20\"></path>\n</g>\n<path d=\"M184 81h10\"></path>\n<g>\n<path d=\"M194 81h0\"></path>\n<path d=\"M270 81h0\"></path>\n<rect x=\"194\" y=\"70\" width=\"76\" height=\"22\"></rect>\n<text x=\"232\" y=\"85\">integer</text>\n</g>\n<path d=\"M270 81h10\"></path>\n<g>\n<path d=\"M280 81h0\"></path>\n<path d=\"M508 81h0\"></path>\n<path d=\"M280 81a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10\"></path>\n<g>\n<path d=\"M300 61h188\"></path>\n</g>\n<path d=\"M488 61a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10\"></path>\n<path d=\"M280 81h20\"></path>\n<g>\n<path d=\"M300 81h0\"></path>\n<path d=\"M488 81h0\"></path>\n<rect x=\"300\" y=\"70\" width=\"188\" height=\"22\"></rect>\n<text x=\"394\" y=\"85\">ranged&#95;container&#95;list</text>\n</g>\n<path d=\"M488 81h20\"></path>\n</g>\n<g>\n<path d=\"M508 81h0\"></path>\n<path d=\"M576 81h0\"></path>\n<path d=\"M508 81a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10\"></path>\n<g>\n<path d=\"M528 61h28\"></path>\n</g>\n<path d=\"M556 61a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10\"></path>\n<path d=\"M508 81h20\"></path>\n<g>\n<path d=\"M528 81h0\"></path>\n<path d=\"M556 81h0\"></path>\n<rect x=\"528\" y=\"70\" width=\"28\" height=\"22\"></rect>\n<text x=\"542\" y=\"85\">&#95;</text>\n</g>\n<path d=\"M556 81h20\"></path>\n</g>\n<path d=\"M576 81h10\"></path>\n<g>\n<path d=\"M586 81h0\"></path>\n<path d=\"M622 81h0\"></path>\n<rect x=\"586\" y=\"70\" width=\"36\" height=\"22\" rx=\"10\" ry=\"10\"></rect>\n<text x=\"604\" y=\"85\">rb</text>\n</g>\n<path d=\"M622 81h10\"></path>\n</g>\n<path d=\"M632 81a10 10 0 0 0 10 -10v-20a10 10 0 0 1 10 -10\"></path>\n</g>\n<path d=\"M 652 41 h 20 m -10 -10 v 20 m 10 -20 v 20\"></path>\n</g>\n</svg>\n\n</div>\n<h1><code>ranged_container_list</code></h1>\n<div>\n<svg class=\"railroad-diagram\" width=\"685\" height=\"132\" viewBox=\"0 0 685 132\">\n<g transform=\"translate(.5 .5)\">\n<path d=\"M 20 21 v 20 m 10 -20 v 20 m -10 -10 h 20.5\"></path>\n<g>\n<path d=\"M40 31h0\"></path>\n<path d=\"M644 31h0\"></path>\n<path d=\"M40 31h20\"></path>\n<g>\n<path d=\"M60 31h198\"></path>\n<path d=\"M426 31h198\"></path>\n<path d=\"M258 31h10\"></path>\n<g>\n<path d=\"M268 31h0\"></path>\n<path d=\"M416 31h0\"></path>\n<rect x=\"268\" y=\"20\" width=\"148\" height=\"22\"></rect>\n<text x=\"342\" y=\"35\">ranged&#95;container</text>\n</g>\n<path d=\"M416 31h10\"></path>\n</g>\n<path d=\"M624 31h20\"></path>\n<path d=\"M40 31a10 10 0 0 1 10 10v10a10 10 0 0 0 10 10\"></path>\n<g>\n<path d=\"M60 61h94\"></path>\n<path d=\"M530 61h94\"></path>\n<path d=\"M154 61h10\"></path>\n<g>\n<path d=\"M164 61h0\"></path>\n<path d=\"M312 61h0\"></path>\n<rect x=\"164\" y=\"50\" width=\"148\" height=\"22\"></rect>\n<text x=\"238\" y=\"65\">ranged&#95;container</text>\n</g>\n<path d=\"M312 61h10\"></path>\n<path d=\"M322 61h10\"></path>\n<g>\n<path d=\"M332 61h0\"></path>\n<path d=\"M520 61h0\"></path>\n<rect x=\"332\" y=\"50\" width=\"188\" height=\"22\"></rect>\n<text x=\"426\" y=\"65\">ranged&#95;container&#95;list</text>\n</g>\n<path d=\"M520 61h10\"></path>\n</g>\n<path d=\"M624 61a10 10 0 0 0 10 -10v-10a10 10 0 0 1 10 -10\"></path>\n<path d=\"M40 31a10 10 0 0 1 10 10v50a10 10 0 0 0 10 10\"></path>\n<g>\n<path d=\"M60 101h0\"></path>\n<path d=\"M624 101h0\"></path>\n<path d=\"M60 101h10\"></path>\n<g>\n<path d=\"M70 101h0\"></path>\n<path d=\"M218 101h0\"></path>\n<rect x=\"70\" y=\"90\" width=\"148\" height=\"22\"></rect>\n<text x=\"144\" y=\"105\">ranged&#95;container</text>\n</g>\n<path d=\"M218 101h10\"></path>\n<g>\n<path d=\"M228 101h0\"></path>\n<path d=\"M296 101h0\"></path>\n<path d=\"M228 101a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10\"></path>\n<g>\n<path d=\"M248 81h28\"></path>\n</g>\n<path d=\"M276 81a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10\"></path>\n<path d=\"M228 101h20\"></path>\n<g>\n<path d=\"M248 101h0\"></path>\n<path d=\"M276 101h0\"></path>\n<rect x=\"248\" y=\"90\" width=\"28\" height=\"22\"></rect>\n<text x=\"262\" y=\"105\">&#95;</text>\n</g>\n<path d=\"M276 101h20\"></path>\n</g>\n<path d=\"M296 101h10\"></path>\n<g>\n<path d=\"M306 101h0\"></path>\n<path d=\"M406 101h0\"></path>\n<rect x=\"306\" y=\"90\" width=\"100\" height=\"22\" rx=\"10\" ry=\"10\"></rect>\n<text x=\"356\" y=\"105\">underscore</text>\n</g>\n<path d=\"M406 101h10\"></path>\n<path d=\"M416 101h10\"></path>\n<g>\n<path d=\"M426 101h0\"></path>\n<path d=\"M614 101h0\"></path>\n<rect x=\"426\" y=\"90\" width=\"188\" height=\"22\"></rect>\n<text x=\"520\" y=\"105\">ranged&#95;container&#95;list</text>\n</g>\n<path d=\"M614 101h10\"></path>\n</g>\n<path d=\"M624 101a10 10 0 0 0 10 -10v-50a10 10 0 0 1 10 -10\"></path>\n</g>\n<path d=\"M 644 31 h 20 m -10 -10 v 20 m 10 -20 v 20\"></path>\n</g>\n</svg>\n\n</div>\n<h1><code>ranged_container</code></h1>\n<div>\n<svg class=\"railroad-diagram\" width=\"513\" height=\"112\" viewBox=\"0 0 513 112\">\n<g transform=\"translate(.5 .5)\">\n<path d=\"M 20 31 v 20 m 10 -20 v 20 m -10 -10 h 20.5\"></path>\n<g>\n<path d=\"M40 41h0\"></path>\n<path d=\"M472 41h0\"></path>\n<path d=\"M40 41h20\"></path>\n<g>\n<path d=\"M60 41h0\"></path>\n<path d=\"M452 41h0\"></path>\n<g>\n<path d=\"M60 41h0\"></path>\n<path d=\"M128 41h0\"></path>\n<path d=\"M60 41a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10\"></path>\n<g>\n<path d=\"M80 21h28\"></path>\n</g>\n<path d=\"M108 21a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10\"></path>\n<path d=\"M60 41h20\"></path>\n<g>\n<path d=\"M80 41h0\"></path>\n<path d=\"M108 41h0\"></path>\n<rect x=\"80\" y=\"30\" width=\"28\" height=\"22\"></rect>\n<text x=\"94\" y=\"45\">&#95;</text>\n</g>\n<path d=\"M108 41h20\"></path>\n</g>\n<path d=\"M128 41h10\"></path>\n<g>\n<path d=\"M138 41h0\"></path>\n<path d=\"M198 41h0\"></path>\n<rect x=\"138\" y=\"30\" width=\"60\" height=\"22\"></rect>\n<text x=\"168\" y=\"45\">range</text>\n</g>\n<path d=\"M198 41h10\"></path>\n<g>\n<path d=\"M208 41h0\"></path>\n<path d=\"M276 41h0\"></path>\n<path d=\"M208 41a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10\"></path>\n<g>\n<path d=\"M228 21h28\"></path>\n</g>\n<path d=\"M256 21a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10\"></path>\n<path d=\"M208 41h20\"></path>\n<g>\n<path d=\"M228 41h0\"></path>\n<path d=\"M256 41h0\"></path>\n<rect x=\"228\" y=\"30\" width=\"28\" height=\"22\"></rect>\n<text x=\"242\" y=\"45\">&#95;</text>\n</g>\n<path d=\"M256 41h20\"></path>\n</g>\n<path d=\"M276 41h10\"></path>\n<g>\n<path d=\"M286 41h0\"></path>\n<path d=\"M442 41h0\"></path>\n<rect x=\"286\" y=\"30\" width=\"156\" height=\"22\"></rect>\n<text x=\"364\" y=\"45\">unsized&#95;container</text>\n</g>\n<path d=\"M442 41h10\"></path>\n</g>\n<path d=\"M452 41h20\"></path>\n<path d=\"M40 41a10 10 0 0 1 10 10v20a10 10 0 0 0 10 10\"></path>\n<g>\n<path d=\"M60 81h20\"></path>\n<path d=\"M432 81h20\"></path>\n<g>\n<path d=\"M80 81h0\"></path>\n<path d=\"M148 81h0\"></path>\n<path d=\"M80 81a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10\"></path>\n<g>\n<path d=\"M100 61h28\"></path>\n</g>\n<path d=\"M128 61a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10\"></path>\n<path d=\"M80 81h20\"></path>\n<g>\n<path d=\"M100 81h0\"></path>\n<path d=\"M128 81h0\"></path>\n<rect x=\"100\" y=\"70\" width=\"28\" height=\"22\"></rect>\n<text x=\"114\" y=\"85\">&#95;</text>\n</g>\n<path d=\"M128 81h20\"></path>\n</g>\n<path d=\"M148 81h10\"></path>\n<g>\n<path d=\"M158 81h0\"></path>\n<path d=\"M218 81h0\"></path>\n<rect x=\"158\" y=\"70\" width=\"60\" height=\"22\"></rect>\n<text x=\"188\" y=\"85\">range</text>\n</g>\n<path d=\"M218 81h10\"></path>\n<g>\n<path d=\"M228 81h0\"></path>\n<path d=\"M296 81h0\"></path>\n<path d=\"M228 81a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10\"></path>\n<g>\n<path d=\"M248 61h28\"></path>\n</g>\n<path d=\"M276 61a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10\"></path>\n<path d=\"M228 81h20\"></path>\n<g>\n<path d=\"M248 81h0\"></path>\n<path d=\"M276 81h0\"></path>\n<rect x=\"248\" y=\"70\" width=\"28\" height=\"22\"></rect>\n<text x=\"262\" y=\"85\">&#95;</text>\n</g>\n<path d=\"M276 81h20\"></path>\n</g>\n<path d=\"M296 81h10\"></path>\n<g>\n<path d=\"M306 81h0\"></path>\n<path d=\"M422 81h0\"></path>\n<rect x=\"306\" y=\"70\" width=\"116\" height=\"22\"></rect>\n<text x=\"364\" y=\"85\">subdivisions</text>\n</g>\n<path d=\"M422 81h10\"></path>\n</g>\n<path d=\"M452 81a10 10 0 0 0 10 -10v-20a10 10 0 0 1 10 -10\"></path>\n</g>\n<path d=\"M 472 41 h 20 m -10 -10 v 20 m 10 -20 v 20\"></path>\n</g>\n</svg>\n\n</div>\n<h1><code>range</code></h1>\n<div>\n<svg class=\"railroad-diagram\" width=\"777\" height=\"112\" viewBox=\"0 0 777 112\">\n<g transform=\"translate(.5 .5)\">\n<path d=\"M 20 31 v 20 m 10 -20 v 20 m -10 -10 h 20.5\"></path>\n<g>\n<path d=\"M40 41h0\"></path>\n<path d=\"M736 41h0\"></path>\n<path d=\"M40 41h20\"></path>\n<g>\n<path d=\"M60 41h156\"></path>\n<path d=\"M560 41h156\"></path>\n<path d=\"M216 41h10\"></path>\n<g>\n<path d=\"M226 41h0\"></path>\n<path d=\"M262 41h0\"></path>\n<rect x=\"226\" y=\"30\" width=\"36\" height=\"22\" rx=\"10\" ry=\"10\"></rect>\n<text x=\"244\" y=\"45\">lp</text>\n</g>\n<path d=\"M262 41h10\"></path>\n<g>\n<path d=\"M272 41h0\"></path>\n<path d=\"M340 41h0\"></path>\n<path d=\"M272 41a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10\"></path>\n<g>\n<path d=\"M292 21h28\"></path>\n</g>\n<path d=\"M320 21a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10\"></path>\n<path d=\"M272 41h20\"></path>\n<g>\n<path d=\"M292 41h0\"></path>\n<path d=\"M320 41h0\"></path>\n<rect x=\"292\" y=\"30\" width=\"28\" height=\"22\"></rect>\n<text x=\"306\" y=\"45\">&#95;</text>\n</g>\n<path d=\"M320 41h20\"></path>\n</g>\n<path d=\"M340 41h10\"></path>\n<g>\n<path d=\"M350 41h0\"></path>\n<path d=\"M426 41h0\"></path>\n<rect x=\"350\" y=\"30\" width=\"76\" height=\"22\"></rect>\n<text x=\"388\" y=\"45\">integer</text>\n</g>\n<path d=\"M426 41h10\"></path>\n<g>\n<path d=\"M436 41h0\"></path>\n<path d=\"M504 41h0\"></path>\n<path d=\"M436 41a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10\"></path>\n<g>\n<path d=\"M456 21h28\"></path>\n</g>\n<path d=\"M484 21a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10\"></path>\n<path d=\"M436 41h20\"></path>\n<g>\n<path d=\"M456 41h0\"></path>\n<path d=\"M484 41h0\"></path>\n<rect x=\"456\" y=\"30\" width=\"28\" height=\"22\"></rect>\n<text x=\"470\" y=\"45\">&#95;</text>\n</g>\n<path d=\"M484 41h20\"></path>\n</g>\n<path d=\"M504 41h10\"></path>\n<g>\n<path d=\"M514 41h0\"></path>\n<path d=\"M550 41h0\"></path>\n<rect x=\"514\" y=\"30\" width=\"36\" height=\"22\" rx=\"10\" ry=\"10\"></rect>\n<text x=\"532\" y=\"45\">rp</text>\n</g>\n<path d=\"M550 41h10\"></path>\n</g>\n<path d=\"M716 41h20\"></path>\n<path d=\"M40 41a10 10 0 0 1 10 10v20a10 10 0 0 0 10 10\"></path>\n<g>\n<path d=\"M60 81h0\"></path>\n<path d=\"M716 81h0\"></path>\n<path d=\"M60 81h10\"></path>\n<g>\n<path d=\"M70 81h0\"></path>\n<path d=\"M106 81h0\"></path>\n<rect x=\"70\" y=\"70\" width=\"36\" height=\"22\" rx=\"10\" ry=\"10\"></rect>\n<text x=\"88\" y=\"85\">lp</text>\n</g>\n<path d=\"M106 81h10\"></path>\n<g>\n<path d=\"M116 81h0\"></path>\n<path d=\"M184 81h0\"></path>\n<path d=\"M116 81a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10\"></path>\n<g>\n<path d=\"M136 61h28\"></path>\n</g>\n<path d=\"M164 61a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10\"></path>\n<path d=\"M116 81h20\"></path>\n<g>\n<path d=\"M136 81h0\"></path>\n<path d=\"M164 81h0\"></path>\n<rect x=\"136\" y=\"70\" width=\"28\" height=\"22\"></rect>\n<text x=\"150\" y=\"85\">&#95;</text>\n</g>\n<path d=\"M164 81h20\"></path>\n</g>\n<path d=\"M184 81h10\"></path>\n<g>\n<path d=\"M194 81h0\"></path>\n<path d=\"M270 81h0\"></path>\n<rect x=\"194\" y=\"70\" width=\"76\" height=\"22\"></rect>\n<text x=\"232\" y=\"85\">integer</text>\n</g>\n<path d=\"M270 81h10\"></path>\n<g>\n<path d=\"M280 81h0\"></path>\n<path d=\"M348 81h0\"></path>\n<path d=\"M280 81a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10\"></path>\n<g>\n<path d=\"M300 61h28\"></path>\n</g>\n<path d=\"M328 61a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10\"></path>\n<path d=\"M280 81h20\"></path>\n<g>\n<path d=\"M300 81h0\"></path>\n<path d=\"M328 81h0\"></path>\n<rect x=\"300\" y=\"70\" width=\"28\" height=\"22\"></rect>\n<text x=\"314\" y=\"85\">&#95;</text>\n</g>\n<path d=\"M328 81h20\"></path>\n</g>\n<path d=\"M348 81h10\"></path>\n<g>\n<path d=\"M358 81h0\"></path>\n<path d=\"M418 81h0\"></path>\n<rect x=\"358\" y=\"70\" width=\"60\" height=\"22\" rx=\"10\" ry=\"10\"></rect>\n<text x=\"388\" y=\"85\">comma</text>\n</g>\n<path d=\"M418 81h10\"></path>\n<g>\n<path d=\"M428 81h0\"></path>\n<path d=\"M496 81h0\"></path>\n<path d=\"M428 81a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10\"></path>\n<g>\n<path d=\"M448 61h28\"></path>\n</g>\n<path d=\"M476 61a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10\"></path>\n<path d=\"M428 81h20\"></path>\n<g>\n<path d=\"M448 81h0\"></path>\n<path d=\"M476 81h0\"></path>\n<rect x=\"448\" y=\"70\" width=\"28\" height=\"22\"></rect>\n<text x=\"462\" y=\"85\">&#95;</text>\n</g>\n<path d=\"M476 81h20\"></path>\n</g>\n<path d=\"M496 81h10\"></path>\n<g>\n<path d=\"M506 81h0\"></path>\n<path d=\"M582 81h0\"></path>\n<rect x=\"506\" y=\"70\" width=\"76\" height=\"22\"></rect>\n<text x=\"544\" y=\"85\">integer</text>\n</g>\n<path d=\"M582 81h10\"></path>\n<g>\n<path d=\"M592 81h0\"></path>\n<path d=\"M660 81h0\"></path>\n<path d=\"M592 81a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10\"></path>\n<g>\n<path d=\"M612 61h28\"></path>\n</g>\n<path d=\"M640 61a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10\"></path>\n<path d=\"M592 81h20\"></path>\n<g>\n<path d=\"M612 81h0\"></path>\n<path d=\"M640 81h0\"></path>\n<rect x=\"612\" y=\"70\" width=\"28\" height=\"22\"></rect>\n<text x=\"626\" y=\"85\">&#95;</text>\n</g>\n<path d=\"M640 81h20\"></path>\n</g>\n<path d=\"M660 81h10\"></path>\n<g>\n<path d=\"M670 81h0\"></path>\n<path d=\"M706 81h0\"></path>\n<rect x=\"670\" y=\"70\" width=\"36\" height=\"22\" rx=\"10\" ry=\"10\"></rect>\n<text x=\"688\" y=\"85\">rp</text>\n</g>\n<path d=\"M706 81h10\"></path>\n</g>\n<path d=\"M716 81a10 10 0 0 0 10 -10v-20a10 10 0 0 1 10 -10\"></path>\n</g>\n<path d=\"M 736 41 h 20 m -10 -10 v 20 m 10 -20 v 20\"></path>\n</g>\n</svg>\n\n</div>\n<h1><code>ratio</code></h1>\n<div>\n<svg class=\"railroad-diagram\" width=\"529\" height=\"102\" viewBox=\"0 0 529 102\">\n<g transform=\"translate(.5 .5)\">\n<path d=\"M 20 21 v 20 m 10 -20 v 20 m -10 -10 h 20.5\"></path>\n<g>\n<path d=\"M40 31h0\"></path>\n<path d=\"M488 31h0\"></path>\n<path d=\"M40 31h20\"></path>\n<g>\n<path d=\"M60 31h156\"></path>\n<path d=\"M312 31h156\"></path>\n<path d=\"M216 31h10\"></path>\n<g>\n<path d=\"M226 31h0\"></path>\n<path d=\"M302 31h0\"></path>\n<rect x=\"226\" y=\"20\" width=\"76\" height=\"22\"></rect>\n<text x=\"264\" y=\"35\">integer</text>\n</g>\n<path d=\"M302 31h10\"></path>\n</g>\n<path d=\"M468 31h20\"></path>\n<path d=\"M40 31a10 10 0 0 1 10 10v20a10 10 0 0 0 10 10\"></path>\n<g>\n<path d=\"M60 71h0\"></path>\n<path d=\"M468 71h0\"></path>\n<path d=\"M60 71h10\"></path>\n<g>\n<path d=\"M70 71h0\"></path>\n<path d=\"M146 71h0\"></path>\n<rect x=\"70\" y=\"60\" width=\"76\" height=\"22\"></rect>\n<text x=\"108\" y=\"75\">integer</text>\n</g>\n<path d=\"M146 71h10\"></path>\n<g>\n<path d=\"M156 71h0\"></path>\n<path d=\"M224 71h0\"></path>\n<path d=\"M156 71a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10\"></path>\n<g>\n<path d=\"M176 51h28\"></path>\n</g>\n<path d=\"M204 51a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10\"></path>\n<path d=\"M156 71h20\"></path>\n<g>\n<path d=\"M176 71h0\"></path>\n<path d=\"M204 71h0\"></path>\n<rect x=\"176\" y=\"60\" width=\"28\" height=\"22\"></rect>\n<text x=\"190\" y=\"75\">&#95;</text>\n</g>\n<path d=\"M204 71h20\"></path>\n</g>\n<path d=\"M224 71h10\"></path>\n<g>\n<path d=\"M234 71h0\"></path>\n<path d=\"M294 71h0\"></path>\n<rect x=\"234\" y=\"60\" width=\"60\" height=\"22\" rx=\"10\" ry=\"10\"></rect>\n<text x=\"264\" y=\"75\">slash</text>\n</g>\n<path d=\"M294 71h10\"></path>\n<g>\n<path d=\"M304 71h0\"></path>\n<path d=\"M372 71h0\"></path>\n<path d=\"M304 71a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10\"></path>\n<g>\n<path d=\"M324 51h28\"></path>\n</g>\n<path d=\"M352 51a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10\"></path>\n<path d=\"M304 71h20\"></path>\n<g>\n<path d=\"M324 71h0\"></path>\n<path d=\"M352 71h0\"></path>\n<rect x=\"324\" y=\"60\" width=\"28\" height=\"22\"></rect>\n<text x=\"338\" y=\"75\">&#95;</text>\n</g>\n<path d=\"M352 71h20\"></path>\n</g>\n<path d=\"M372 71h10\"></path>\n<g>\n<path d=\"M382 71h0\"></path>\n<path d=\"M458 71h0\"></path>\n<rect x=\"382\" y=\"60\" width=\"76\" height=\"22\"></rect>\n<text x=\"420\" y=\"75\">integer</text>\n</g>\n<path d=\"M458 71h10\"></path>\n</g>\n<path d=\"M468 71a10 10 0 0 0 10 -10v-20a10 10 0 0 1 10 -10\"></path>\n</g>\n<path d=\"M 488 31 h 20 m -10 -10 v 20 m 10 -20 v 20\"></path>\n</g>\n</svg>\n\n</div>\n<h1><code>integer</code></h1>\n<div>\n<svg class=\"railroad-diagram\" width=\"313\" height=\"62\" viewBox=\"0 0 313 62\">\n<g transform=\"translate(.5 .5)\">\n<path d=\"M 20 21 v 20 m 10 -20 v 20 m -10 -10 h 20.5\"></path>\n<g>\n<path d=\"M40 31h0\"></path>\n<path d=\"M272 31h0\"></path>\n<path d=\"M40 31h20\"></path>\n<g>\n<path d=\"M60 31h0\"></path>\n<path d=\"M252 31h0\"></path>\n<path d=\"M60 31h10\"></path>\n<g>\n<path d=\"M70 31h0\"></path>\n<path d=\"M242 31h0\"></path>\n<rect x=\"70\" y=\"20\" width=\"172\" height=\"22\" rx=\"10\" ry=\"10\"></rect>\n<text x=\"156\" y=\"35\">unsigned&#95;integer&#95;tk</text>\n</g>\n<path d=\"M242 31h10\"></path>\n</g>\n<path d=\"M252 31h20\"></path>\n</g>\n<path d=\"M 272 31 h 20 m -10 -10 v 20 m 10 -20 v 20\"></path>\n</g>\n</svg>\n\n</div>\n<h1><code>_</code></h1>\n<div>\n<svg class=\"railroad-diagram\" width=\"177\" height=\"62\" viewBox=\"0 0 177 62\">\n<g transform=\"translate(.5 .5)\">\n<path d=\"M 20 21 v 20 m 10 -20 v 20 m -10 -10 h 20.5\"></path>\n<g>\n<path d=\"M40 31h0\"></path>\n<path d=\"M136 31h0\"></path>\n<path d=\"M40 31h20\"></path>\n<g>\n<path d=\"M60 31h0\"></path>\n<path d=\"M116 31h0\"></path>\n<path d=\"M60 31h10\"></path>\n<g>\n<path d=\"M70 31h0\"></path>\n<path d=\"M106 31h0\"></path>\n<rect x=\"70\" y=\"20\" width=\"36\" height=\"22\" rx=\"10\" ry=\"10\"></rect>\n<text x=\"88\" y=\"35\">ws</text>\n</g>\n<path d=\"M106 31h10\"></path>\n</g>\n<path d=\"M116 31h20\"></path>\n</g>\n<path d=\"M 136 31 h 20 m -10 -10 v 20 m 10 -20 v 20\"></path>\n</g>\n</svg>\n\n</div>\n</body>\n</html>"
  },
  {
    "path": "index.js",
    "content": "const RhythmParser = require(\"./src/parser\");\nconst Container = require(\"./src/container\");\nconst Onset = require(\"./src/onset\");\nconst Interval = require(\"./src/interval\");\nconst Nestup = require(\"./src/nestup\");\nconst ParseError = require(\"./src/parseError\");\n\nmodule.exports = {\n\tContainer,\n\tInterval,\n\tOnset,\n\tNestup,\n\tParseError,\n\tRhythmParser,\n};\n"
  },
  {
    "path": "inputs/avg-test.rhy",
    "content": "[] {7\n    1:3 {5}\n    4:2 {5}\n    6 {2}\n}\n\n\n\n\n"
  },
  {
    "path": "inputs/complex.rhy",
    "content": "[4] {5\n\t1:4 {3}\n\t5 {4\n\t\t4 {2}\n\t}\n}\n"
  },
  {
    "path": "inputs/easy-empty.rhy",
    "content": "['4] {3\n  2\n}\n "
  },
  {
    "path": "inputs/easy-rest.rhy",
    "content": "[4] {3\n  2 [']\n}\n"
  },
  {
    "path": "inputs/easy.rhy",
    "content": "[4] {3}\n"
  },
  {
    "path": "inputs/four-with6.rhy",
    "content": "[] {4\n 3:2 {6}\n} "
  },
  {
    "path": "inputs/nested.rhy",
    "content": "[] {5\n\t1:4 {3\n\t\t1 {3\n\t\t\t2 {7}\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "package.json",
    "content": "{\n  \"name\": \"@cutelab/nestup\",\n  \"version\": \"0.5.11\",\n  \"description\": \"Parse a special hierarchical tuplet syntax, get a bunch of midi notes\",\n  \"main\": \"index.js\",\n  \"contributors\": [\n    \"Sam Tarakajian <starakajian@gmail.com>\",\n    \"Alex Van Gils <alexvangils@gmail.com>\"\n  ],\n  \"license\": \"MIT\",\n  \"private\": false,\n  \"dependencies\": {\n    \"chai\": \"^4.2.0\",\n    \"commander\": \"^6.1.0\",\n    \"fraction.js\": \"^4.0.12\",\n    \"memoizee\": \"^0.4.14\",\n    \"midi-writer-js\": \"^1.7.4\",\n    \"mocha\": \"^8.2.0\",\n    \"moo\": \"^0.5.1\",\n    \"nearley\": \"^2.19.6\"\n  },\n  \"scripts\": {\n    \"pretest\": \"yarn run build-grammar\",\n    \"prepublishOnly\": \"yarn run build\",\n    \"build\": \"yarn run build-grammar && yarn run build-pack\",\n    \"build-grammar\": \"mkdirp src/build && nearleyc grammar/grammar.ne --out ./src/build/grammar.js\",\n    \"build-pack\": \"webpack\",\n    \"start\": \"node cli.js\",\n    \"test\": \"mocha\",\n    \"test-grammar\": \"mocha -g Grammar\"\n  },\n  \"directories\": {\n    \"test\": \"test\"\n  },\n  \"devDependencies\": {\n    \"@babel/core\": \"^7.12.10\",\n    \"@babel/preset-env\": \"^7.12.11\",\n    \"babel-loader\": \"^8.2.2\",\n    \"babel-plugin-transform-class-properties\": \"^6.24.1\",\n    \"mkdirp\": \"^1.0.4\",\n    \"webpack\": \"^5.11.0\",\n    \"webpack-cli\": \"^4.2.0\"\n  },\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"git+https://github.com/cutelabnyc/nested-tuplets.git\"\n  },\n  \"author\": \"\",\n  \"bugs\": {\n    \"url\": \"https://github.com/cutelabnyc/nested-tuplets/issues\"\n  },\n  \"homepage\": \"https://github.com/cutelabnyc/nested-tuplets#readme\"\n}\n"
  },
  {
    "path": "src/build/grammar.js",
    "content": "// Generated automatically by nearley, version 2.19.6\n// http://github.com/Hardmath123/nearley\n(function () {\nfunction id(x) { return x[0]; }\n\nconst moo = require(\"moo\");\n\nconst lexer = moo.compile({\n  ws: { match: /\\s+/, lineBreaks: true },\n  unsigned_integer_tk: /[0-9]+/,\n  word: /[a-z]+/,\n  lp: /\\(/,\n  comma: /,/,\n  rp: /\\)/,\n  lb: /\\{/,\n  rb: /\\}/,\n  ls: /\\[/,\n  rs: /\\]/,\n  underscore: /_/,\n  colon: /:/,\n  prime: /'/,\n  gt: />/,\n  lt: /</,\n  comment: /\\/\\/.*?$/,\n  slash: /\\//,\n});\n\n\nconst Fraction = require(\"fraction.js\");\n\n\n// Beat ratio\nconst dbr = new Fraction(1);\n// Container size\nconst dpd = { length: 4, beatRatio: dbr };\nvar grammar = {\n    Lexer: lexer,\n    ParserRules: [\n    {\"name\": \"nestup$ebnf$1\", \"symbols\": []},\n    {\"name\": \"nestup$ebnf$1\", \"symbols\": [\"nestup$ebnf$1\", \"_\"], \"postprocess\": function arrpush(d) {return d[0].concat([d[1]]);}},\n    {\"name\": \"nestup\", \"symbols\": [\"nestup$ebnf$1\"], \"postprocess\": d => []},\n    {\"name\": \"nestup$ebnf$2\", \"symbols\": []},\n    {\"name\": \"nestup$ebnf$2\", \"symbols\": [\"nestup$ebnf$2\", \"_\"], \"postprocess\": function arrpush(d) {return d[0].concat([d[1]]);}},\n    {\"name\": \"nestup\", \"symbols\": [\"container_list_or_subdivisions\", \"nestup$ebnf$2\"], \"postprocess\": d => d[0]},\n    {\"name\": \"container_list_or_subdivisions$ebnf$1\", \"symbols\": []},\n    {\"name\": \"container_list_or_subdivisions$ebnf$1\", \"symbols\": [\"container_list_or_subdivisions$ebnf$1\", \"_\"], \"postprocess\": function arrpush(d) {return d[0].concat([d[1]]);}},\n    {\"name\": \"container_list_or_subdivisions\", \"symbols\": [\"container_list_or_subdivisions$ebnf$1\", \"subdivisions\"], \"postprocess\": d => { return [{ dimension: undefined, subdivisions: d[1] }] }},\n    {\"name\": \"container_list_or_subdivisions\", \"symbols\": [\"container_list\"], \"postprocess\": d => d[0]},\n    {\"name\": \"container_list\", \"symbols\": [\"container\"]},\n    {\"name\": \"container_list\", \"symbols\": [\"container\", \"container_list\"], \"postprocess\": d => { return [d[0]].concat(d[1]) }},\n    {\"name\": \"container_list$ebnf$1\", \"symbols\": []},\n    {\"name\": \"container_list$ebnf$1\", \"symbols\": [\"container_list$ebnf$1\", \"_\"], \"postprocess\": function arrpush(d) {return d[0].concat([d[1]]);}},\n    {\"name\": \"container_list\", \"symbols\": [\"container\", \"container_list$ebnf$1\", (lexer.has(\"underscore\") ? {type: \"underscore\"} : underscore), \"container_list\"], \"postprocess\": d => { d[0].tie = true; return [d[0]].concat(d[3]); }},\n    {\"name\": \"container$ebnf$1\", \"symbols\": []},\n    {\"name\": \"container$ebnf$1\", \"symbols\": [\"container$ebnf$1\", \"_\"], \"postprocess\": function arrpush(d) {return d[0].concat([d[1]]);}},\n    {\"name\": \"container\", \"symbols\": [\"container$ebnf$1\", \"sized_container\"], \"postprocess\": d => d[1]},\n    {\"name\": \"container$ebnf$2\", \"symbols\": []},\n    {\"name\": \"container$ebnf$2\", \"symbols\": [\"container$ebnf$2\", \"_\"], \"postprocess\": function arrpush(d) {return d[0].concat([d[1]]);}},\n    {\"name\": \"container\", \"symbols\": [\"container$ebnf$2\", \"unsized_container\"], \"postprocess\": d => d[1]},\n    {\"name\": \"sized_container\", \"symbols\": [\"sized_contents_with_subcontainers\"], \"postprocess\": d => d[0]},\n    {\"name\": \"sized_container$ebnf$1\", \"symbols\": []},\n    {\"name\": \"sized_container$ebnf$1\", \"symbols\": [\"sized_container$ebnf$1\", \"_\"], \"postprocess\": function arrpush(d) {return d[0].concat([d[1]]);}},\n    {\"name\": \"sized_container\", \"symbols\": [\"sized_contents\", \"sized_container$ebnf$1\", \"subdivisions\"], \"postprocess\": d => { return { dimension: d[0].dimension, empty: d[0].empty, subdivisions: d[2] }}},\n    {\"name\": \"sized_container\", \"symbols\": [\"sized_contents\"], \"postprocess\": d => d[0]},\n    {\"name\": \"unsized_container\", \"symbols\": [\"unsized_contents_with_subcontainers\"], \"postprocess\": d => d[0]},\n    {\"name\": \"unsized_container$ebnf$1\", \"symbols\": []},\n    {\"name\": \"unsized_container$ebnf$1\", \"symbols\": [\"unsized_container$ebnf$1\", \"_\"], \"postprocess\": function arrpush(d) {return d[0].concat([d[1]]);}},\n    {\"name\": \"unsized_container\", \"symbols\": [\"unsized_contents\", \"unsized_container$ebnf$1\", \"subdivisions\"], \"postprocess\": d => { return { dimension: d[0].dimension, empty: d[0].empty, subdivisions: d[2] }}},\n    {\"name\": \"unsized_container\", \"symbols\": [\"unsized_contents\"], \"postprocess\": d => d[0]},\n    {\"name\": \"sized_contents$ebnf$1\", \"symbols\": []},\n    {\"name\": \"sized_contents$ebnf$1\", \"symbols\": [\"sized_contents$ebnf$1\", \"_\"], \"postprocess\": function arrpush(d) {return d[0].concat([d[1]]);}},\n    {\"name\": \"sized_contents$ebnf$2\", \"symbols\": []},\n    {\"name\": \"sized_contents$ebnf$2\", \"symbols\": [\"sized_contents$ebnf$2\", \"_\"], \"postprocess\": function arrpush(d) {return d[0].concat([d[1]]);}},\n    {\"name\": \"sized_contents\", \"symbols\": [(lexer.has(\"ls\") ? {type: \"ls\"} : ls), \"sized_contents$ebnf$1\", \"dimension\", \"sized_contents$ebnf$2\", (lexer.has(\"rs\") ? {type: \"rs\"} : rs)], \"postprocess\": d => { return { dimension: d[2] }}},\n    {\"name\": \"sized_contents$ebnf$3\", \"symbols\": []},\n    {\"name\": \"sized_contents$ebnf$3\", \"symbols\": [\"sized_contents$ebnf$3\", \"_\"], \"postprocess\": function arrpush(d) {return d[0].concat([d[1]]);}},\n    {\"name\": \"sized_contents$ebnf$4\", \"symbols\": []},\n    {\"name\": \"sized_contents$ebnf$4\", \"symbols\": [\"sized_contents$ebnf$4\", \"_\"], \"postprocess\": function arrpush(d) {return d[0].concat([d[1]]);}},\n    {\"name\": \"sized_contents$ebnf$5\", \"symbols\": []},\n    {\"name\": \"sized_contents$ebnf$5\", \"symbols\": [\"sized_contents$ebnf$5\", \"_\"], \"postprocess\": function arrpush(d) {return d[0].concat([d[1]]);}},\n    {\"name\": \"sized_contents\", \"symbols\": [(lexer.has(\"ls\") ? {type: \"ls\"} : ls), \"sized_contents$ebnf$3\", (lexer.has(\"prime\") ? {type: \"prime\"} : prime), \"sized_contents$ebnf$4\", \"dimension\", \"sized_contents$ebnf$5\", (lexer.has(\"rs\") ? {type: \"rs\"} : rs)], \"postprocess\": d => { return { dimension: d[4], empty: true }}},\n    {\"name\": \"sized_contents_with_subcontainers$ebnf$1\", \"symbols\": []},\n    {\"name\": \"sized_contents_with_subcontainers$ebnf$1\", \"symbols\": [\"sized_contents_with_subcontainers$ebnf$1\", \"_\"], \"postprocess\": function arrpush(d) {return d[0].concat([d[1]]);}},\n    {\"name\": \"sized_contents_with_subcontainers$ebnf$2\", \"symbols\": []},\n    {\"name\": \"sized_contents_with_subcontainers$ebnf$2\", \"symbols\": [\"sized_contents_with_subcontainers$ebnf$2\", \"_\"], \"postprocess\": function arrpush(d) {return d[0].concat([d[1]]);}},\n    {\"name\": \"sized_contents_with_subcontainers\", \"symbols\": [(lexer.has(\"ls\") ? {type: \"ls\"} : ls), \"sized_contents_with_subcontainers$ebnf$1\", \"dimension\", \"container_list_or_subdivisions\", \"sized_contents_with_subcontainers$ebnf$2\", (lexer.has(\"rs\") ? {type: \"rs\"} : rs)], \"postprocess\": d => { return { dimension: d[2], contents: d[3] }}},\n    {\"name\": \"unsized_contents$ebnf$1\", \"symbols\": []},\n    {\"name\": \"unsized_contents$ebnf$1\", \"symbols\": [\"unsized_contents$ebnf$1\", \"_\"], \"postprocess\": function arrpush(d) {return d[0].concat([d[1]]);}},\n    {\"name\": \"unsized_contents\", \"symbols\": [(lexer.has(\"ls\") ? {type: \"ls\"} : ls), \"unsized_contents$ebnf$1\", (lexer.has(\"rs\") ? {type: \"rs\"} : rs)], \"postprocess\": d => { return { dimension: undefined, subdivisions: {division: 1} }}},\n    {\"name\": \"unsized_contents$ebnf$2\", \"symbols\": []},\n    {\"name\": \"unsized_contents$ebnf$2\", \"symbols\": [\"unsized_contents$ebnf$2\", \"_\"], \"postprocess\": function arrpush(d) {return d[0].concat([d[1]]);}},\n    {\"name\": \"unsized_contents$ebnf$3\", \"symbols\": []},\n    {\"name\": \"unsized_contents$ebnf$3\", \"symbols\": [\"unsized_contents$ebnf$3\", \"_\"], \"postprocess\": function arrpush(d) {return d[0].concat([d[1]]);}},\n    {\"name\": \"unsized_contents\", \"symbols\": [(lexer.has(\"ls\") ? {type: \"ls\"} : ls), \"unsized_contents$ebnf$2\", (lexer.has(\"prime\") ? {type: \"prime\"} : prime), \"unsized_contents$ebnf$3\", (lexer.has(\"rs\") ? {type: \"rs\"} : rs)], \"postprocess\": d => { return { dimension: undefined, empty: true, subdivisions: {division: 1} }}},\n    {\"name\": \"unsized_contents_with_subcontainers$ebnf$1\", \"symbols\": []},\n    {\"name\": \"unsized_contents_with_subcontainers$ebnf$1\", \"symbols\": [\"unsized_contents_with_subcontainers$ebnf$1\", \"_\"], \"postprocess\": function arrpush(d) {return d[0].concat([d[1]]);}},\n    {\"name\": \"unsized_contents_with_subcontainers\", \"symbols\": [(lexer.has(\"ls\") ? {type: \"ls\"} : ls), \"container_list_or_subdivisions\", \"unsized_contents_with_subcontainers$ebnf$1\", (lexer.has(\"rs\") ? {type: \"rs\"} : rs)], \"postprocess\": d => { return { dimension: { proportionality: \"+\", scale: 1 }, contents: d[1] }}},\n    {\"name\": \"dimension\", \"symbols\": [\"integer\"], \"postprocess\": d => { return { proportionality: d[0], scale: new Fraction(1) }}},\n    {\"name\": \"dimension$ebnf$1\", \"symbols\": []},\n    {\"name\": \"dimension$ebnf$1\", \"symbols\": [\"dimension$ebnf$1\", \"_\"], \"postprocess\": function arrpush(d) {return d[0].concat([d[1]]);}},\n    {\"name\": \"dimension\", \"symbols\": [(lexer.has(\"comma\") ? {type: \"comma\"} : comma), \"dimension$ebnf$1\", \"ratio\"], \"postprocess\": d => { return { proportionality: \"+\", scale: d[2] }}},\n    {\"name\": \"dimension$ebnf$2\", \"symbols\": []},\n    {\"name\": \"dimension$ebnf$2\", \"symbols\": [\"dimension$ebnf$2\", \"_\"], \"postprocess\": function arrpush(d) {return d[0].concat([d[1]]);}},\n    {\"name\": \"dimension$ebnf$3\", \"symbols\": []},\n    {\"name\": \"dimension$ebnf$3\", \"symbols\": [\"dimension$ebnf$3\", \"_\"], \"postprocess\": function arrpush(d) {return d[0].concat([d[1]]);}},\n    {\"name\": \"dimension\", \"symbols\": [\"integer\", \"dimension$ebnf$2\", (lexer.has(\"comma\") ? {type: \"comma\"} : comma), \"dimension$ebnf$3\", \"ratio\"], \"postprocess\": d => { return { proportionality: d[0], scale: d[4] }}},\n    {\"name\": \"subdivisions$ebnf$1\", \"symbols\": []},\n    {\"name\": \"subdivisions$ebnf$1\", \"symbols\": [\"subdivisions$ebnf$1\", \"_\"], \"postprocess\": function arrpush(d) {return d[0].concat([d[1]]);}},\n    {\"name\": \"subdivisions$ebnf$2\", \"symbols\": [\"ranged_container_list\"], \"postprocess\": id},\n    {\"name\": \"subdivisions$ebnf$2\", \"symbols\": [], \"postprocess\": function(d) {return null;}},\n    {\"name\": \"subdivisions$ebnf$3\", \"symbols\": []},\n    {\"name\": \"subdivisions$ebnf$3\", \"symbols\": [\"subdivisions$ebnf$3\", \"_\"], \"postprocess\": function arrpush(d) {return d[0].concat([d[1]]);}},\n    {\"name\": \"subdivisions\", \"symbols\": [(lexer.has(\"lb\") ? {type: \"lb\"} : lb), \"subdivisions$ebnf$1\", \"integer\", \"subdivisions$ebnf$2\", \"subdivisions$ebnf$3\", (lexer.has(\"rb\") ? {type: \"rb\"} : rb)], \"postprocess\": d => {return { division: d[2], ranges: d[3] }}},\n    {\"name\": \"subdivisions$ebnf$4\", \"symbols\": []},\n    {\"name\": \"subdivisions$ebnf$4\", \"symbols\": [\"subdivisions$ebnf$4\", \"_\"], \"postprocess\": function arrpush(d) {return d[0].concat([d[1]]);}},\n    {\"name\": \"subdivisions$ebnf$5\", \"symbols\": [\"ranged_container_list\"], \"postprocess\": id},\n    {\"name\": \"subdivisions$ebnf$5\", \"symbols\": [], \"postprocess\": function(d) {return null;}},\n    {\"name\": \"subdivisions$ebnf$6\", \"symbols\": []},\n    {\"name\": \"subdivisions$ebnf$6\", \"symbols\": [\"subdivisions$ebnf$6\", \"_\"], \"postprocess\": function arrpush(d) {return d[0].concat([d[1]]);}},\n    {\"name\": \"subdivisions\", \"symbols\": [(lexer.has(\"lb\") ? {type: \"lb\"} : lb), \"subdivisions$ebnf$4\", \"rotation\", \"subdivisions$ebnf$5\", \"subdivisions$ebnf$6\", (lexer.has(\"rb\") ? {type: \"rb\"} : rb)], \"postprocess\": d => {return { division: 1, rotation: d[2], ranges: d[3] }}},\n    {\"name\": \"subdivisions$ebnf$7\", \"symbols\": []},\n    {\"name\": \"subdivisions$ebnf$7\", \"symbols\": [\"subdivisions$ebnf$7\", \"_\"], \"postprocess\": function arrpush(d) {return d[0].concat([d[1]]);}},\n    {\"name\": \"subdivisions$ebnf$8\", \"symbols\": []},\n    {\"name\": \"subdivisions$ebnf$8\", \"symbols\": [\"subdivisions$ebnf$8\", \"_\"], \"postprocess\": function arrpush(d) {return d[0].concat([d[1]]);}},\n    {\"name\": \"subdivisions$ebnf$9\", \"symbols\": [\"ranged_container_list\"], \"postprocess\": id},\n    {\"name\": \"subdivisions$ebnf$9\", \"symbols\": [], \"postprocess\": function(d) {return null;}},\n    {\"name\": \"subdivisions$ebnf$10\", \"symbols\": []},\n    {\"name\": \"subdivisions$ebnf$10\", \"symbols\": [\"subdivisions$ebnf$10\", \"_\"], \"postprocess\": function arrpush(d) {return d[0].concat([d[1]]);}},\n    {\"name\": \"subdivisions\", \"symbols\": [(lexer.has(\"lb\") ? {type: \"lb\"} : lb), \"subdivisions$ebnf$7\", \"integer\", \"subdivisions$ebnf$8\", \"rotation\", \"subdivisions$ebnf$9\", \"subdivisions$ebnf$10\", (lexer.has(\"rb\") ? {type: \"rb\"} : rb)], \"postprocess\": d => {return { division: d[2], rotation: d[4], ranges: d[5] }}},\n    {\"name\": \"rotation$ebnf$1\", \"symbols\": []},\n    {\"name\": \"rotation$ebnf$1\", \"symbols\": [\"rotation$ebnf$1\", \"_\"], \"postprocess\": function arrpush(d) {return d[0].concat([d[1]]);}},\n    {\"name\": \"rotation\", \"symbols\": [(lexer.has(\"lt\") ? {type: \"lt\"} : lt), \"rotation$ebnf$1\", \"ratio\"], \"postprocess\": d => d[2].mul(-1)},\n    {\"name\": \"rotation$ebnf$2\", \"symbols\": []},\n    {\"name\": \"rotation$ebnf$2\", \"symbols\": [\"rotation$ebnf$2\", \"_\"], \"postprocess\": function arrpush(d) {return d[0].concat([d[1]]);}},\n    {\"name\": \"rotation\", \"symbols\": [(lexer.has(\"gt\") ? {type: \"gt\"} : gt), \"rotation$ebnf$2\", \"ratio\"], \"postprocess\": d => d[2]},\n    {\"name\": \"ranged_container_list\", \"symbols\": [\"ranged_container\"], \"postprocess\": d => [d[0]]},\n    {\"name\": \"ranged_container_list\", \"symbols\": [\"ranged_container\", \"ranged_container_list\"], \"postprocess\": d => [d[0]].concat(d[1])},\n    {\"name\": \"ranged_container_list$ebnf$1\", \"symbols\": []},\n    {\"name\": \"ranged_container_list$ebnf$1\", \"symbols\": [\"ranged_container_list$ebnf$1\", \"_\"], \"postprocess\": function arrpush(d) {return d[0].concat([d[1]]);}},\n    {\"name\": \"ranged_container_list\", \"symbols\": [\"ranged_container\", \"ranged_container_list$ebnf$1\", (lexer.has(\"underscore\") ? {type: \"underscore\"} : underscore), \"ranged_container_list\"], \"postprocess\": d => { d[0].container.tie = true; return [d[0]].concat(d[3]); }},\n    {\"name\": \"ranged_container$ebnf$1\", \"symbols\": []},\n    {\"name\": \"ranged_container$ebnf$1\", \"symbols\": [\"ranged_container$ebnf$1\", \"_\"], \"postprocess\": function arrpush(d) {return d[0].concat([d[1]]);}},\n    {\"name\": \"ranged_container$ebnf$2\", \"symbols\": []},\n    {\"name\": \"ranged_container$ebnf$2\", \"symbols\": [\"ranged_container$ebnf$2\", \"_\"], \"postprocess\": function arrpush(d) {return d[0].concat([d[1]]);}},\n    {\"name\": \"ranged_container\", \"symbols\": [\"ranged_container$ebnf$1\", \"range\", \"ranged_container$ebnf$2\", \"unsized_container\"], \"postprocess\": d => {return { range: d[1], container: d[3] }}},\n    {\"name\": \"ranged_container$ebnf$3\", \"symbols\": []},\n    {\"name\": \"ranged_container$ebnf$3\", \"symbols\": [\"ranged_container$ebnf$3\", \"_\"], \"postprocess\": function arrpush(d) {return d[0].concat([d[1]]);}},\n    {\"name\": \"ranged_container$ebnf$4\", \"symbols\": []},\n    {\"name\": \"ranged_container$ebnf$4\", \"symbols\": [\"ranged_container$ebnf$4\", \"_\"], \"postprocess\": function arrpush(d) {return d[0].concat([d[1]]);}},\n    {\"name\": \"ranged_container\", \"symbols\": [\"ranged_container$ebnf$3\", \"range\", \"ranged_container$ebnf$4\", \"subdivisions\"], \"postprocess\": d => {return { range: d[1], container: { dimension: undefined, subdivisions: d[3] } }}},\n    {\"name\": \"ranged_container$ebnf$5\", \"symbols\": []},\n    {\"name\": \"ranged_container$ebnf$5\", \"symbols\": [\"ranged_container$ebnf$5\", \"_\"], \"postprocess\": function arrpush(d) {return d[0].concat([d[1]]);}},\n    {\"name\": \"ranged_container\", \"symbols\": [\"ranged_container$ebnf$5\", \"range\"], \"postprocess\": d => {return { range: d[1], container: { dimension: undefined, subdivisions: {division: 1} } }}},\n    {\"name\": \"range\", \"symbols\": [\"integer\"], \"postprocess\": d => {return { index: d[0], length: 1 }}},\n    {\"name\": \"range$ebnf$1\", \"symbols\": []},\n    {\"name\": \"range$ebnf$1\", \"symbols\": [\"range$ebnf$1\", \"_\"], \"postprocess\": function arrpush(d) {return d[0].concat([d[1]]);}},\n    {\"name\": \"range$ebnf$2\", \"symbols\": []},\n    {\"name\": \"range$ebnf$2\", \"symbols\": [\"range$ebnf$2\", \"_\"], \"postprocess\": function arrpush(d) {return d[0].concat([d[1]]);}},\n    {\"name\": \"range\", \"symbols\": [\"integer\", \"range$ebnf$1\", (lexer.has(\"colon\") ? {type: \"colon\"} : colon), \"range$ebnf$2\", \"integer\"], \"postprocess\": d => {return { index: d[0], length: d[4] }}},\n    {\"name\": \"ratio\", \"symbols\": [\"integer\"], \"postprocess\": d => new Fraction(d[0])},\n    {\"name\": \"ratio$ebnf$1\", \"symbols\": []},\n    {\"name\": \"ratio$ebnf$1\", \"symbols\": [\"ratio$ebnf$1\", \"_\"], \"postprocess\": function arrpush(d) {return d[0].concat([d[1]]);}},\n    {\"name\": \"ratio$ebnf$2\", \"symbols\": []},\n    {\"name\": \"ratio$ebnf$2\", \"symbols\": [\"ratio$ebnf$2\", \"_\"], \"postprocess\": function arrpush(d) {return d[0].concat([d[1]]);}},\n    {\"name\": \"ratio\", \"symbols\": [\"integer\", \"ratio$ebnf$1\", (lexer.has(\"slash\") ? {type: \"slash\"} : slash), \"ratio$ebnf$2\", \"integer\"], \"postprocess\": d => new Fraction(d[0], d[4])},\n    {\"name\": \"integer\", \"symbols\": [(lexer.has(\"unsigned_integer_tk\") ? {type: \"unsigned_integer_tk\"} : unsigned_integer_tk)], \"postprocess\": d => parseInt(d.join(\"\"))},\n    {\"name\": \"_\", \"symbols\": [(lexer.has(\"ws\") ? {type: \"ws\"} : ws)], \"postprocess\": d => { return null; }},\n    {\"name\": \"_\", \"symbols\": [(lexer.has(\"comment\") ? {type: \"comment\"} : comment)], \"postprocess\": d => { return null; }}\n]\n  , ParserStart: \"nestup\"\n}\nif (typeof module !== 'undefined'&& typeof module.exports !== 'undefined') {\n   module.exports = grammar;\n} else {\n   window.grammar = grammar;\n}\n})();\n"
  },
  {
    "path": "src/container.js",
    "content": "const Interval = require(\"./interval\");\nconst Onset = require(\"./onset\");\nconst Fraction = require(\"fraction.js\");\n\nmodule.exports = class Container {\n\tconstructor(containerDescription, index) {\n\n\t\t// Set internal proportionality and scale\n\t\tif (containerDescription.dimension) {\n\t\t\tconst dim = containerDescription.dimension;\n\t\t\tif (dim.proportionality === \"+\") {\n\t\t\t\tthis._proportionality = dim.proportionality;\n\t\t\t} else {\n\t\t\t\tthis._proportionality = dim.proportionality ? new Fraction(dim.proportionality) : new Fraction(1);\n\t\t\t}\n\t\t\tthis._scale = dim.scale ? dim.scale : new Fraction(1);\n\t\t} else {\n\t\t\tthis._proportionality = new Fraction(1);\n\t\t\tthis._scale = new Fraction(1);\n\t\t}\n\n\t\tif (containerDescription.contents) {\n\t\t\tthis._contents = containerDescription.contents.map((c, idx) => new Container(c, idx + 1));\n\t\t} else if (containerDescription.subdivisions){\n\t\t\tthis._division = containerDescription.subdivisions.division;\n\t\t\tthis._rotation = containerDescription.subdivisions.rotation;\n\t\t\tif (containerDescription.subdivisions.ranges) {\n\t\t\t\tthis._ranges = containerDescription.subdivisions.ranges.map(({range, container}, idx) => {\n\t\t\t\t\treturn {\n\t\t\t\t\t\trange: new Interval(range.index, range.length),\n\t\t\t\t\t\tcontainer: new Container(container, idx + 1)\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tthis._ranges = [];\n\t\t\t}\n\t\t} else {\n\t\t\tthis._division = 1;\n\t\t\tthis._ranges = [];\n\t\t}\n\n\t\tthis._index = index;\n\t\tthis._tie = !!containerDescription.tie;\n\t\tthis._empty = !!containerDescription.empty;\n\t}\n\n\tget proportionality() {\n\t\tif (this._proportionality === \"+\") {\n\t\t\tif (this._contents) {\n\t\t\t\treturn this._contents.reduce((prev, c) => { return prev.add(c.proportionality) }, new Fraction(0)).mul(this._scale);\n\t\t\t} else {\n\t\t\t\treturn this._scale;\n\t\t\t}\n\t\t} else {\n\t\t\treturn this._proportionality.mul(this._scale);\n\t\t}\n\t}\n\n\tget scale() {\n\t\treturn this._scale;\n\t}\n\n\tget tie() {\n\t\treturn this._tie;\n\t}\n\n\tnormalizedOnsets() {\n\t\tlet out = [];\n\n\t\t// Special case: if the division is one, we encode a rest.\n\t\tif (this._empty || this._division === 0) {\n\t\t\tout.push(new Onset(\n\t\t\t\tnew Fraction(0),\n\t\t\t\tOnset.type.OFF,\n\t\t\t\t(this._index !== undefined) ? `${this._index}` : undefined\n\t\t\t));\n\n\t\t\tif (this._division === 0) return out;\n\t\t}\n\n\t\tif (this._contents) {\n\t\t\tlet runningP = new Fraction(0);\n\t\t\tconst totalP = this._contents.reduce((prev, c) => prev.add(c.proportionality), new Fraction(0));\n\t\t\tlet lastContainerTied = false;\n\t\t\tthis._contents.forEach(c => {\n\t\t\t\tconst onsets = c.normalizedOnsets();\n\t\t\t\tif (c.tie) onsets.pop(); // Get rid of the last note off event\n\t\t\t\tconst scale = c.proportionality.div(totalP);\n\t\t\t\tonsets.forEach(o => {\n\t\t\t\t\tif (lastContainerTied && o.type === Onset.type.ON) {\n\t\t\t\t\t\tlastContainerTied = false;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tout.push(new Onset(\n\t\t\t\t\t\t\to.time.mul(scale).add(runningP),\n\t\t\t\t\t\t\to.type,\n\t\t\t\t\t\t\t(this._index !== undefined) ? `${this._index}${o.path}` : undefined\n\t\t\t\t\t\t));\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\trunningP = runningP.add(scale);\n\t\t\t\tlastContainerTied = c.tie;\n\t\t\t});\n\t\t} else {\n\n\t\t\t// Add an onset for each position that doesn't intersect a subtuplet\n\t\t\tif (!this._empty) {\n\t\t\t\tfor (let i = 0; i < this._division; i++) {\n\t\t\t\t\tlet intersector = this._ranges.findIndex(({ range }) => range.intersects(i + 1));\n\t\t\t\t\tif (intersector === -1)\n\t\t\t\t\t\tout.push(new Onset(\n\t\t\t\t\t\t\tnew Fraction(i, this._division),\n\t\t\t\t\t\t\tOnset.type.ON,\n\t\t\t\t\t\t\tthis._index ? `${this._index}` : undefined\n\t\t\t\t\t\t));\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Add onsets from all the other subtuplets\n\t\t\tlet lastContainerTied = false;\n\t\t\tthis._ranges.forEach(({range, container: st}) => {\n\t\t\t\tconst {index, length} = range;\n\t\t\t\tlet offset = new Fraction((index - 1), this._division);\n\t\t\t\tlet scale = new Fraction(length, this._division);\n\t\t\t\tlet onsets = st.normalizedOnsets();\n\t\t\t\tif (st.tie) onsets.pop(); // Get rid of the last note off event\n\t\t\t\tonsets.forEach(onset => {\n\t\t\t\t\tif (lastContainerTied && onset.type === Onset.type.ON) {\n\t\t\t\t\t\tlastContainerTied = false\n\t\t\t\t\t} else {\n\t\t\t\t\t\tout.push(new Onset(\n\t\t\t\t\t\t\tonset.time.mul(scale).add(offset),\n\t\t\t\t\t\t\tonset.type,\n\t\t\t\t\t\t\t(this._index !== undefined) ? `${this._index}${onset.path}` : undefined\n\t\t\t\t\t\t));\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\tlastContainerTied = st.tie;\n\t\t\t});\n\n\t\t\t// sort\n\t\t\tout = out.sort((oa, ob) => {\n\t\t\t\treturn oa.time.compare(ob.time);\n\t\t\t});\n\t\t}\n\n\t\t// Rotate the onsets if there is a rotation\n\t\tif (!!this._rotation) {\n\t\t\tlet normalizedRotation = this._rotation;\n\t\t\tif (normalizedRotation.compare(0) < 0) {\n\t\t\t\tnormalizedRotation = normalizedRotation.mod(this._division).add(this._division).mod(this._division);\n\t\t\t} else {\n\t\t\t\tnormalizedRotation = normalizedRotation.mod(this._division);\n\t\t\t}\n\t\t\tnormalizedRotation = normalizedRotation.mul(new Fraction(1, this._division));\n\n\t\t\tout.forEach(o => {\n\t\t\t\to._time = o._time.add(normalizedRotation).mod(1);\n\t\t\t});\n\n\t\t\t// sort\n\t\t\tout = out.sort((oa, ob) => {\n\t\t\t\treturn oa.time.compare(ob.time);\n\t\t\t});\n\t\t}\n\n\t\t// Add an off event at the end, if there are any on events\n\t\tif (out.findIndex(o => o.type === Onset.type.ON) !== -1) {\n\t\t\tout.push(new Onset(\n\t\t\t\tnew Fraction(1.0),\n\t\t\t\tOnset.type.OFF,\n\t\t\t\tthis._index ? `${this._index}` : undefined\n\t\t\t));\n\t\t}\n\n\t\t// Filter duplicates\n\t\tlet i = 0;\n\t\twhile (i < out.length) {\n\t\t\tif (i >= (out.length - 1))\n\t\t\t\tbreak;\n\t\t\tif (out[i].time.equals(out[i + 1].time)) {\n\t\t\t\tif (out[i].type === Onset.type.OFF && out[i + 1].type === Onset.type.ON) {\n\t\t\t\t\tout.splice(i, 1);\n\t\t\t\t} else if (out[i].type === Onset.type.ON && out[i + 1].type === Onset.type.OFF) {\n\t\t\t\t\tout.splice(i + 1, 1);\n\t\t\t\t} else {\n\t\t\t\t\tif (out[i].path && out[i + 1].path && out[i].path.length > out[i + 1].path.length) {\n\t\t\t\t\t\tout.splice(i + 1, 1);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tout.splice(i, 1);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\ti++;\n\t\t\t}\n\t\t}\n\n\t\treturn out;\n\t}\n}\n"
  },
  {
    "path": "src/interval.js",
    "content": "module.exports = class Interval{\n\tconstructor(index, length) {\n\t\tthis._index = index;\n\t\tthis._length = length;\n\t}\n\n\tget index() { return this._index; }\n\tget length() { return this._length; }\n\n\tintersects(index) {\n\t\treturn index >= this.index && index < (this.index + this.length);\n\t}\n}\n"
  },
  {
    "path": "src/nestup.js",
    "content": "const Container = require(\"./container\");\nconst Onset = require(\"./onset\");\nconst Fraction = require(\"fraction.js\");\nconst memoize = require(\"memoizee\");\n\nmodule.exports = class Nestup {\n\tconstructor(parseTree) {\n\t\t// Nestup roots everything in a single, additive container\n\t\tconst rootContainerDescripiton = { dimension: { proportionality: \"+\", scale: 1 }, contents: parseTree };\n\t\tthis._rootContainer = new Container(rootContainerDescripiton, 1);\n\t}\n\n\tget beatLength() {\n\t\treturn this._inherentLength().valueOf();\n\t}\n\n\tonOffEvents(gridsize) {\n\t\tlet events = this._onOffEvents();\n\t\tif (gridsize) {\n\t\t\tevents = this._snapToGrid(events, gridsize);\n\t\t}\n\t\treturn this._toFloats(events);\n\t}\n\n\t_inherentLength = memoize(() => {\n\t\treturn this._rootContainer.proportionality;\n\t});\n\n\t_normalizedOnsets = memoize(() => {\n\t\treturn this._rootContainer.normalizedOnsets();\n\t});\n\n\t_snapToGrid = memoize((events, tickDuration) => {\n\t\treturn events.map(e => {\n\t\t\treturn {\n\t\t\t\ttime: Math.round(e.time.mul(tickDuration).valueOf()),\n\t\t\t\ton: e.on,\n\t\t\t\tpath: e.path\n\t\t\t};\n\t\t});\n\t});\n\n\t_onOffEvents = memoize(() => {\n\t\tconst onsets = this._normalizedOnsets();\n\t\tlet lastOnset = null;\n\t\tlet outEvents = [];\n\n\t\tonsets.forEach(e => {\n\t\t\tif (e.type === Onset.type.ON) {\n\t\t\t\tif (lastOnset && lastOnset.type === Onset.type.ON) {\n\t\t\t\t\toutEvents.push({\n\t\t\t\t\t\ttime: e.time,\n\t\t\t\t\t\ton: false,\n\t\t\t\t\t\tpath: e.path\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\toutEvents.push({\n\t\t\t\t\ttime: e.time,\n\t\t\t\t\ton: true,\n\t\t\t\t\tpath: e.path\n\t\t\t\t});\n\t\t\t}\n\n\t\t\telse {\n\t\t\t\tif (lastOnset && lastOnset.type === Onset.type.ON) {\n\t\t\t\t\toutEvents.push({\n\t\t\t\t\t\ttime: e.time,\n\t\t\t\t\t\ton: false,\n\t\t\t\t\t\tpath: e.path\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tlastOnset = e;\n\t\t});\n\n\t\tif (lastOnset && lastOnset.type === Onset.type.ON) {\n\t\t\toutEvents.push({\n\t\t\t\ttime: new Fraction(1),\n\t\t\t\ton: false,\n\t\t\t\tpath: lastOnset.path\n\t\t\t});\n\t\t}\n\n\t\treturn outEvents;\n\t});\n\n\t_toFloats = memoize((events) => {\n\t\treturn events.map(e => Object.assign({}, e, { time: e.time.valueOf() }));\n\t});\n}\n"
  },
  {
    "path": "src/onset.js",
    "content": "class Onset {\n\tconstructor(time, type, path) {\n\t\tthis._time = time;\n\t\tthis._type = type;\n\t\tthis._path = path;\n\t}\n\n\tget time() { return this._time; }\n\tget type() { return this._type; }\n\tget path() { return this._path; }\n}\n\nOnset.type = Object.freeze({\n\tON: \"ON\",\n\tOFF: \"OFF\",\n});\n\nmodule.exports = Onset;\n"
  },
  {
    "path": "src/parseError.js",
    "content": "module.exports = class ParseError {\n\tconstructor(rawNearleyError) {\n\t\tconst errormessage = rawNearleyError.message;\n\t\tconst splitByLine = errormessage.split(\"\\n\");\n\t\tconst line1 = splitByLine[0];\n\t\tconst dreg = /\\d+/;\n\n\t\tlet lineAnchor = line1.indexOf(\"line\");\n\t\tlet colAnchor = line1.indexOf(\"col\");\n\t\tlet line = Number.parseInt(dreg.exec(line1.substr(lineAnchor)));\n\t\tlet col = Number.parseInt(dreg.exec(line1.substr(colAnchor)));\n\t\tthis._line = line;\n\t\tthis._col = col;\n\n\t\tconst line5 = splitByLine[4];\n\t\tconst periodAnchor = line5.indexOf(\". \");\n\t\tconst shortMessage = line5.substr(0, periodAnchor + 1);\n\t\tthis._shortMessage = shortMessage;\n\n\t\tif (rawNearleyError.token) {\n\t\t\tthis._token = rawNearleyError.token.text;\n\t\t} else if (this.col !== undefined) {\n\t\t\tthis._token = splitByLine[2].charAt(col + 1);\n\t\t}\n\t}\n\n\tget line() { return this._line; }\n\tget col() { return this._col; }\n\tget message() { return this._shortMessage; }\n\tget token() { return this._token; }\n}\n"
  },
  {
    "path": "src/parser.js",
    "content": "const nearley = require(\"nearley\");\nconst grammar = require(\"./build/grammar.js\");\n\nmodule.exports = class RhythmParser {\n\tconstructor() {\n\t\tthis._parser = new nearley.Parser(nearley.Grammar.fromCompiled(grammar));\n\t}\n\n\tparse(text) {\n\t\tthis._parser.feed(text);\n\n\t\t// First result, just in case the grammar is ambiguous, which it shouldn't be\n\t\treturn this._parser.results[0];\n\t}\n}\n"
  },
  {
    "path": "src/trackWriter.js",
    "content": "const midiWriter = require(\"midi-writer-js\");\n\nmodule.exports = function writeOnsetsAsMidi(nestup, pitch, ticks, outfile) {\n\t// Assume 4 beats to one measure\n\tconst track = new midiWriter.Track();\n\tconst midiLikeEvents = nestup.onOffEvents(ticks);\n\tlet lastEvent = null;\n\n\tlet tickCounter = 0;\n\tlet noteStartTick = 0;\n\tmidiLikeEvents.forEach((event) => {\n\n\t\tif (event.on) {\n\t\t\tnoteStartTick = event.time;\n\t\t}\n\n\t\telse {\n\t\t\tconst duration = event.time - noteStartTick;\n\t\t\tconst wait = noteStartTick - tickCounter;\n\n\t\t\ttrack.addEvent(new midiWriter.NoteEvent({\n\t\t\t\tpitch: pitch,\n\t\t\t\tduration: \"T\" + duration,\n\t\t\t\twait: \"T\" + wait\n\t\t\t}));\n\n\t\t\ttickCounter += (wait + duration);\n\t\t}\n\t});\n\n\tconst write = new midiWriter.Writer(track);\n\twrite.saveMIDI(outfile);\n}\n"
  },
  {
    "path": "test/comments.test.js",
    "content": "require(\"mocha\");\nconst { expect } = require(\"chai\");\nconst { RhythmParser, Nestup } = require(\"../index\");\nconst Fraction = require(\"fraction.js\");\n\ndescribe(\"Comments\", () => {\n\tit(\"encodes right rotation, with a comment\", () => {\n\t\tconst input =\n`[2 // This is a comment\n] {1 > 1/4}`;\n\t\tconst parseTree = new RhythmParser().parse(input);\n\t\tconst nestup = new Nestup(parseTree);\n\t\tconst midiLikeEvents = nestup.onOffEvents(100);\n\n\t\texpect(nestup.beatLength).to.equal(2);\n\t\texpect(midiLikeEvents).to.be.an.instanceOf(Array).with.length(2);\n\t\texpect(midiLikeEvents[0].on).to.be.true;\n\t\texpect(midiLikeEvents[1].on).to.be.false;\n\t\texpect(midiLikeEvents[0].time).to.equal(25);\n\t\texpect(midiLikeEvents[1].time).to.equal(100);\n\t});\n\n\tit(\"encodes left rotation, with comments\", () => {\n\t\tconst input =\n`// This is a comment\n\n// And another\n[2] {1 < 1/4}\n// One more comment for the road`;\n\t\tconst parseTree = new RhythmParser().parse(input);\n\t\tconst nestup = new Nestup(parseTree);\n\t\tconst midiLikeEvents = nestup.onOffEvents(100);\n\n\t\texpect(nestup.beatLength).to.equal(2);\n\t\texpect(midiLikeEvents).to.be.an.instanceOf(Array).with.length(2);\n\t\texpect(midiLikeEvents[0].on).to.be.true;\n\t\texpect(midiLikeEvents[1].on).to.be.false;\n\t\texpect(midiLikeEvents[0].time).to.equal(75);\n\t\texpect(midiLikeEvents[1].time).to.equal(100);\n\t});\n});\n"
  },
  {
    "path": "test/dividedContainers.test.js",
    "content": "require(\"mocha\");\nconst { expect } = require(\"chai\");\nconst { RhythmParser, Container, Onset } = require(\"../index\");\nconst Fraction = require(\"fraction.js\");\n\ndescribe(\"Subdivided Containers\", () => {\n\tit(\"parses a basic tuplet\", () => {\n\t\tconst input = `{3}`;\n\t\tconst parseTree = new RhythmParser().parse(input);\n\n\t\tconst containerDescription = parseTree[0];\n\t\tconst tup = new Container(containerDescription);\n\t\tconst onsets = tup.normalizedOnsets();\n\n\t\texpect(onsets).to.have.length(4);\n\t\texpect(onsets[0].time.equals(new Fraction(0))).to.be.true;\n\t\texpect(onsets[1].time.equals(new Fraction(1, 3))).to.be.true;\n\t\texpect(onsets[2].time.equals(new Fraction(2, 3))).to.be.true;\n\t\texpect(onsets[3].time.equals(new Fraction(1))).to.be.true;\n\t});\n\n\tit(\"parses a nested tuplet\", () => {\n\t\tconst input = `{3\n\t\t\t1:1 {3}\n\t\t}`;\n\t\tconst parseTree = new RhythmParser().parse(input);\n\n\t\tconst containerDescription = parseTree[0];\n\t\tconst tup = new Container(containerDescription);\n\t\tconst onsets = tup.normalizedOnsets();\n\n\t\texpect(onsets).to.have.length(6);\n\t\texpect(onsets[0].time.equals(new Fraction(0))).to.be.true;\n\t\texpect(onsets[1].time.equals(new Fraction(1, 9))).to.be.true;\n\t\texpect(onsets[2].time.equals(new Fraction(2, 9))).to.be.true;\n\t\texpect(onsets[3].time.equals(new Fraction(1, 3))).to.be.true;\n\t\texpect(onsets[4].time.equals(new Fraction(2, 3))).to.be.true;\n\t\texpect(onsets[5].time.equals(new Fraction(1))).to.be.true;\n\t});\n\n\tit(\"handles rests\", () => {\n\t\tconst input = `[4] {0}`;\n\t\tconst parseTree = new RhythmParser().parse(input);\n\n\t\tconst containerDescription = parseTree[0];\n\t\tconst tup = new Container(containerDescription);\n\t\tconst onsets = tup.normalizedOnsets();\n\n\t\texpect(onsets[0].type).to.equal(Onset.type.OFF);\n\t});\n\n\tit(\"handles subtuples with rests\", () => {\n\t\tconst input = `[4] {3 2:1 {0} }`;\n\t\tconst parseTree = new RhythmParser().parse(input);\n\n\t\tconst containerDescription = parseTree[0];\n\t\tconst tup = new Container(containerDescription);\n\t\tconst onsets = tup.normalizedOnsets();\n\n\t\texpect(onsets[1].type).to.equal(Onset.type.OFF);\n\t});\n\n\tit(\"handles overlapped rests\", () => {\n\t\tconst input = `[4] {3 1:3 {0} 2:1 {1} }`;\n\t\tconst parseTree = new RhythmParser().parse(input);\n\n\t\tconst containerDescription = parseTree[0];\n\t\tconst tup = new Container(containerDescription);\n\t\tconst onsets = tup.normalizedOnsets();\n\n\t\texpect(onsets).to.have.length(4);\n\t\texpect(onsets[0].type).to.equal(Onset.type.OFF);\n\t\texpect(onsets[1].type).to.equal(Onset.type.ON);\n\t\texpect(onsets[2].type).to.equal(Onset.type.OFF);\n\t\texpect(onsets[3].type).to.equal(Onset.type.OFF);\n\t});\n});\n"
  },
  {
    "path": "test/errors.test.js",
    "content": "require(\"mocha\");\nconst { expect, assert } = require(\"chai\");\nconst { RhythmParser, ParseError } = require(\"../index\");\n\ndescribe(\"Parse errors\", () => {\n\tit(\"identifies obvious line errors\", () => {\n\t\tconst input = `{1} a`;\n\t\tconst parser = new RhythmParser();\n\n\t\ttry {\n\t\t\tconst result = parser.parse(input);\n\t\t\tassert.fail(\"Should have thrown an error\");\n\t\t} catch (e) {\n\t\t\tconst pe = new ParseError(e);\n\t\t\texpect(pe.line).to.equal(1);\n\t\t\texpect(pe.col).to.equal(5);\n\t\t\texpect(pe.message).to.contain(\"Unexpected word token: \\\"a\\\".\");\n\t\t\texpect(pe.token).to.equals(\"a\");\n\t\t}\n\t});\n\n\tit(\"identifies lexer errors\", () => {\n\t\tconst input = `[2, 3 * 4] {5}`;\n\t\tconst parser = new RhythmParser();\n\n\t\ttry {\n\t\t\tconst result = parser.parse(input);\n\t\t\tassert.fail(\"Should have thrown an error\");\n\t\t} catch (e) {\n\t\t\tconst pe = new ParseError(e);\n\t\t\texpect(pe.line).to.equal(1);\n\t\t\texpect(pe.col).to.equal(7);\n\t\t\texpect(pe.message).to.contain(\"Unexpected input (lexer error).\");\n\t\t\texpect(pe.token).to.equals(\"*\");\n\t\t}\n\t});\n});\n"
  },
  {
    "path": "test/grammar.test.js",
    "content": "require(\"mocha\");\nconst { expect } = require(\"chai\");\nconst { RhythmParser, ParseError } = require(\"../index\");\nconst Fraction = require(\"fraction.js\");\n\ndescribe(\"Grammar: Bare minimum\", () => {\n\tit(\"loads the grammar\", () => {\n\t\texpect(RhythmParser).not.to.be.undefined;\n\t});\n});\n\ndescribe(\"Grammar: Generating parse trees\", () => {\n\tit(\"parses an empty string\", () => {\n\t\tconst input = \"\";\n\t\tconst parser = new RhythmParser();\n\t\tconst result = parser.parse(input);\n\n\t\texpect(result).to.be.an.instanceOf(Array);\n\t\texpect(result).to.have.length(0);\n\t});\n\n\tit(\"parses a simple rhythm\", () => {\n\t\tconst input = `\n\t\t\t{3}\n\t\t`;\n\t\tconst parser = new RhythmParser();\n\t\tconst result = parser.parse(input);\n\n\t\texpect(result).to.be.an.instanceOf(Array);\n\t\texpect(result).to.have.length(1);\n\n\t\tconst container = result[0];\n\n\t\texpect(container).to.haveOwnProperty(\"dimension\");\n\t\texpect(container).to.haveOwnProperty(\"subdivisions\");\n\t\texpect(container.dimension).to.equal(undefined);\n\n\t\tconst subdivisions = container.subdivisions;\n\n\t\texpect(subdivisions).to.have.property(\"division\").that.is.a(\"number\");\n\t\texpect(subdivisions).to.have.property(\"ranges\").that.is.null;\n\t});\n\n\tit(\"parses a nested rhythm\", () => {\n\t\tconst input = `\n\t\t\t{3 1:2 {3}}\n\t\t`;\n\t\tconst parser = new RhythmParser();\n\t\tconst result = parser.parse(input);\n\n\t\tconst container = result[0];\n\n\t\texpect(container).to.haveOwnProperty(\"subdivisions\");\n\n\t\tconst subdivisions = container.subdivisions;\n\n\t\texpect(subdivisions).to.have.property(\"division\").that.equals(3);\n\t\texpect(subdivisions).to.have.property(\"ranges\").that.is.an.instanceOf(Array).that.has.length(1);\n\n\t\tconst rangedContainer = subdivisions.ranges[0];\n\n\t\texpect(rangedContainer).to.have.property(\"range\").that.is.a(\"object\");\n\t\texpect(rangedContainer).to.have.property(\"container\").that.is.a(\"object\");\n\n\t\tconst range = rangedContainer.range;\n\t\tconst subcontainer = rangedContainer.container;\n\n\t\texpect(range).to.have.property(\"index\").that.equals(1);\n\t\texpect(range).to.have.property(\"length\").that.equals(2);\n\t\texpect(subcontainer).to.have.property(\"subdivisions\").that.is.a(\"object\");\n\t\texpect(subcontainer.subdivisions.division).to.equal(3);\n\t});\n\n\tit(\"handles multiple ranged containers\", () => {\n\t\tconst input = `\n\t\t\t{2\n\t\t\t\t1 {3}\n\t\t\t\t2 {4}\n\t\t\t}\n\t\t`;\n\n\t\tconst parser = new RhythmParser();\n\t\tconst result = parser.parse(input);\n\n\t\tconst container = result[0];\n\t\texpect(container).to.haveOwnProperty(\"subdivisions\");\n\t\texpect(container.subdivisions).to.have.property(\"division\").that.equals(2);\n\t\texpect(container.subdivisions).to.haveOwnProperty(\"ranges\").with.length(2);\n\t\texpect(container.subdivisions.ranges[0].container.subdivisions.division).to.equal(3);\n\t\texpect(container.subdivisions.ranges[1].container.subdivisions.division).to.equal(4);\n\t});\n\n\tit(\"parses a rhythm with container dimensions\", () => {\n\t\tconst input = `\n\t\t\t[4, 2] {3}\n\t\t`;\n\n\t\tconst parser = new RhythmParser();\n\t\tconst result = parser.parse(input);\n\n\t\tconst container = result[0];\n\t\texpect(container).to.haveOwnProperty(\"dimension\");\n\t\texpect(container.dimension).to.have.property(\"proportionality\").that.equals(4);\n\t\texpect(container.dimension).to.have.property(\"scale\").that.is.an.instanceOf(Fraction);\n\t\texpect(container.dimension.scale.equals(2)).to.be.true;\n\t\texpect(container).to.haveOwnProperty(\"subdivisions\");\n\t\texpect(container.subdivisions).to.have.property(\"division\").that.equals(3);\n\t});\n\n\tit(\"parses a rhythm with multiple containers\", () => {\n\t\tconst input = `\n\t\t\t[]{3} []{4}\n\t\t`;\n\n\t\tconst parser = new RhythmParser();\n\t\tconst result = parser.parse(input);\n\n\t\texpect(result).to.have.length(2);\n\t\texpect(result[0]).to.have.property(\"subdivisions\").with.property(\"division\").that.equals(3);\n\t\texpect(result[1]).to.have.property(\"subdivisions\").with.property(\"division\").that.equals(4);\n\t});\n\n\tit(\"parses a rhythm with a rational scale\", () => {\n\t\tconst input = `\n\t\t\t[2, 2/3] {3}\n\t\t`;\n\n\t\tconst parser = new RhythmParser();\n\t\tconst result = parser.parse(input);\n\n\t\texpect(result).to.have.length(1);\n\t\tconst container = result[0];\n\t\texpect(container).to.haveOwnProperty(\"dimension\");\n\t\texpect(container.dimension).to.have.property(\"proportionality\").that.equals(2);\n\t\texpect(container.dimension).to.have.property(\"scale\").that.is.an.instanceOf(Fraction);\n\t\texpect(container.dimension.scale.equals(new Fraction(2, 3))).to.be.true;\n\t});\n\n\tit(\"handles subcontainers\", () => {\n\t\tconst input = `[[1] [1]]`;\n\n\t\tconst parser = new RhythmParser();\n\t\tconst result = parser.parse(input);\n\n\t\texpect(result).to.have.length(1);\n\t\tconst container = result[0];\n\t\texpect(container).to.haveOwnProperty(\"contents\").that.is.an.instanceOf(Array).with.length(2);\n\t});\n\n\tit(\"handles a container with additive proportionality\", () => {\n\t\tconst input = `\n\t\t\t[ [1] [1] ]\n\t\t`;\n\n\t\tconst parser = new RhythmParser();\n\t\tconst result = parser.parse(input);\n\n\t\texpect(result).to.have.length(1);\n\t\tconst container = result[0];\n\t\texpect(container).to.haveOwnProperty(\"dimension\");\n\t\texpect(container.dimension).to.have.property(\"proportionality\").that.equals(\"+\");\n\t});\n\n\tit(\"handles ties between containers\", () => {\n\t\tconst input = `\n\t\t\t[[1] _ [1]]\n\t\t`;\n\n\t\tconst parser = new RhythmParser();\n\t\tconst result = parser.parse(input);\n\n\t\texpect(result).to.have.length(1);\n\t\tconst container = result[0];\n\t\texpect(container).to.haveOwnProperty(\"contents\").that.is.an.instanceOf(Array).with.length(2);\n\t\texpect(container.contents[0]).to.haveOwnProperty(\"tie\").that.equals(true);\n\t});\n\n\tit(\"handles ties between ranged containers\", () => {\n\t\tconst input = `\n\t\t\t[] {3\n\t\t\t\t1 [] _\n\t\t\t\t2 []\n\t\t\t}\n\t\t`;\n\n\t\tconst parser = new RhythmParser();\n\t\tconst result = parser.parse(input);\n\n\t\texpect(result).to.have.length(1);\n\t\tconst container = result[0];\n\t\texpect(container).to.haveOwnProperty(\"subdivisions\");\n\t\texpect(container.subdivisions).to.haveOwnProperty(\"ranges\").that.is.an.instanceOf(Array).with.length(2);\n\t\texpect(container.subdivisions.ranges[0].container).to.haveOwnProperty(\"tie\").that.equals(true);\n\t});\n\n\tit(\"rejects ties at the beginning or end of a list of containers\", () => {\n\t\ttry {\n\t\t\tconst input = `_[1]`\n\t\t\tconst parser = new RhythmParser();\n\t\t\tparser.parse(input);\n\t\t\texpect.fail(\"Should have thrown a parse error\");\n\t\t} catch (e) {}\n\n\t\ttry {\n\t\t\tconst input = `[1]_`\n\t\t\tconst parser = new RhythmParser();\n\t\t\tparser.parse(input);\n\t\t\texpect.fail(\"Should have thrown a parse error\");\n\t\t} catch (e) {}\n\t});\n});\n"
  },
  {
    "path": "test/nestup.test.js",
    "content": "require(\"mocha\");\nconst { expect } = require(\"chai\");\nconst { default: Fraction } = require(\"fraction.js\");\nconst { RhythmParser, Nestup, Onset } = require(\"../index\");\n\ndescribe(\"Nestup\", () => {\n\n\tit(\"finds the correct proportionality\", () => {\n\t\tconst input = `[4] {1}`;\n\t\tconst parseTree = new RhythmParser().parse(input);\n\t\tconst nestup = new Nestup(parseTree);\n\n\t\texpect(nestup.beatLength).to.equal(4);\n\t});\n\n\tit(\"finds the correct proportionality for a more complex expression\", () => {\n\t\tconst input = `[4] {1} [,1/2] [ [] [] ]`;\n\t\tconst parseTree = new RhythmParser().parse(input);\n\t\tconst nestup = new Nestup(parseTree);\n\n\t\texpect(nestup.beatLength).to.equal(6.5);\n\t});\n\n\tit(\"generates events\", () => {\n\t\tconst input = `[4] {1}`;\n\t\tconst parseTree = new RhythmParser().parse(input);\n\t\tconst nestup = new Nestup(parseTree);\n\n\t\tconst tickedEvents = nestup.onOffEvents();\n\n\t\texpect(tickedEvents).to.be.an.instanceOf(Array);\n\t\texpect(tickedEvents).to.have.length(2);\n\t\texpect(tickedEvents[0]).to.haveOwnProperty(\"time\").that.is.a(\"number\");\n\t\texpect(tickedEvents[0]).to.haveOwnProperty(\"on\").that.is.a(\"boolean\");\n\t\texpect(tickedEvents[0]).to.haveOwnProperty(\"path\").that.is.a(\"string\");\n\t});\n\n\tit(\"aligns events with a tick grid\", () => {\n\t\tconst input = `[4] {3}`;\n\t\tconst parseTree = new RhythmParser().parse(input);\n\t\tconst nestup = new Nestup(parseTree);\n\n\t\tconst divisibleTickedEvents = nestup.onOffEvents(300);\n\t\tconst onsets = nestup._normalizedOnsets();\n\n\t\texpect(divisibleTickedEvents).to.be.an.instanceOf(Array);\n\t\texpect(divisibleTickedEvents).to.have.length(6);\n\t\texpect(divisibleTickedEvents[0].on).to.equal(true);\n\t\texpect(divisibleTickedEvents[0].time).to.equal(0);\n\t\texpect(divisibleTickedEvents[0].path).to.equal(onsets[0].path);\n\t\texpect(divisibleTickedEvents[1].on).to.equal(false);\n\t\texpect(divisibleTickedEvents[1].time).to.equal(100);\n\t\texpect(divisibleTickedEvents[1].path).to.equal(onsets[0].path);\n\t\texpect(divisibleTickedEvents[2].on).to.equal(true);\n\t\texpect(divisibleTickedEvents[2].time).to.equal(100);\n\t\texpect(divisibleTickedEvents[2].path).to.equal(onsets[1].path);\n\t\texpect(divisibleTickedEvents[3].on).to.equal(false);\n\t\texpect(divisibleTickedEvents[3].time).to.equal(200);\n\t\texpect(divisibleTickedEvents[3].path).to.equal(onsets[1].path);\n\t\texpect(divisibleTickedEvents[4].on).to.equal(true);\n\t\texpect(divisibleTickedEvents[4].time).to.equal(200);\n\t\texpect(divisibleTickedEvents[4].path).to.equal(onsets[2].path);\n\t\texpect(divisibleTickedEvents[5].on).to.equal(false);\n\t\texpect(divisibleTickedEvents[5].time).to.equal(300);\n\t\texpect(divisibleTickedEvents[5].path).to.equal(onsets[2].path);\n\t});\n\n\tit(\"rounds event times to the nearest tick\", () => {\n\t\tconst input = `[4] {3}`;\n\t\tconst parseTree = new RhythmParser().parse(input);\n\t\tconst nestup = new Nestup(parseTree);\n\n\t\tconst tickedEvents = nestup.onOffEvents(100);\n\n\t\texpect(tickedEvents).to.be.an.instanceOf(Array);\n\t\texpect(tickedEvents).to.have.length(6);\n\t\texpect(tickedEvents[0].time).to.equal(0);\n\t\texpect(tickedEvents[1].time).to.equal(33);\n\t\texpect(tickedEvents[2].time).to.equal(33);\n\t\texpect(tickedEvents[3].time).to.equal(67);\n\t\texpect(tickedEvents[4].time).to.equal(67);\n\t\texpect(tickedEvents[5].time).to.equal(100);\n\t});\n\n\tit(\"handles rests\", () => {\n\t\tconst input = `[4] {3 2:1 {0} }`;\n\t\tconst parseTree = new RhythmParser().parse(input);\n\t\tconst nestup = new Nestup(parseTree);\n\n\t\tconst tickEvents = nestup.onOffEvents(30);\n\n\t\texpect(tickEvents).to.be.an.instanceOf(Array);\n\t\texpect(tickEvents).to.have.length(4);\n\t\texpect(tickEvents[0].on).to.equal(true);\n\t\texpect(tickEvents[1].on).to.equal(false);\n\t\texpect(tickEvents[1].time).to.equal(10);\n\t\texpect(tickEvents[2].on).to.equal(true);\n\t\texpect(tickEvents[2].time).to.equal(20);\n\t\texpect(tickEvents[3].on).to.equal(false);\n\t\texpect(tickEvents[3].time).to.equal(30);\n\t});\n\n\tit(\"generates midi-like events\", () => {\n\t\tconst input = `[4] {4 3:1 {0} }`;\n\t\tconst parseTree = new RhythmParser().parse(input);\n\t\tconst nestup = new Nestup(parseTree);\n\t\tconst midiLikeEvents = nestup.onOffEvents(100);\n\t\texpect(midiLikeEvents).to.be.an.instanceOf(Array);\n\t\texpect(midiLikeEvents).to.have.length(6);\n\n\t\texpect(midiLikeEvents[0].on).to.equal(true);\n\t\texpect(midiLikeEvents[0].time).to.equal(0);\n\t\texpect(midiLikeEvents[1].on).to.equal(false);\n\t\texpect(midiLikeEvents[1].time).to.equal(25);\n\t\texpect(midiLikeEvents[2].on).to.equal(true);\n\t\texpect(midiLikeEvents[2].time).to.equal(25);\n\t\texpect(midiLikeEvents[3].on).to.equal(false);\n\t\texpect(midiLikeEvents[3].time).to.equal(50);\n\t\texpect(midiLikeEvents[4].on).to.equal(true);\n\t\texpect(midiLikeEvents[4].time).to.equal(75);\n\t\texpect(midiLikeEvents[5].on).to.equal(false);\n\t\texpect(midiLikeEvents[5].time).to.equal(100);\n\t});\n\n\tit(\"handles funky on/off overlap\", () => {\n\t\tconst input = `[4] {4\n\t\t\t2:3 {1}\n\t\t\t3 {0}\n\t\t}`;\n\t\tconst parseTree = new RhythmParser().parse(input);\n\t\tconst nestup = new Nestup(parseTree);\n\t\tconst midiLikeEvents = nestup.onOffEvents(100);\n\t\texpect(midiLikeEvents).to.be.an.instanceOf(Array);\n\t\texpect(midiLikeEvents).to.have.length(4);\n\n\t\texpect(midiLikeEvents[0].on).to.equal(true);\n\t\texpect(midiLikeEvents[0].time).to.equal(0);\n\t\texpect(midiLikeEvents[1].on).to.equal(false);\n\t\texpect(midiLikeEvents[1].time).to.equal(25);\n\t\texpect(midiLikeEvents[2].on).to.equal(true);\n\t\texpect(midiLikeEvents[2].time).to.equal(25);\n\t\texpect(midiLikeEvents[3].on).to.equal(false);\n\t\texpect(midiLikeEvents[3].time).to.equal(50);\n\t});\n\n\tit(\"handles a flexible container inside a fixed container\", () => {\n\t\tconst input = `[2\n\t\t\t[ [4] [] ]\n\t\t]\n\t\t`;\n\n\t\tconst parseTree = new RhythmParser().parse(input);\n\t\tconst nestup = new Nestup(parseTree);\n\t\tconst onsets = nestup._normalizedOnsets();\n\n\t\texpect(onsets).to.be.an.instanceOf(Array).with.length(3);\n\t\texpect(onsets[0].type).to.equal(Onset.type.ON);\n\t\texpect(onsets[1].type).to.equal(Onset.type.ON);\n\t\texpect(onsets[2].type).to.equal(Onset.type.OFF);\n\t\texpect(onsets[0].time.equals(new Fraction(0))).to.be.true;\n\t\texpect(onsets[1].time.equals(new Fraction(4, 5))).to.be.true;\n\t\texpect(onsets[2].time.equals(new Fraction(1))).to.be.true;\n\n\t\tconst midiLikeEvents = nestup.onOffEvents(100);\n\t\texpect(midiLikeEvents).to.be.an.instanceOf(Array).with.length(4);\n\t\texpect(midiLikeEvents[0].on).to.be.true;\n\t\texpect(midiLikeEvents[1].on).to.be.false;\n\t\texpect(midiLikeEvents[2].on).to.be.true;\n\t\texpect(midiLikeEvents[3].on).to.be.false;\n\t\texpect(midiLikeEvents[0].time).to.equal(0);\n\t\texpect(midiLikeEvents[1].time).to.equal(80);\n\t\texpect(midiLikeEvents[2].time).to.equal(80);\n\t\texpect(midiLikeEvents[3].time).to.equal(100);\n\t});\n\n\tit(\"handles quick ranges\", () => {\n\t\tconst input = `['4] {10\n\t\t\t1\n\t\t\t4\n\t\t\t6:2\n\t\t}\n\t\t`;\n\n\t\tconst parseTree = new RhythmParser().parse(input);\n\t\tconst nestup = new Nestup(parseTree);\n\n\t\tconst midiLikeEvents = nestup.onOffEvents(100);\n\t\texpect(midiLikeEvents).to.be.an.instanceOf(Array).with.length(6);\n\t\texpect(midiLikeEvents[0].on).to.be.true;\n\t\texpect(midiLikeEvents[1].on).to.be.false;\n\t\texpect(midiLikeEvents[2].on).to.be.true;\n\t\texpect(midiLikeEvents[3].on).to.be.false;\n\t\texpect(midiLikeEvents[4].on).to.be.true;\n\t\texpect(midiLikeEvents[5].on).to.be.false;\n\t\texpect(midiLikeEvents[0].time).to.equal(0);\n\t\texpect(midiLikeEvents[1].time).to.equal(10);\n\t\texpect(midiLikeEvents[2].time).to.equal(30);\n\t\texpect(midiLikeEvents[3].time).to.equal(40);\n\t\texpect(midiLikeEvents[4].time).to.equal(50);\n\t\texpect(midiLikeEvents[5].time).to.equal(70);\n\t});\n\n\tit(\"rejects a container that is both a parent as well as subdivided\", () => {\n\t\tconst input = `\n\t\t\t[ [] [] ] {2}\n\t\t`\n\n\t\ttry {\n\t\t\tconst parseTree = new RhythmParser().parse(input);\n\t\t\tconst nestup = new Nestup(parseTree);\n\t\t\texpect.fail(\"Should have produced a parse error\");\n\t\t} catch (e) {}\n\t});\n\n\tit(\"rejects a list of two or more subcontainers without explicit containers\", () => {\n\t\tconst input = `\n\t\t\t[ {2} {2} ]\n\t\t`\n\n\t\ttry {\n\t\t\tconst parseTree = new RhythmParser().parse(input);\n\t\t\tconst nestup = new Nestup(parseTree);\n\t\t\texpect.fail(\"Should have produced a parse error\");\n\t\t} catch (e) {}\n\t});\n\n\tit(\"parses a slightly complex expression\", () => {\n\t\tconst input = `\n\t\t\t[8] {8\n\t\t\t\t2:3 {6\n\t\t\t\t\t3 [']\n\t\t\t\t}\n\t\t\t\t5 [']\n\t\t\t\t7 {4}\n\t\t\t}\n\t\t`\n\n\t\ttry {\n\t\t\tconst parseTree = new RhythmParser().parse(input);\n\t\t\tconst nestup = new Nestup(parseTree);\n\t\t\texpect(nestup).not.to.be.undefined();\n\t\t} catch (e) {}\n\t});\n});\n"
  },
  {
    "path": "test/rest.test.js",
    "content": "require(\"mocha\");\nconst { expect } = require(\"chai\");\nconst { Container, RhythmParser, Nestup, Onset } = require(\"../index\");\nconst Fraction = require(\"fraction.js\");\n\ndescribe(\"Rests\", () => {\n\tit(\"encodes a lagging rest\", () => {\n\t\tconst input = `[[2] ['2]]`;\n\t\tconst parseTree = new RhythmParser().parse(input);\n\t\tconst nestup = new Nestup(parseTree);\n\t\tconst midiLikeEvents = nestup.onOffEvents(100);\n\n\t\texpect(parseTree).to.be.an.instanceOf(Array).with.length(1);\n\n\t\tconst container = new Container(parseTree[0]);\n\n\t\tconst onsets = container.normalizedOnsets();\n\t\texpect(onsets).to.have.length(3);\n\t\texpect(onsets[0].time.equals(new Fraction(0))).to.be.true;\n\t\texpect(onsets[1].time.equals(new Fraction(1, 2))).to.be.true;\n\t\texpect(onsets[2].time.equals(new Fraction(1))).to.be.true;\n\n\t\texpect(nestup.beatLength).to.equal(4);\n\t\texpect(midiLikeEvents).to.be.an.instanceOf(Array).with.length(2);\n\t\texpect(midiLikeEvents[0].on).to.be.true;\n\t\texpect(midiLikeEvents[1].on).to.be.false;\n\t\texpect(midiLikeEvents[0].time).to.equal(0);\n\t\texpect(midiLikeEvents[1].time).to.equal(50);\n\t});\n\n\tit(\"encodes a leading rest\", () => {\n\t\tconst input = `[['2] [2]]`;\n\t\tconst parseTree = new RhythmParser().parse(input);\n\t\tconst nestup = new Nestup(parseTree);\n\t\tconst midiLikeEvents = nestup.onOffEvents(100);\n\n\t\texpect(parseTree).to.be.an.instanceOf(Array).with.length(1);\n\n\t\tconst container = new Container(parseTree[0]);\n\n\t\tconst onsets = container.normalizedOnsets();\n\t\texpect(onsets).to.have.length(3);\n\t\texpect(onsets[0].time.equals(new Fraction(0))).to.be.true;\n\t\texpect(onsets[1].time.equals(new Fraction(1, 2))).to.be.true;\n\t\texpect(onsets[2].time.equals(new Fraction(1))).to.be.true;\n\n\t\texpect(nestup.beatLength).to.equal(4);\n\t\texpect(midiLikeEvents).to.be.an.instanceOf(Array).with.length(2);\n\t\texpect(midiLikeEvents[0].on).to.be.true;\n\t\texpect(midiLikeEvents[1].on).to.be.false;\n\t\texpect(midiLikeEvents[0].time).to.equal(50);\n\t\texpect(midiLikeEvents[1].time).to.equal(100);\n\t});\n\n\tit(\"handles an awkward double rest\", () => {\n\t\tconst input = `[['2] ['2]]`;\n\t\tconst parseTree = new RhythmParser().parse(input);\n\t\tconst nestup = new Nestup(parseTree);\n\t\tconst midiLikeEvents = nestup.onOffEvents(100);\n\n\t\texpect(parseTree).to.be.an.instanceOf(Array).with.length(1);\n\n\t\tconst container = new Container(parseTree[0]);\n\n\t\tconst onsets = container.normalizedOnsets();\n\t\texpect(onsets).to.have.length(2);\n\t\texpect(onsets[0].time.equals(new Fraction(0))).to.be.true;\n\t\texpect(onsets[1].time.equals(new Fraction(1, 2))).to.be.true;\n\n\t\texpect(nestup.beatLength).to.equal(4);\n\t\texpect(midiLikeEvents).to.be.an.instanceOf(Array).with.length(0);\n\t});\n\n\tit(\"handles pure rest\", () => {\n\t\tconst input = `['4]`;\n\t\tconst parseTree = new RhythmParser().parse(input);\n\t\tconst nestup = new Nestup(parseTree);\n\t\tconst midiLikeEvents = nestup.onOffEvents(100);\n\n\t\texpect(parseTree).to.be.an.instanceOf(Array).with.length(1);\n\n\t\tconst container = new Container(parseTree[0]);\n\n\t\tconst onsets = container.normalizedOnsets();\n\t\texpect(onsets).to.have.length(1);\n\t\texpect(onsets[0].time.equals(new Fraction(0))).to.be.true;\n\n\t\texpect(nestup.beatLength).to.equal(4);\n\t\texpect(midiLikeEvents).to.be.an.instanceOf(Array).with.length(0);\n\t});\n\n\tit(\"handles the thing we made rests for\", () => {\n\t\tconst input = `['4] {10 6 []}`;\n\t\tconst parseTree = new RhythmParser().parse(input);\n\t\tconst nestup = new Nestup(parseTree);\n\t\tconst midiLikeEvents = nestup.onOffEvents(100);\n\n\t\texpect(nestup.beatLength).to.equal(4);\n\t\texpect(midiLikeEvents).to.be.an.instanceOf(Array).with.length(2);\n\t\texpect(midiLikeEvents[0].on).to.be.true;\n\t\texpect(midiLikeEvents[1].on).to.be.false;\n\t\texpect(midiLikeEvents[0].time).to.equal(50);\n\t\texpect(midiLikeEvents[1].time).to.equal(60);\n\t});\n\n\tit(\"handles another easy rest thing\", () => {\n\t\tconst input = `['4] {4 2 [] 4 []}`;\n\t\tconst parseTree = new RhythmParser().parse(input);\n\t\tconst nestup = new Nestup(parseTree);\n\t\tconst midiLikeEvents = nestup.onOffEvents(100);\n\n\t\texpect(nestup.beatLength).to.equal(4);\n\t\texpect(midiLikeEvents).to.be.an.instanceOf(Array).with.length(4);\n\t\texpect(midiLikeEvents[0].on).to.be.true;\n\t\texpect(midiLikeEvents[1].on).to.be.false;\n\t\texpect(midiLikeEvents[2].on).to.be.true;\n\t\texpect(midiLikeEvents[3].on).to.be.false;\n\t\texpect(midiLikeEvents[0].time).to.equal(25);\n\t\texpect(midiLikeEvents[1].time).to.equal(50);\n\t\texpect(midiLikeEvents[2].time).to.equal(75);\n\t\texpect(midiLikeEvents[3].time).to.equal(100);\n\t});\n});\n"
  },
  {
    "path": "test/rotation.test.js",
    "content": "require(\"mocha\");\nconst { expect } = require(\"chai\");\nconst { Container, RhythmParser, Nestup, Onset } = require(\"../index\");\nconst Fraction = require(\"fraction.js\");\n\ndescribe(\"Rotations\", () => {\n\tit(\"encodes right rotation\", () => {\n\t\tconst input = `[2] {1 > 1/4}`;\n\t\tconst parseTree = new RhythmParser().parse(input);\n\t\tconst nestup = new Nestup(parseTree);\n\t\tconst midiLikeEvents = nestup.onOffEvents(100);\n\n\t\texpect(nestup.beatLength).to.equal(2);\n\t\texpect(midiLikeEvents).to.be.an.instanceOf(Array).with.length(2);\n\t\texpect(midiLikeEvents[0].on).to.be.true;\n\t\texpect(midiLikeEvents[1].on).to.be.false;\n\t\texpect(midiLikeEvents[0].time).to.equal(25);\n\t\texpect(midiLikeEvents[1].time).to.equal(100);\n\t});\n\n\tit(\"encodes left rotation\", () => {\n\t\tconst input = `[2] {1 < 1/4}`;\n\t\tconst parseTree = new RhythmParser().parse(input);\n\t\tconst nestup = new Nestup(parseTree);\n\t\tconst midiLikeEvents = nestup.onOffEvents(100);\n\n\t\texpect(nestup.beatLength).to.equal(2);\n\t\texpect(midiLikeEvents).to.be.an.instanceOf(Array).with.length(2);\n\t\texpect(midiLikeEvents[0].on).to.be.true;\n\t\texpect(midiLikeEvents[1].on).to.be.false;\n\t\texpect(midiLikeEvents[0].time).to.equal(75);\n\t\texpect(midiLikeEvents[1].time).to.equal(100);\n\t});\n});\n"
  },
  {
    "path": "test/sizedContainers.test.js",
    "content": "require(\"mocha\");\nconst { expect } = require(\"chai\");\nconst { Container, RhythmParser, Nestup, Onset } = require(\"../index\");\nconst Fraction = require(\"fraction.js\");\n\ndescribe(\"Sized Containers\", () => {\n\tit(\"parses a container with a beat ratio\", () => {\n\t\tconst input = `[2, 2/3] {3}`;\n\t\tconst parseTree = new RhythmParser().parse(input);\n\n\t\texpect(parseTree).to.be.an.instanceOf(Array).with.length(1);\n\n\t\tconst container = new Container(parseTree[0]);\n\n\t\texpect(container).to.have.property(\"proportionality\");\n\t\texpect(container.proportionality.equals(new Fraction(4, 3))).to.be.true;\n\t\texpect(container).to.have.property(\"scale\");\n\t\texpect(container.scale.equals(new Fraction(2, 3))).to.be.true;\n\n\t\tconst onsets = container.normalizedOnsets();\n\t\texpect(onsets).to.have.length(4);\n\t\texpect(onsets[0].time.equals(new Fraction(0))).to.be.true;\n\t\texpect(onsets[1].time.equals(new Fraction(1, 3))).to.be.true;\n\t\texpect(onsets[2].time.equals(new Fraction(2, 3))).to.be.true;\n\t\texpect(onsets[3].time.equals(new Fraction(1))).to.be.true;\n\t});\n\n\tit(\"normalizes containers by beat ratio\", () => {\n\t\tconst input = `[1, 1/3] {2} [1] {2}`;\n\t\tconst parseTree = new RhythmParser().parse(input);\n\n\t\texpect(parseTree).to.be.an.instanceOf(Array).with.length(2);\n\n\t\tconst nestup = new Nestup(parseTree);\n\t\tconst onsets = nestup._normalizedOnsets();\n\n\t\texpect(onsets).to.be.an.instanceOf(Array).with.length(5);\n\t\texpect(onsets[0].time.equals(new Fraction(0))).to.be.true;\n\t\texpect(onsets[1].time.equals(new Fraction(1, 8))).to.be.true;\n\t\texpect(onsets[2].time.equals(new Fraction(1, 4))).to.be.true;\n\t\texpect(onsets[3].time.equals(new Fraction(5, 8))).to.be.true;\n\t\texpect(onsets[4].time.equals(new Fraction(1))).to.be.true;\n\t});\n\n\tit(\"handles onset paths\", () => {\n\t\tconst input = `{2 2:1 {2 2:1 {2}}}`;\n\t\tconst parseTree = new RhythmParser().parse(input);\n\n\t\texpect(parseTree).to.be.an.instanceOf(Array).with.length(1);\n\n\t\tconst nestup = new Nestup(parseTree);\n\t\tconst onsets = nestup._normalizedOnsets();\n\n\t\texpect(onsets).to.be.an.instanceOf(Array).with.length(5);\n\t\texpect(onsets[0].path).to.equal(\"11\");\n\t\texpect(onsets[1].path).to.equal(\"111\");\n\t\texpect(onsets[2].path).to.equal(\"1111\");\n\t\texpect(onsets[3].path).to.equal(\"1111\");\n\t});\n\n\tit(\"handles ties between subcontainers\", () => {\n\t\tconst input = `[[] _ []]`;\n\t\tconst parseTree = new RhythmParser().parse(input);\n\n\t\texpect(parseTree).to.be.an.instanceOf(Array).with.length(1);\n\n\t\tconst nestup = new Nestup(parseTree);\n\t\tconst onsets = nestup._normalizedOnsets();\n\n\t\texpect(onsets).to.be.an.instanceOf(Array).with.length(2);\n\t\texpect(onsets[0].time.equals(new Fraction(0))).to.be.true;\n\t\texpect(onsets[0].type).equals(Onset.type.ON);\n\t\texpect(onsets[1].time.equals(new Fraction(1))).to.be.true;\n\t\texpect(onsets[1].type).equals(Onset.type.OFF);\n\t});\n\n\tit(\"handles ties between ranged containers\", () => {\n\t\tconst input = `[] {2 1 [] _ 2 []}`;\n\t\tconst parseTree = new RhythmParser().parse(input);\n\n\t\texpect(parseTree).to.be.an.instanceOf(Array).with.length(1);\n\n\t\tconst nestup = new Nestup(parseTree);\n\t\tconst onsets = nestup._normalizedOnsets();\n\n\t\texpect(onsets).to.be.an.instanceOf(Array).with.length(2);\n\t\texpect(onsets[0].time.equals(new Fraction(0))).to.be.true;\n\t\texpect(onsets[0].type).equals(Onset.type.ON);\n\t\texpect(onsets[1].time.equals(new Fraction(1))).to.be.true;\n\t\texpect(onsets[1].type).equals(Onset.type.OFF);\n\t});\n});\n"
  },
  {
    "path": "webpack.config.js",
    "content": "const path = require('path');\n\nmodule.exports = {\n\tentry: './index.js',\n\tmodule: {\n\t\trules: [\n\t\t\t{\n\t\t\t\tloader: 'babel-loader',\n\t\t\t\ttest: /\\.js$/,\n\t\t\t\texclude: /node_modules/,\n\t\t\t\toptions: {\n\t\t\t\t\tplugins: ['transform-class-properties']\n\t\t\t\t}\n\t\t\t}\n\t\t]\n\t},\n\toutput: {\n\t\tpath: path.resolve(__dirname, 'dist'),\n\t\tfilename: 'nestup.bundle.js',\n\t\tlibraryTarget: \"umd\",\n\t\tlibrary: \"Nestup\"\n\t}\n};\n"
  }
]