[
  {
    "path": ".gitattributes",
    "content": "# Generated files\n# https://github.com/github/linguist#generated-code\nast3/Include/graminit.h          linguist-generated=true\nast3/Python/graminit.h           linguist-generated=true\nast3/Include/Python-ast.h        linguist-generated=true\nast3/Python/Python-ast.c         linguist-generated=true\nast3/Include/token.h             linguist-generated=true\nast3/Lib/token.py                linguist-generated=true\nast3/Parser/token.c              linguist-generated=true\nast27/Include/graminit.h         linguist-generated=true\nast27/Python/graminit.h          linguist-generated=true\nast27/Include/Python-ast.h       linguist-generated=true\nast27/Python/Python-ast.c        linguist-generated=true\nast27/Include/token.h            linguist-generated=true\nast27/Lib/token.py               linguist-generated=true\nast27/Parser/token.c             linguist-generated=true\n"
  },
  {
    "path": ".github/workflows/build.yml",
    "content": "name: Build wheels\n\non: [push, pull_request, workflow_dispatch]\n\njobs:\n  build_wheels:\n    name: py${{ matrix.python-version }} on ${{ matrix.os }}\n    runs-on: ${{ matrix.os }}\n    strategy:\n      fail-fast: false\n      matrix:\n        # cibuildwheel builds linux wheels inside a manylinux container\n        # it also takes care of procuring the correct python version for us\n        os: [ubuntu-latest, windows-latest, macos-latest]\n        python-version: [36, 37, 38, 39, 310, 311]\n\n    steps:\n      - uses: actions/checkout@v3\n      - name: Build wheels\n        uses: pypa/cibuildwheel@v2.10.2\n        env:\n          CIBW_BUILD: \"cp${{ matrix.python-version }}-*\"\n          CIBW_SKIP: \"*-manylinux_i686 *-musllinux_i686 *-win32\"\n          CIBW_ARCHS_MACOS: \"x86_64 arm64\"\n          CIBW_BUILD_VERBOSITY: 1\n          CIBW_BEFORE_TEST: pip install pytest\n          CIBW_TEST_COMMAND: pytest {package}\n      - uses: actions/upload-artifact@v3\n        with:\n          name: dist\n          path: ./wheelhouse/*.whl\n\n  build_wheels_aarch64:\n    name: py${{ matrix.python-version }} on ${{ matrix.os }} (aarch64)\n    runs-on: ${{ matrix.os }}\n    strategy:\n      fail-fast: false\n      matrix:\n        # cibuildwheel builds linux wheels inside a manylinux container\n        # it also takes care of procuring the correct python version for us\n        os: [ubuntu-latest]\n        python-version: [36, 37, 38, 39, 310, 311]\n\n    steps:\n      - uses: actions/checkout@v3\n      - name: Setup up QEMU\n        uses: docker/setup-qemu-action@v2\n        with:\n          platforms: arm64\n      - name: Build wheels\n        uses: pypa/cibuildwheel@v2.10.2\n        env:\n          CIBW_BUILD: \"cp${{ matrix.python-version }}-*\"\n          CIBW_ARCHS: aarch64\n          CIBW_BUILD_VERBOSITY: 1\n          CIBW_BEFORE_TEST: pip install pytest\n          CIBW_TEST_COMMAND: pytest {package}\n      - uses: actions/upload-artifact@v3\n        with:\n          name: dist\n          path: ./wheelhouse/*.whl\n\n  build_sdist_python_wheel:\n    name: sdist and python wheel\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v3\n      - uses: actions/setup-python@v4\n        name: Install Python\n        with:\n          python-version: \"3.9\"\n      - name: Run check-manifest\n        run: |\n          pip install check-manifest\n          check-manifest -v\n      - name: Build sdist and wheel\n        run: |\n          pip install --upgrade setuptools pip wheel\n          python setup.py sdist\n      - uses: actions/upload-artifact@v3\n        with:\n          name: dist\n          path: |\n            dist/*.tar.gz\n"
  },
  {
    "path": ".gitignore",
    "content": "*.o\n*.pyc\n/build/\n__pycache__/\n.DS_Store\n/tools/pgen3\n/.pytest_cache/\n/typed_ast.egg-info/\n"
  },
  {
    "path": "CONTRIBUTING.md",
    "content": "To contribute code to this project, you'll need to sign the [Python Software Foundation's Contributor License Agreement](https://www.python.org/psf/contrib/contrib-form/).\n"
  },
  {
    "path": "LICENSE",
    "content": "Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/\nUpstream-Name: typed-ast\nSource: https://pypi.python.org/pypi/typed-ast\n\nFiles: *\nCopyright: © 2016 David Fisher <ddfisher@dropbox.com>\nLicense: Apache-2.0\n\nFiles: *\nCopyright: © 2016 David Fisher <ddfisher@dropbox.com>\n           © 2008 Armin Ronacher\nComment: The original CPython source is licensed under the\n Python Software Foundation License Version 2\nLicense: Python\n\nFiles: ast27/Parser/spark.py\nCopyright: © 1998-2002 John Aycock\nLicense: Expat\n Permission is hereby granted, free of charge, to any person obtaining\n a copy of this software and associated documentation files (the\n \"Software\"), to deal in the Software without restriction, including\n without limitation the rights to use, copy, modify, merge, publish,\n distribute, sublicense, and/or sell copies of the Software, and to\n permit persons to whom the Software is furnished to do so, subject to\n the following conditions:\n\n The above copyright notice and this permission notice shall be\n included in all copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\n IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\n CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\n TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n\nLicense: Apache-2.0\n                               Apache License\n                         Version 2.0, January 2004\n                      http://www.apache.org/licenses/\n .\n TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n .\n 1. Definitions.\n .\n    \"License\" shall mean the terms and conditions for use, reproduction,\n    and distribution as defined by Sections 1 through 9 of this document.\n .\n    \"Licensor\" shall mean the copyright owner or entity authorized by\n    the copyright owner that is granting the License.\n .\n    \"Legal Entity\" shall mean the union of the acting entity and all\n    other entities that control, are controlled by, or are under common\n    control with that entity. For the purposes of this definition,\n    \"control\" means (i) the power, direct or indirect, to cause the\n    direction or management of such entity, whether by contract or\n    otherwise, or (ii) ownership of fifty percent (50%) or more of the\n    outstanding shares, or (iii) beneficial ownership of such entity.\n .\n    \"You\" (or \"Your\") shall mean an individual or Legal Entity\n    exercising permissions granted by this License.\n .\n    \"Source\" form shall mean the preferred form for making modifications,\n    including but not limited to software source code, documentation\n    source, and configuration files.\n .\n    \"Object\" form shall mean any form resulting from mechanical\n    transformation or translation of a Source form, including but\n    not limited to compiled object code, generated documentation,\n    and conversions to other media types.\n .\n    \"Work\" shall mean the work of authorship, whether in Source or\n    Object form, made available under the License, as indicated by a\n    copyright notice that is included in or attached to the work\n    (an example is provided in the Appendix below).\n .\n    \"Derivative Works\" shall mean any work, whether in Source or Object\n    form, that is based on (or derived from) the Work and for which the\n    editorial revisions, annotations, elaborations, or other modifications\n    represent, as a whole, an original work of authorship. For the purposes\n    of this License, Derivative Works shall not include works that remain\n    separable from, or merely link (or bind by name) to the interfaces of,\n    the Work and Derivative Works thereof.\n .\n    \"Contribution\" shall mean any work of authorship, including\n    the original version of the Work and any modifications or additions\n    to that Work or Derivative Works thereof, that is intentionally\n    submitted to Licensor for inclusion in the Work by the copyright owner\n    or by an individual or Legal Entity authorized to submit on behalf of\n    the copyright owner. For the purposes of this definition, \"submitted\"\n    means any form of electronic, verbal, or written communication sent\n    to the Licensor or its representatives, including but not limited to\n    communication on electronic mailing lists, source code control systems,\n    and issue tracking systems that are managed by, or on behalf of, the\n    Licensor for the purpose of discussing and improving the Work, but\n    excluding communication that is conspicuously marked or otherwise\n    designated in writing by the copyright owner as \"Not a Contribution.\"\n .\n    \"Contributor\" shall mean Licensor and any individual or Legal Entity\n    on behalf of whom a Contribution has been received by Licensor and\n    subsequently incorporated within the Work.\n .\n 2. Grant of Copyright License. Subject to the terms and conditions of\n    this License, each Contributor hereby grants to You a perpetual,\n    worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n    copyright license to reproduce, prepare Derivative Works of,\n    publicly display, publicly perform, sublicense, and distribute the\n    Work and such Derivative Works in Source or Object form.\n .\n 3. Grant of Patent License. Subject to the terms and conditions of\n    this License, each Contributor hereby grants to You a perpetual,\n    worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n    (except as stated in this section) patent license to make, have made,\n    use, offer to sell, sell, import, and otherwise transfer the Work,\n    where such license applies only to those patent claims licensable\n    by such Contributor that are necessarily infringed by their\n    Contribution(s) alone or by combination of their Contribution(s)\n    with the Work to which such Contribution(s) was submitted. If You\n    institute patent litigation against any entity (including a\n    cross-claim or counterclaim in a lawsuit) alleging that the Work\n    or a Contribution incorporated within the Work constitutes direct\n    or contributory patent infringement, then any patent licenses\n    granted to You under this License for that Work shall terminate\n    as of the date such litigation is filed.\n .\n 4. Redistribution. You may reproduce and distribute copies of the\n    Work or Derivative Works thereof in any medium, with or without\n    modifications, and in Source or Object form, provided that You\n    meet the following conditions:\n .\n    (a) You must give any other recipients of the Work or\n        Derivative Works a copy of this License; and\n .\n    (b) You must cause any modified files to carry prominent notices\n        stating that You changed the files; and\n .\n    (c) You must retain, in the Source form of any Derivative Works\n        that You distribute, all copyright, patent, trademark, and\n        attribution notices from the Source form of the Work,\n        excluding those notices that do not pertain to any part of\n        the Derivative Works; and\n .\n    (d) If the Work includes a \"NOTICE\" text file as part of its\n        distribution, then any Derivative Works that You distribute must\n        include a readable copy of the attribution notices contained\n        within such NOTICE file, excluding those notices that do not\n        pertain to any part of the Derivative Works, in at least one\n        of the following places: within a NOTICE text file distributed\n        as part of the Derivative Works; within the Source form or\n        documentation, if provided along with the Derivative Works; or,\n        within a display generated by the Derivative Works, if and\n        wherever such third-party notices normally appear. The contents\n        of the NOTICE file are for informational purposes only and\n        do not modify the License. You may add Your own attribution\n        notices within Derivative Works that You distribute, alongside\n        or as an addendum to the NOTICE text from the Work, provided\n        that such additional attribution notices cannot be construed\n        as modifying the License.\n .\n    You may add Your own copyright statement to Your modifications and\n    may provide additional or different license terms and conditions\n    for use, reproduction, or distribution of Your modifications, or\n    for any such Derivative Works as a whole, provided Your use,\n    reproduction, and distribution of the Work otherwise complies with\n    the conditions stated in this License.\n .\n 5. Submission of Contributions. Unless You explicitly state otherwise,\n    any Contribution intentionally submitted for inclusion in the Work\n    by You to the Licensor shall be under the terms and conditions of\n    this License, without any additional terms or conditions.\n    Notwithstanding the above, nothing herein shall supersede or modify\n    the terms of any separate license agreement you may have executed\n    with Licensor regarding such Contributions.\n .\n 6. Trademarks. This License does not grant permission to use the trade\n    names, trademarks, service marks, or product names of the Licensor,\n    except as required for reasonable and customary use in describing the\n    origin of the Work and reproducing the content of the NOTICE file.\n .\n 7. Disclaimer of Warranty. Unless required by applicable law or\n    agreed to in writing, Licensor provides the Work (and each\n    Contributor provides its Contributions) on an \"AS IS\" BASIS,\n    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n    implied, including, without limitation, any warranties or conditions\n    of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n    PARTICULAR PURPOSE. You are solely responsible for determining the\n    appropriateness of using or redistributing the Work and assume any\n    risks associated with Your exercise of permissions under this License.\n .\n 8. Limitation of Liability. In no event and under no legal theory,\n    whether in tort (including negligence), contract, or otherwise,\n    unless required by applicable law (such as deliberate and grossly\n    negligent acts) or agreed to in writing, shall any Contributor be\n    liable to You for damages, including any direct, indirect, special,\n    incidental, or consequential damages of any character arising as a\n    result of this License or out of the use or inability to use the\n    Work (including but not limited to damages for loss of goodwill,\n    work stoppage, computer failure or malfunction, or any and all\n    other commercial damages or losses), even if such Contributor\n    has been advised of the possibility of such damages.\n .\n 9. Accepting Warranty or Additional Liability. While redistributing\n    the Work or Derivative Works thereof, You may choose to offer,\n    and charge a fee for, acceptance of support, warranty, indemnity,\n    or other liability obligations and/or rights consistent with this\n    License. However, in accepting such obligations, You may act only\n    on Your own behalf and on Your sole responsibility, not on behalf\n    of any other Contributor, and only if You agree to indemnify,\n    defend, and hold each Contributor harmless for any liability\n    incurred by, or claims asserted against, such Contributor by reason\n    of your accepting any such warranty or additional liability.\n .\n END OF TERMS AND CONDITIONS\n .\n APPENDIX: How to apply the Apache License to your work.\n .\n    To apply the Apache License to your work, attach the following\n    boilerplate notice, with the fields enclosed by brackets \"[]\"\n    replaced with your own identifying information. (Don't include\n    the brackets!)  The text should be enclosed in the appropriate\n    comment syntax for the file format. We also recommend that a\n    file or class name and description of purpose be included on the\n    same \"printed page\" as the copyright notice for easier\n    identification within third-party archives.\n .\n Copyright 2016 Dropbox, Inc.\n .\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n .\n     http://www.apache.org/licenses/LICENSE-2.0\n .\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n \nLicense: Python\n PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2\n --------------------------------------------\n .\n 1. This LICENSE AGREEMENT is between the Python Software Foundation\n (\"PSF\"), and the Individual or Organization (\"Licensee\") accessing and\n otherwise using this software (\"Python\") in source or binary form and\n its associated documentation.\n .\n 2. Subject to the terms and conditions of this License Agreement, PSF hereby\n grants Licensee a nonexclusive, royalty-free, world-wide license to reproduce,\n analyze, test, perform and/or display publicly, prepare derivative works,\n distribute, and otherwise use Python alone or in any derivative version,\n provided, however, that PSF's License Agreement and PSF's notice of copyright,\n i.e., \"Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,\n 2011, 2012, 2013, 2014, 2015, 2016 Python Software Foundation; All Rights\n Reserved\" are retained in Python alone or in any derivative version prepared by\n Licensee.\n .\n 3. In the event Licensee prepares a derivative work that is based on\n or incorporates Python or any part thereof, and wants to make\n the derivative work available to others as provided herein, then\n Licensee hereby agrees to include in any such work a brief summary of\n the changes made to Python.\n .\n 4. PSF is making Python available to Licensee on an \"AS IS\"\n basis.  PSF MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR\n IMPLIED.  BY WAY OF EXAMPLE, BUT NOT LIMITATION, PSF MAKES NO AND\n DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS\n FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON WILL NOT\n INFRINGE ANY THIRD PARTY RIGHTS.\n .\n 5. PSF SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON\n FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS\n A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON,\n OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.\n .\n 6. This License Agreement will automatically terminate upon a material\n breach of its terms and conditions.\n .\n 7. Nothing in this License Agreement shall be deemed to create any\n relationship of agency, partnership, or joint venture between PSF and\n Licensee.  This License Agreement does not grant permission to use PSF\n trademarks or trade name in a trademark sense to endorse or promote\n products or services of Licensee, or any third party.\n .\n 8. By copying, installing or otherwise using Python, Licensee\n agrees to be bound by the terms and conditions of this License\n Agreement.\n"
  },
  {
    "path": "MANIFEST.in",
    "content": "include ast27/Grammar/Grammar\ninclude ast27/Parser/Python.asdl\nrecursive-include ast27 *.h\nrecursive-include ast27 *.py\n\ninclude ast3/Grammar/Grammar\ninclude ast3/Parser/Python.asdl\nrecursive-include ast3 *.h\nrecursive-include ast3 *.py\n\nrecursive-include ast3/tests *.py\ninclude LICENSE\n\nprune tools\nexclude CONTRIBUTING.md\nexclude release_process.md\nexclude update_process.md\n"
  },
  {
    "path": "README.md",
    "content": "# End of life\n\nThis project is no longer maintained.\n\nUse the standard library `ast` module instead.\nSee https://github.com/python/typed_ast/issues/179.\n\n# Typed AST\n\n[![Build Status](https://travis-ci.org/python/typed_ast.svg?branch=master)](https://travis-ci.org/python/typed_ast)\n[![Chat at https://gitter.im/python/typed_ast](https://badges.gitter.im/python/typed_ast.svg)](https://gitter.im/python/typed_ast)\n\n`typed_ast` is a Python 3 package that provides a Python 2.7 and Python 3\nparser similar to the standard `ast` library.  Unlike `ast` up to Python 3.7, the parsers in\n`typed_ast` include [PEP 484](https://www.python.org/dev/peps/pep-0484/) type\ncomments and are independent of the version of Python under which they are run.\nThe `typed_ast` parsers produce the standard Python AST (plus type comments),\nand are both fast and correct, as they are based on the CPython 2.7 and 3.7\nparsers.  `typed_ast` runs on CPython 3.6-3.10 on Linux, OS X and Windows.\n\n**Note:** Starting with Python 3.8, we recommend to use the native `ast` parser\n(see below).\n\n## Development Philosophy\n\nThis project is a (mostly) drop-in replacement for the builtin `ast` module.  It is\nintended to be bug-for-bug compatible and behave identically, except for the\npresence of a few additional fields on the returned classes and a few\nadditional optional arguments to the `parse` call.  Therefore, `typed_ast` will\nnot accept any bugfixes for bugs in `ast` -- they should be fixed upstream\ninstead.  To avoid feature bloat, any new features for `typed_ast` should have\nthe potential to be broadly useful and not be built just for one niche usecase\nor in a manner such that only one project can use them.\n\n### Incompatibilities\n\nFor the purposes of *consuming* syntax trees, this should be a drop-in replacement.\nIt is not a drop-in replacement for users that wish to create or transform ASTs,\nas a number of syntax tree classes have additional fields that must be populated\nwhen constructing them.\n\nDue to reliance on certain C APIs, this library does not build on and there\nare [no plans to support PyPy](https://github.com/python/typed_ast/issues/111).\n\n### Python 3.8\n\n`typed_ast` will not be updated to support parsing Python 3.8 and\nnewer.  Instead, it is recommended to use the stdlib `ast` module\nthere, which has been augmented to support extracting type comments\nand has limited support for parsing older versions of Python 3.\n\n## Submodules\n### ast3\nThe `ast3` parser produces the AST from a Python 3 code, up to Python 3.7. \n(For rationale and technical\ndetails, see [here](update_process.md).)  The AST it currently produces is described in\n[ast3/Parser/Python.asdl](ast3/Parser/Python.asdl).  If you wish to limit\nparsing to older versions of Python 3, `ast3` can be configured to to give a\nSyntaxError for new syntax features introduced beyond a given Python version.\nFor more information, see the module docstring in\n[typed\\_ast/ast3.py](typed_ast/ast3.py).\n\n### ast27\nThe `ast27` parser tracks the standard Python 2.7 AST, which is expected to\nnever receive further updates. The AST it produces is described in\n[ast27/Parser/Python.asdl](ast27/Parser/Python.asdl).  For more information,\nsee the module docstring in [typed\\_ast/ast27.py](typed_ast/ast27.py).\n\n### conversions\n`typed_ast` also provides a `conversions` module which converts `ast27` ASTs\ninto `ast3` ASTs.  This functionality is somewhat experimental, however.  For\nmore information, see the `py2to3` docstring in\n[typed\\_ast/conversions](typed_ast/conversions.py).\n\n\nNote: as these parsers consider type comments part of the grammar, incorrectly\nplaced type comments are considered syntax errors.\n\n## Releases\n\nTo make a new `typed_ast` release, see [`release_process.md`](release_process.md).\n"
  },
  {
    "path": "ast27/Custom/typed_ast.c",
    "content": "#include \"Python.h\"\n#include \"../Include/Python-ast.h\"\n#include \"../Include/compile.h\"\n#include \"../Include/node.h\"\n#include \"../Include/grammar.h\"\n#include \"../Include/token.h\"\n#include \"../Include/ast.h\"\n#include \"../Include/parsetok.h\"\n#include \"../Include/errcode.h\"\n#include \"../Include/graminit.h\"\n\nextern grammar _Ta27Parser_Grammar; /* from graminit.c */\n\n// from Python/bltinmodule.c\nstatic const char *\nsource_as_string(PyObject *cmd, const char *funcname, const char *what, PyCompilerFlags *cf, PyObject **cmd_copy)\n{\n    const char *str;\n    Py_ssize_t size;\n    Py_buffer view;\n\n    *cmd_copy = NULL;\n    if (PyUnicode_Check(cmd)) {\n        cf->cf_flags |= PyCF_IGNORE_COOKIE;\n        str = PyUnicode_AsUTF8AndSize(cmd, &size);\n        if (str == NULL)\n            return NULL;\n    }\n    else if (PyBytes_Check(cmd)) {\n        str = PyBytes_AS_STRING(cmd);\n        size = PyBytes_GET_SIZE(cmd);\n    }\n    else if (PyByteArray_Check(cmd)) {\n        str = PyByteArray_AS_STRING(cmd);\n        size = PyByteArray_GET_SIZE(cmd);\n    }\n    else if (PyObject_GetBuffer(cmd, &view, PyBUF_SIMPLE) == 0) {\n        /* Copy to NUL-terminated buffer. */\n        *cmd_copy = PyBytes_FromStringAndSize(\n            (const char *)view.buf, view.len);\n        PyBuffer_Release(&view);\n        if (*cmd_copy == NULL) {\n            return NULL;\n        }\n        str = PyBytes_AS_STRING(*cmd_copy);\n        size = PyBytes_GET_SIZE(*cmd_copy);\n    }\n    else {\n        PyErr_Format(PyExc_TypeError,\n          \"%s() arg 1 must be a %s object\",\n          funcname, what);\n        return NULL;\n    }\n\n    if (strlen(str) != (size_t)size) {\n        PyErr_SetString(PyExc_ValueError,\n                        \"source code string cannot contain null bytes\");\n        Py_CLEAR(*cmd_copy);\n        return NULL;\n    }\n    return str;\n}\n\n// from Python/pythonrun.c\n/* compute parser flags based on compiler flags */\nstatic int PARSER_FLAGS(PyCompilerFlags *flags)\n{\n    int parser_flags = 0;\n    if (!flags)\n        return 0;\n    if (flags->cf_flags & PyCF_DONT_IMPLY_DEDENT)\n        parser_flags |= PyPARSE_DONT_IMPLY_DEDENT;\n    if (flags->cf_flags & PyCF_IGNORE_COOKIE)\n        parser_flags |= PyPARSE_IGNORE_COOKIE;\n    return parser_flags;\n}\n\n// from Python/pythonrun.c\n/* Set the error appropriate to the given input error code (see errcode.h) */\nstatic void\nerr_input(perrdetail *err)\n{\n    PyObject *v, *w, *errtype, *errtext;\n    PyObject *msg_obj = NULL;\n    char *msg = NULL;\n    int offset = err->offset;\n\n    errtype = PyExc_SyntaxError;\n    switch (err->error) {\n    case E_ERROR:\n        return;\n    case E_SYNTAX:\n        errtype = PyExc_IndentationError;\n        if (err->expected == INDENT)\n            msg = \"expected an indented block\";\n        else if (err->token == INDENT)\n            msg = \"unexpected indent\";\n        else if (err->token == DEDENT)\n            msg = \"unexpected unindent\";\n        else {\n            errtype = PyExc_SyntaxError;\n            if (err->token == TYPE_COMMENT)\n              msg = \"misplaced type annotation\";\n            else\n              msg = \"invalid syntax\";\n        }\n        break;\n    case E_TOKEN:\n        msg = \"invalid token\";\n        break;\n    case E_EOFS:\n        msg = \"EOF while scanning triple-quoted string literal\";\n        break;\n    case E_EOLS:\n        msg = \"EOL while scanning string literal\";\n        break;\n    case E_INTR:\n        if (!PyErr_Occurred())\n            PyErr_SetNone(PyExc_KeyboardInterrupt);\n        goto cleanup;\n    case E_NOMEM:\n        PyErr_NoMemory();\n        goto cleanup;\n    case E_EOF:\n        msg = \"unexpected EOF while parsing\";\n        break;\n    case E_TABSPACE:\n        errtype = PyExc_TabError;\n        msg = \"inconsistent use of tabs and spaces in indentation\";\n        break;\n    case E_OVERFLOW:\n        msg = \"expression too long\";\n        break;\n    case E_DEDENT:\n        errtype = PyExc_IndentationError;\n        msg = \"unindent does not match any outer indentation level\";\n        break;\n    case E_TOODEEP:\n        errtype = PyExc_IndentationError;\n        msg = \"too many levels of indentation\";\n        break;\n    case E_DECODE: {\n        PyObject *type, *value, *tb;\n        PyErr_Fetch(&type, &value, &tb);\n        msg = \"unknown decode error\";\n        if (value != NULL)\n            msg_obj = PyObject_Str(value);\n        Py_XDECREF(type);\n        Py_XDECREF(value);\n        Py_XDECREF(tb);\n        break;\n    }\n    case E_LINECONT:\n        msg = \"unexpected character after line continuation character\";\n        break;\n    default:\n        fprintf(stderr, \"error=%d\\n\", err->error);\n        msg = \"unknown parsing error\";\n        break;\n    }\n    /* err->text may not be UTF-8 in case of decoding errors.\n       Explicitly convert to an object. */\n    if (!err->text) {\n        errtext = Py_None;\n        Py_INCREF(Py_None);\n    } else {\n        errtext = PyUnicode_DecodeUTF8(err->text, err->offset,\n                                       \"replace\");\n        if (errtext != NULL) {\n            Py_ssize_t len = strlen(err->text);\n            offset = (int)PyUnicode_GET_LENGTH(errtext);\n            if (len != err->offset) {\n                Py_DECREF(errtext);\n                errtext = PyUnicode_DecodeUTF8(err->text, len,\n                                               \"replace\");\n            }\n        }\n    }\n    v = Py_BuildValue(\"(OiiN)\", err->filename,\n                      err->lineno, offset, errtext);\n    if (v != NULL) {\n        if (msg_obj)\n            w = Py_BuildValue(\"(OO)\", msg_obj, v);\n        else\n            w = Py_BuildValue(\"(sO)\", msg, v);\n    } else\n        w = NULL;\n    Py_XDECREF(v);\n    PyErr_SetObject(errtype, w);\n    Py_XDECREF(w);\ncleanup:\n    Py_XDECREF(msg_obj);\n    if (err->text != NULL) {\n        PyObject_FREE(err->text);\n        err->text = NULL;\n    }\n}\n\n// from Python/pythonrun.c\nstatic void\nerr_free(perrdetail *err)\n{\n    Py_CLEAR(err->filename);\n}\n\n// copy of PyParser_ASTFromStringObject in Python/pythonrun.c\n/* Preferred access to parser is through AST. */\nstatic mod_ty\nstring_object_to_c_ast(const char *s, PyObject *filename, int start,\n                             PyCompilerFlags *flags, PyArena *arena)\n{\n    mod_ty mod;\n    PyCompilerFlags localflags;\n    perrdetail err;\n    int iflags = PARSER_FLAGS(flags);\n\n    node *n = Ta27Parser_ParseStringObject(s, filename,\n                                         &_Ta27Parser_Grammar, start, &err,\n                                         &iflags);\n    if (flags == NULL) {\n        localflags.cf_flags = 0;\n        flags = &localflags;\n    }\n    if (n) {\n        flags->cf_flags |= iflags & PyCF_MASK;\n        mod = Ta27AST_FromNode(n, flags, PyUnicode_AsUTF8(filename), arena);\n        Ta27Node_Free(n);\n    }\n    else {\n        err_input(&err);\n        mod = NULL;\n    }\n    err_free(&err);\n    return mod;\n}\n\n// adapted from Py_CompileStringObject in Python/pythonrun.c\nstatic PyObject *\nstring_object_to_py_ast(const char *str, PyObject *filename, int start,\n                       PyCompilerFlags *flags)\n{\n    mod_ty mod;\n    PyObject *result;\n    PyArena *arena = PyArena_New();\n    if (arena == NULL)\n        return NULL;\n\n    mod = string_object_to_c_ast(str, filename, start, flags, arena);\n    if (mod == NULL) {\n        PyArena_Free(arena);\n        return NULL;\n    }\n\n    result = Ta27AST_mod2obj(mod);\n    PyArena_Free(arena);\n    return result;\n}\n\n// adapted from builtin_compile_impl in Python/bltinmodule.c\nstatic PyObject *\nast27_parse_impl(PyObject *source,\n                 PyObject *filename, const char *mode)\n{\n    PyObject *source_copy;\n    const char *str;\n    int compile_mode = -1;\n    PyCompilerFlags cf;\n    int start[] = {file_input, eval_input, single_input, func_type_input };\n    PyObject *result;\n\n    cf.cf_flags = PyCF_ONLY_AST | PyCF_SOURCE_IS_UTF8;\n\n    if (strcmp(mode, \"exec\") == 0)\n        compile_mode = 0;\n    else if (strcmp(mode, \"eval\") == 0)\n        compile_mode = 1;\n    else if (strcmp(mode, \"single\") == 0)\n        compile_mode = 2;\n    else if (strcmp(mode, \"func_type\") == 0)\n        compile_mode = 3;\n    else {\n        PyErr_SetString(PyExc_ValueError,\n                        \"parse() mode must be 'exec', 'eval', 'single', for 'func_type'\");\n        goto error;\n    }\n\n    str = source_as_string(source, \"parse\", \"string or bytes\", &cf, &source_copy);\n    if (str == NULL)\n        goto error;\n\n    result = string_object_to_py_ast(str, filename, start[compile_mode], &cf);\n    Py_XDECREF(source_copy);\n    goto finally;\n\nerror:\n    result = NULL;\nfinally:\n    Py_DECREF(filename);\n    return result;\n}\n\n// adapted from builtin_compile in Python/clinic/bltinmodule.c.h\nPyObject *\nast27_parse(PyObject *self, PyObject *args)\n{\n    PyObject *return_value = NULL;\n    PyObject *source;\n    PyObject *filename;\n    const char *mode;\n\n    if (PyArg_ParseTuple(args, \"OO&s:parse\", &source, PyUnicode_FSDecoder, &filename, &mode))\n        return_value = ast27_parse_impl(source, filename, mode);\n\n    return return_value;\n}\n"
  },
  {
    "path": "ast27/Grammar/Grammar",
    "content": "# Grammar for Python\n\n# Note:  Changing the grammar specified in this file will most likely\n#        require corresponding changes in the parser module\n#        (../Modules/parsermodule.c).  If you can't make the changes to\n#        that module yourself, please co-ordinate the required changes\n#        with someone who can; ask around on python-dev for help.  Fred\n#        Drake <fdrake@acm.org> will probably be listening there.\n\n# NOTE WELL: You should also follow all the steps listed in PEP 306,\n# \"How to Change Python's Grammar\"\n\n# Start symbols for the grammar:\n#       single_input is a single interactive statement;\n#       file_input is a module or sequence of commands read from an input file;\n#       eval_input is the input for the eval() and input() functions.\n#       func_type_input is a PEP 484 Python 2 function type comment\n# NB: compound_stmt in single_input is followed by extra NEWLINE!\nsingle_input: NEWLINE | simple_stmt | compound_stmt NEWLINE\nfile_input: (NEWLINE | stmt)* ENDMARKER\neval_input: testlist NEWLINE* ENDMARKER\n\ndecorator: '@' dotted_name [ '(' [arglist] ')' ] NEWLINE\ndecorators: decorator+\ndecorated: decorators (classdef | funcdef)\nfuncdef: 'def' NAME parameters ':' [TYPE_COMMENT] suite\nparameters: '(' [varargslist] ')'\nvarargslist: ((fpdef ['=' test] ',' [TYPE_COMMENT])*\n              ('*' NAME [',' [TYPE_COMMENT]  '**' NAME] [TYPE_COMMENT] | '**' NAME [TYPE_COMMENT]) |\n              fpdef ['=' test] (',' [TYPE_COMMENT] fpdef ['=' test])* [','] [TYPE_COMMENT])\nfpdef: NAME | '(' fplist ')'\nfplist: fpdef (',' fpdef)* [',']\n\nstmt: simple_stmt | compound_stmt\nsimple_stmt: small_stmt (';' small_stmt)* [';'] NEWLINE\nsmall_stmt: (expr_stmt | print_stmt  | del_stmt | pass_stmt | flow_stmt |\n             import_stmt | global_stmt | exec_stmt | assert_stmt)\nexpr_stmt: testlist (augassign (yield_expr|testlist) |\n                     ('=' (yield_expr|testlist))* [TYPE_COMMENT])\naugassign: ('+=' | '-=' | '*=' | '/=' | '%=' | '&=' | '|=' | '^=' |\n            '<<=' | '>>=' | '**=' | '//=')\n# For normal assignments, additional restrictions enforced by the interpreter\nprint_stmt: 'print' ( [ test (',' test)* [','] ] |\n                      '>>' test [ (',' test)+ [','] ] )\ndel_stmt: 'del' exprlist\npass_stmt: 'pass'\nflow_stmt: break_stmt | continue_stmt | return_stmt | raise_stmt | yield_stmt\nbreak_stmt: 'break'\ncontinue_stmt: 'continue'\nreturn_stmt: 'return' [testlist]\nyield_stmt: yield_expr\nraise_stmt: 'raise' [test [',' test [',' test]]]\nimport_stmt: import_name | import_from\nimport_name: 'import' dotted_as_names\nimport_from: ('from' ('.'* dotted_name | '.'+)\n              'import' ('*' | '(' import_as_names ')' | import_as_names))\nimport_as_name: NAME ['as' NAME]\ndotted_as_name: dotted_name ['as' NAME]\nimport_as_names: import_as_name (',' import_as_name)* [',']\ndotted_as_names: dotted_as_name (',' dotted_as_name)*\ndotted_name: NAME ('.' NAME)*\nglobal_stmt: 'global' NAME (',' NAME)*\nexec_stmt: 'exec' expr ['in' test [',' test]]\nassert_stmt: 'assert' test [',' test]\n\ncompound_stmt: if_stmt | while_stmt | for_stmt | try_stmt | with_stmt | funcdef | classdef | decorated\nif_stmt: 'if' test ':' suite ('elif' test ':' suite)* ['else' ':' suite]\nwhile_stmt: 'while' test ':' suite ['else' ':' suite]\nfor_stmt: 'for' exprlist 'in' testlist ':' [TYPE_COMMENT] suite ['else' ':' suite]\ntry_stmt: ('try' ':' suite\n           ((except_clause ':' suite)+\n            ['else' ':' suite]\n            ['finally' ':' suite] |\n           'finally' ':' suite))\nwith_stmt: 'with' with_item (',' with_item)*  ':' [TYPE_COMMENT] suite\nwith_item: test ['as' expr]\n# NB compile.c makes sure that the default except clause is last\nexcept_clause: 'except' [test [('as' | ',') test]]\n# the TYPE_COMMENT in suites is only parsed for funcdefs, but can't go elsewhere due to ambiguity\nsuite: simple_stmt | NEWLINE [TYPE_COMMENT NEWLINE] INDENT stmt+ DEDENT\n\n# Backward compatibility cruft to support:\n# [ x for x in lambda: True, lambda: False if x() ]\n# even while also allowing:\n# lambda x: 5 if x else 2\n# (But not a mix of the two)\ntestlist_safe: old_test [(',' old_test)+ [',']]\nold_test: or_test | old_lambdef\nold_lambdef: 'lambda' [varargslist] ':' old_test\n\ntest: or_test ['if' or_test 'else' test] | lambdef\nor_test: and_test ('or' and_test)*\nand_test: not_test ('and' not_test)*\nnot_test: 'not' not_test | comparison\ncomparison: expr (comp_op expr)*\ncomp_op: '<'|'>'|'=='|'>='|'<='|'<>'|'!='|'in'|'not' 'in'|'is'|'is' 'not'\nexpr: xor_expr ('|' xor_expr)*\nxor_expr: and_expr ('^' and_expr)*\nand_expr: shift_expr ('&' shift_expr)*\nshift_expr: arith_expr (('<<'|'>>') arith_expr)*\narith_expr: term (('+'|'-') term)*\nterm: factor (('*'|'/'|'%'|'//') factor)*\nfactor: ('+'|'-'|'~') factor | power\npower: atom trailer* ['**' factor]\natom: ('(' [yield_expr|testlist_comp] ')' |\n       '[' [listmaker] ']' |\n       '{' [dictorsetmaker] '}' |\n       '`' testlist1 '`' |\n       NAME | NUMBER | STRING+)\nlistmaker: test ( list_for | (',' test)* [','] )\ntestlist_comp: test ( comp_for | (',' test)* [','] )\nlambdef: 'lambda' [varargslist] ':' test\ntrailer: '(' [arglist] ')' | '[' subscriptlist ']' | '.' NAME\nsubscriptlist: subscript (',' subscript)* [',']\nsubscript: '.' '.' '.' | test | [test] ':' [test] [sliceop]\nsliceop: ':' [test]\nexprlist: expr (',' expr)* [',']\ntestlist: test (',' test)* [',']\ndictorsetmaker: ( (test ':' test (comp_for | (',' test ':' test)* [','])) |\n                  (test (comp_for | (',' test)* [','])) )\n\nclassdef: 'class' NAME ['(' [testlist] ')'] ':' suite\n\narglist: (argument ',')* (argument [',']\n                         |'*' test (',' argument)* [',' '**' test] \n                         |'**' test)\n# The reason that keywords are test nodes instead of NAME is that using NAME\n# results in an ambiguity. ast.c makes sure it's a NAME.\nargument: test [comp_for] | test '=' test\n\nlist_iter: list_for | list_if\nlist_for: 'for' exprlist 'in' testlist_safe [list_iter]\nlist_if: 'if' old_test [list_iter]\n\ncomp_iter: comp_for | comp_if\ncomp_for: 'for' exprlist 'in' or_test [comp_iter]\ncomp_if: 'if' old_test [comp_iter]\n\ntestlist1: test (',' test)*\n\n# not used in grammar, but may appear in \"node\" passed from Parser to Compiler\nencoding_decl: NAME\n\nyield_expr: 'yield' [testlist]\n\nfunc_type_input: func_type NEWLINE* ENDMARKER\nfunc_type: '(' [typelist] ')' '->' test\n# typelist is a modified typedargslist (see above)\ntypelist: (test (',' test)* [','\n       ['*' [test] (',' test)* [',' '**' test] | '**' test]]\n     |  '*' [test] (',' test)* [',' '**' test] | '**' test)\n"
  },
  {
    "path": "ast27/Include/Python-ast.h",
    "content": "/* File automatically generated by Parser/asdl_c.py. */\n\n#include \"../Include/asdl.h\"\n\ntypedef struct _mod *mod_ty;\n\ntypedef struct _stmt *stmt_ty;\n\ntypedef struct _expr *expr_ty;\n\ntypedef enum _expr_context { Load=1, Store=2, Del=3, AugLoad=4, AugStore=5, Param=6 }\n                             expr_context_ty;\n\ntypedef struct _slice *slice_ty;\n\ntypedef enum _boolop { And=1, Or=2 } boolop_ty;\n\ntypedef enum _operator { Add=1, Sub=2, Mult=3, Div=4, Mod=5, Pow=6, LShift=7, RShift=8, BitOr=9,\n                         BitXor=10, BitAnd=11, FloorDiv=12 } operator_ty;\n\ntypedef enum _unaryop { Invert=1, Not=2, UAdd=3, USub=4 } unaryop_ty;\n\ntypedef enum _cmpop { Eq=1, NotEq=2, Lt=3, LtE=4, Gt=5, GtE=6, Is=7, IsNot=8, In=9, NotIn=10 }\n                      cmpop_ty;\n\ntypedef struct _comprehension *comprehension_ty;\n\ntypedef struct _excepthandler *excepthandler_ty;\n\ntypedef struct _arguments *arguments_ty;\n\ntypedef struct _keyword *keyword_ty;\n\ntypedef struct _alias *alias_ty;\n\ntypedef struct _type_ignore *type_ignore_ty;\n\n\nenum _mod_kind {Module_kind=1, Interactive_kind=2, Expression_kind=3, FunctionType_kind=4,\n                 Suite_kind=5};\nstruct _mod {\n        enum _mod_kind kind;\n        union {\n                struct {\n                        asdl_seq *body;\n                        asdl_seq *type_ignores;\n                } Module;\n                \n                struct {\n                        asdl_seq *body;\n                } Interactive;\n                \n                struct {\n                        expr_ty body;\n                } Expression;\n                \n                struct {\n                        asdl_seq *argtypes;\n                        expr_ty returns;\n                } FunctionType;\n                \n                struct {\n                        asdl_seq *body;\n                } Suite;\n                \n        } v;\n};\n\nenum _stmt_kind {FunctionDef_kind=1, ClassDef_kind=2, Return_kind=3, Delete_kind=4, Assign_kind=5,\n                  AugAssign_kind=6, Print_kind=7, For_kind=8, While_kind=9, If_kind=10,\n                  With_kind=11, Raise_kind=12, TryExcept_kind=13, TryFinally_kind=14,\n                  Assert_kind=15, Import_kind=16, ImportFrom_kind=17, Exec_kind=18, Global_kind=19,\n                  Expr_kind=20, Pass_kind=21, Break_kind=22, Continue_kind=23};\nstruct _stmt {\n        enum _stmt_kind kind;\n        union {\n                struct {\n                        identifier name;\n                        arguments_ty args;\n                        asdl_seq *body;\n                        asdl_seq *decorator_list;\n                        string type_comment;\n                } FunctionDef;\n                \n                struct {\n                        identifier name;\n                        asdl_seq *bases;\n                        asdl_seq *body;\n                        asdl_seq *decorator_list;\n                } ClassDef;\n                \n                struct {\n                        expr_ty value;\n                } Return;\n                \n                struct {\n                        asdl_seq *targets;\n                } Delete;\n                \n                struct {\n                        asdl_seq *targets;\n                        expr_ty value;\n                        string type_comment;\n                } Assign;\n                \n                struct {\n                        expr_ty target;\n                        operator_ty op;\n                        expr_ty value;\n                } AugAssign;\n                \n                struct {\n                        expr_ty dest;\n                        asdl_seq *values;\n                        bool nl;\n                } Print;\n                \n                struct {\n                        expr_ty target;\n                        expr_ty iter;\n                        asdl_seq *body;\n                        asdl_seq *orelse;\n                        string type_comment;\n                } For;\n                \n                struct {\n                        expr_ty test;\n                        asdl_seq *body;\n                        asdl_seq *orelse;\n                } While;\n                \n                struct {\n                        expr_ty test;\n                        asdl_seq *body;\n                        asdl_seq *orelse;\n                } If;\n                \n                struct {\n                        expr_ty context_expr;\n                        expr_ty optional_vars;\n                        asdl_seq *body;\n                        string type_comment;\n                } With;\n                \n                struct {\n                        expr_ty type;\n                        expr_ty inst;\n                        expr_ty tback;\n                } Raise;\n                \n                struct {\n                        asdl_seq *body;\n                        asdl_seq *handlers;\n                        asdl_seq *orelse;\n                } TryExcept;\n                \n                struct {\n                        asdl_seq *body;\n                        asdl_seq *finalbody;\n                } TryFinally;\n                \n                struct {\n                        expr_ty test;\n                        expr_ty msg;\n                } Assert;\n                \n                struct {\n                        asdl_seq *names;\n                } Import;\n                \n                struct {\n                        identifier module;\n                        asdl_seq *names;\n                        int level;\n                } ImportFrom;\n                \n                struct {\n                        expr_ty body;\n                        expr_ty globals;\n                        expr_ty locals;\n                } Exec;\n                \n                struct {\n                        asdl_seq *names;\n                } Global;\n                \n                struct {\n                        expr_ty value;\n                } Expr;\n                \n        } v;\n        int lineno;\n        int col_offset;\n};\n\nenum _expr_kind {BoolOp_kind=1, BinOp_kind=2, UnaryOp_kind=3, Lambda_kind=4, IfExp_kind=5,\n                  Dict_kind=6, Set_kind=7, ListComp_kind=8, SetComp_kind=9, DictComp_kind=10,\n                  GeneratorExp_kind=11, Yield_kind=12, Compare_kind=13, Call_kind=14, Repr_kind=15,\n                  Num_kind=16, Str_kind=17, Attribute_kind=18, Subscript_kind=19, Name_kind=20,\n                  List_kind=21, Tuple_kind=22};\nstruct _expr {\n        enum _expr_kind kind;\n        union {\n                struct {\n                        boolop_ty op;\n                        asdl_seq *values;\n                } BoolOp;\n                \n                struct {\n                        expr_ty left;\n                        operator_ty op;\n                        expr_ty right;\n                } BinOp;\n                \n                struct {\n                        unaryop_ty op;\n                        expr_ty operand;\n                } UnaryOp;\n                \n                struct {\n                        arguments_ty args;\n                        expr_ty body;\n                } Lambda;\n                \n                struct {\n                        expr_ty test;\n                        expr_ty body;\n                        expr_ty orelse;\n                } IfExp;\n                \n                struct {\n                        asdl_seq *keys;\n                        asdl_seq *values;\n                } Dict;\n                \n                struct {\n                        asdl_seq *elts;\n                } Set;\n                \n                struct {\n                        expr_ty elt;\n                        asdl_seq *generators;\n                } ListComp;\n                \n                struct {\n                        expr_ty elt;\n                        asdl_seq *generators;\n                } SetComp;\n                \n                struct {\n                        expr_ty key;\n                        expr_ty value;\n                        asdl_seq *generators;\n                } DictComp;\n                \n                struct {\n                        expr_ty elt;\n                        asdl_seq *generators;\n                } GeneratorExp;\n                \n                struct {\n                        expr_ty value;\n                } Yield;\n                \n                struct {\n                        expr_ty left;\n                        asdl_int_seq *ops;\n                        asdl_seq *comparators;\n                } Compare;\n                \n                struct {\n                        expr_ty func;\n                        asdl_seq *args;\n                        asdl_seq *keywords;\n                        expr_ty starargs;\n                        expr_ty kwargs;\n                } Call;\n                \n                struct {\n                        expr_ty value;\n                } Repr;\n                \n                struct {\n                        object n;\n                } Num;\n                \n                struct {\n                        string s;\n                        string kind;\n                } Str;\n                \n                struct {\n                        expr_ty value;\n                        identifier attr;\n                        expr_context_ty ctx;\n                } Attribute;\n                \n                struct {\n                        expr_ty value;\n                        slice_ty slice;\n                        expr_context_ty ctx;\n                } Subscript;\n                \n                struct {\n                        identifier id;\n                        expr_context_ty ctx;\n                } Name;\n                \n                struct {\n                        asdl_seq *elts;\n                        expr_context_ty ctx;\n                } List;\n                \n                struct {\n                        asdl_seq *elts;\n                        expr_context_ty ctx;\n                } Tuple;\n                \n        } v;\n        int lineno;\n        int col_offset;\n};\n\nenum _slice_kind {Ellipsis_kind=1, Slice_kind=2, ExtSlice_kind=3, Index_kind=4};\nstruct _slice {\n        enum _slice_kind kind;\n        union {\n                struct {\n                        expr_ty lower;\n                        expr_ty upper;\n                        expr_ty step;\n                } Slice;\n                \n                struct {\n                        asdl_seq *dims;\n                } ExtSlice;\n                \n                struct {\n                        expr_ty value;\n                } Index;\n                \n        } v;\n};\n\nstruct _comprehension {\n        expr_ty target;\n        expr_ty iter;\n        asdl_seq *ifs;\n};\n\nenum _excepthandler_kind {ExceptHandler_kind=1};\nstruct _excepthandler {\n        enum _excepthandler_kind kind;\n        union {\n                struct {\n                        expr_ty type;\n                        expr_ty name;\n                        asdl_seq *body;\n                } ExceptHandler;\n                \n        } v;\n        int lineno;\n        int col_offset;\n};\n\nstruct _arguments {\n        asdl_seq *args;\n        identifier vararg;\n        identifier kwarg;\n        asdl_seq *defaults;\n        asdl_seq *type_comments;\n};\n\nstruct _keyword {\n        identifier arg;\n        expr_ty value;\n};\n\nstruct _alias {\n        identifier name;\n        identifier asname;\n};\n\nenum _type_ignore_kind {TypeIgnore_kind=1};\nstruct _type_ignore {\n        enum _type_ignore_kind kind;\n        union {\n                struct {\n                        int lineno;\n                        string tag;\n                } TypeIgnore;\n                \n        } v;\n};\n\n\n#define Module(a0, a1, a2) _Ta27_Module(a0, a1, a2)\nmod_ty _Ta27_Module(asdl_seq * body, asdl_seq * type_ignores, PyArena *arena);\n#define Interactive(a0, a1) _Ta27_Interactive(a0, a1)\nmod_ty _Ta27_Interactive(asdl_seq * body, PyArena *arena);\n#define Expression(a0, a1) _Ta27_Expression(a0, a1)\nmod_ty _Ta27_Expression(expr_ty body, PyArena *arena);\n#define FunctionType(a0, a1, a2) _Ta27_FunctionType(a0, a1, a2)\nmod_ty _Ta27_FunctionType(asdl_seq * argtypes, expr_ty returns, PyArena *arena);\n#define Suite(a0, a1) _Ta27_Suite(a0, a1)\nmod_ty _Ta27_Suite(asdl_seq * body, PyArena *arena);\n#define FunctionDef(a0, a1, a2, a3, a4, a5, a6, a7) _Ta27_FunctionDef(a0, a1, a2, a3, a4, a5, a6, a7)\nstmt_ty _Ta27_FunctionDef(identifier name, arguments_ty args, asdl_seq * body, asdl_seq *\n                          decorator_list, string type_comment, int lineno, int col_offset, PyArena\n                          *arena);\n#define ClassDef(a0, a1, a2, a3, a4, a5, a6) _Ta27_ClassDef(a0, a1, a2, a3, a4, a5, a6)\nstmt_ty _Ta27_ClassDef(identifier name, asdl_seq * bases, asdl_seq * body, asdl_seq *\n                       decorator_list, int lineno, int col_offset, PyArena *arena);\n#define Return(a0, a1, a2, a3) _Ta27_Return(a0, a1, a2, a3)\nstmt_ty _Ta27_Return(expr_ty value, int lineno, int col_offset, PyArena *arena);\n#define Delete(a0, a1, a2, a3) _Ta27_Delete(a0, a1, a2, a3)\nstmt_ty _Ta27_Delete(asdl_seq * targets, int lineno, int col_offset, PyArena *arena);\n#define Assign(a0, a1, a2, a3, a4, a5) _Ta27_Assign(a0, a1, a2, a3, a4, a5)\nstmt_ty _Ta27_Assign(asdl_seq * targets, expr_ty value, string type_comment, int lineno, int\n                     col_offset, PyArena *arena);\n#define AugAssign(a0, a1, a2, a3, a4, a5) _Ta27_AugAssign(a0, a1, a2, a3, a4, a5)\nstmt_ty _Ta27_AugAssign(expr_ty target, operator_ty op, expr_ty value, int lineno, int col_offset,\n                        PyArena *arena);\n#define Print(a0, a1, a2, a3, a4, a5) _Ta27_Print(a0, a1, a2, a3, a4, a5)\nstmt_ty _Ta27_Print(expr_ty dest, asdl_seq * values, bool nl, int lineno, int col_offset, PyArena\n                    *arena);\n#define For(a0, a1, a2, a3, a4, a5, a6, a7) _Ta27_For(a0, a1, a2, a3, a4, a5, a6, a7)\nstmt_ty _Ta27_For(expr_ty target, expr_ty iter, asdl_seq * body, asdl_seq * orelse, string\n                  type_comment, int lineno, int col_offset, PyArena *arena);\n#define While(a0, a1, a2, a3, a4, a5) _Ta27_While(a0, a1, a2, a3, a4, a5)\nstmt_ty _Ta27_While(expr_ty test, asdl_seq * body, asdl_seq * orelse, int lineno, int col_offset,\n                    PyArena *arena);\n#define If(a0, a1, a2, a3, a4, a5) _Ta27_If(a0, a1, a2, a3, a4, a5)\nstmt_ty _Ta27_If(expr_ty test, asdl_seq * body, asdl_seq * orelse, int lineno, int col_offset,\n                 PyArena *arena);\n#define With(a0, a1, a2, a3, a4, a5, a6) _Ta27_With(a0, a1, a2, a3, a4, a5, a6)\nstmt_ty _Ta27_With(expr_ty context_expr, expr_ty optional_vars, asdl_seq * body, string\n                   type_comment, int lineno, int col_offset, PyArena *arena);\n#define Raise(a0, a1, a2, a3, a4, a5) _Ta27_Raise(a0, a1, a2, a3, a4, a5)\nstmt_ty _Ta27_Raise(expr_ty type, expr_ty inst, expr_ty tback, int lineno, int col_offset, PyArena\n                    *arena);\n#define TryExcept(a0, a1, a2, a3, a4, a5) _Ta27_TryExcept(a0, a1, a2, a3, a4, a5)\nstmt_ty _Ta27_TryExcept(asdl_seq * body, asdl_seq * handlers, asdl_seq * orelse, int lineno, int\n                        col_offset, PyArena *arena);\n#define TryFinally(a0, a1, a2, a3, a4) _Ta27_TryFinally(a0, a1, a2, a3, a4)\nstmt_ty _Ta27_TryFinally(asdl_seq * body, asdl_seq * finalbody, int lineno, int col_offset, PyArena\n                         *arena);\n#define Assert(a0, a1, a2, a3, a4) _Ta27_Assert(a0, a1, a2, a3, a4)\nstmt_ty _Ta27_Assert(expr_ty test, expr_ty msg, int lineno, int col_offset, PyArena *arena);\n#define Import(a0, a1, a2, a3) _Ta27_Import(a0, a1, a2, a3)\nstmt_ty _Ta27_Import(asdl_seq * names, int lineno, int col_offset, PyArena *arena);\n#define ImportFrom(a0, a1, a2, a3, a4, a5) _Ta27_ImportFrom(a0, a1, a2, a3, a4, a5)\nstmt_ty _Ta27_ImportFrom(identifier module, asdl_seq * names, int level, int lineno, int\n                         col_offset, PyArena *arena);\n#define Exec(a0, a1, a2, a3, a4, a5) _Ta27_Exec(a0, a1, a2, a3, a4, a5)\nstmt_ty _Ta27_Exec(expr_ty body, expr_ty globals, expr_ty locals, int lineno, int col_offset,\n                   PyArena *arena);\n#define Global(a0, a1, a2, a3) _Ta27_Global(a0, a1, a2, a3)\nstmt_ty _Ta27_Global(asdl_seq * names, int lineno, int col_offset, PyArena *arena);\n#define Expr(a0, a1, a2, a3) _Ta27_Expr(a0, a1, a2, a3)\nstmt_ty _Ta27_Expr(expr_ty value, int lineno, int col_offset, PyArena *arena);\n#define Pass(a0, a1, a2) _Ta27_Pass(a0, a1, a2)\nstmt_ty _Ta27_Pass(int lineno, int col_offset, PyArena *arena);\n#define Break(a0, a1, a2) _Ta27_Break(a0, a1, a2)\nstmt_ty _Ta27_Break(int lineno, int col_offset, PyArena *arena);\n#define Continue(a0, a1, a2) _Ta27_Continue(a0, a1, a2)\nstmt_ty _Ta27_Continue(int lineno, int col_offset, PyArena *arena);\n#define BoolOp(a0, a1, a2, a3, a4) _Ta27_BoolOp(a0, a1, a2, a3, a4)\nexpr_ty _Ta27_BoolOp(boolop_ty op, asdl_seq * values, int lineno, int col_offset, PyArena *arena);\n#define BinOp(a0, a1, a2, a3, a4, a5) _Ta27_BinOp(a0, a1, a2, a3, a4, a5)\nexpr_ty _Ta27_BinOp(expr_ty left, operator_ty op, expr_ty right, int lineno, int col_offset,\n                    PyArena *arena);\n#define UnaryOp(a0, a1, a2, a3, a4) _Ta27_UnaryOp(a0, a1, a2, a3, a4)\nexpr_ty _Ta27_UnaryOp(unaryop_ty op, expr_ty operand, int lineno, int col_offset, PyArena *arena);\n#define Lambda(a0, a1, a2, a3, a4) _Ta27_Lambda(a0, a1, a2, a3, a4)\nexpr_ty _Ta27_Lambda(arguments_ty args, expr_ty body, int lineno, int col_offset, PyArena *arena);\n#define IfExp(a0, a1, a2, a3, a4, a5) _Ta27_IfExp(a0, a1, a2, a3, a4, a5)\nexpr_ty _Ta27_IfExp(expr_ty test, expr_ty body, expr_ty orelse, int lineno, int col_offset, PyArena\n                    *arena);\n#define Dict(a0, a1, a2, a3, a4) _Ta27_Dict(a0, a1, a2, a3, a4)\nexpr_ty _Ta27_Dict(asdl_seq * keys, asdl_seq * values, int lineno, int col_offset, PyArena *arena);\n#define Set(a0, a1, a2, a3) _Ta27_Set(a0, a1, a2, a3)\nexpr_ty _Ta27_Set(asdl_seq * elts, int lineno, int col_offset, PyArena *arena);\n#define ListComp(a0, a1, a2, a3, a4) _Ta27_ListComp(a0, a1, a2, a3, a4)\nexpr_ty _Ta27_ListComp(expr_ty elt, asdl_seq * generators, int lineno, int col_offset, PyArena\n                       *arena);\n#define SetComp(a0, a1, a2, a3, a4) _Ta27_SetComp(a0, a1, a2, a3, a4)\nexpr_ty _Ta27_SetComp(expr_ty elt, asdl_seq * generators, int lineno, int col_offset, PyArena\n                      *arena);\n#define DictComp(a0, a1, a2, a3, a4, a5) _Ta27_DictComp(a0, a1, a2, a3, a4, a5)\nexpr_ty _Ta27_DictComp(expr_ty key, expr_ty value, asdl_seq * generators, int lineno, int\n                       col_offset, PyArena *arena);\n#define GeneratorExp(a0, a1, a2, a3, a4) _Ta27_GeneratorExp(a0, a1, a2, a3, a4)\nexpr_ty _Ta27_GeneratorExp(expr_ty elt, asdl_seq * generators, int lineno, int col_offset, PyArena\n                           *arena);\n#define Yield(a0, a1, a2, a3) _Ta27_Yield(a0, a1, a2, a3)\nexpr_ty _Ta27_Yield(expr_ty value, int lineno, int col_offset, PyArena *arena);\n#define Compare(a0, a1, a2, a3, a4, a5) _Ta27_Compare(a0, a1, a2, a3, a4, a5)\nexpr_ty _Ta27_Compare(expr_ty left, asdl_int_seq * ops, asdl_seq * comparators, int lineno, int\n                      col_offset, PyArena *arena);\n#define Call(a0, a1, a2, a3, a4, a5, a6, a7) _Ta27_Call(a0, a1, a2, a3, a4, a5, a6, a7)\nexpr_ty _Ta27_Call(expr_ty func, asdl_seq * args, asdl_seq * keywords, expr_ty starargs, expr_ty\n                   kwargs, int lineno, int col_offset, PyArena *arena);\n#define Repr(a0, a1, a2, a3) _Ta27_Repr(a0, a1, a2, a3)\nexpr_ty _Ta27_Repr(expr_ty value, int lineno, int col_offset, PyArena *arena);\n#define Num(a0, a1, a2, a3) _Ta27_Num(a0, a1, a2, a3)\nexpr_ty _Ta27_Num(object n, int lineno, int col_offset, PyArena *arena);\n#define Str(a0, a1, a2, a3, a4) _Ta27_Str(a0, a1, a2, a3, a4)\nexpr_ty _Ta27_Str(string s, string kind, int lineno, int col_offset, PyArena *arena);\n#define Attribute(a0, a1, a2, a3, a4, a5) _Ta27_Attribute(a0, a1, a2, a3, a4, a5)\nexpr_ty _Ta27_Attribute(expr_ty value, identifier attr, expr_context_ty ctx, int lineno, int\n                        col_offset, PyArena *arena);\n#define Subscript(a0, a1, a2, a3, a4, a5) _Ta27_Subscript(a0, a1, a2, a3, a4, a5)\nexpr_ty _Ta27_Subscript(expr_ty value, slice_ty slice, expr_context_ty ctx, int lineno, int\n                        col_offset, PyArena *arena);\n#define Name(a0, a1, a2, a3, a4) _Ta27_Name(a0, a1, a2, a3, a4)\nexpr_ty _Ta27_Name(identifier id, expr_context_ty ctx, int lineno, int col_offset, PyArena *arena);\n#define List(a0, a1, a2, a3, a4) _Ta27_List(a0, a1, a2, a3, a4)\nexpr_ty _Ta27_List(asdl_seq * elts, expr_context_ty ctx, int lineno, int col_offset, PyArena\n                   *arena);\n#define Tuple(a0, a1, a2, a3, a4) _Ta27_Tuple(a0, a1, a2, a3, a4)\nexpr_ty _Ta27_Tuple(asdl_seq * elts, expr_context_ty ctx, int lineno, int col_offset, PyArena\n                    *arena);\n#define Ellipsis(a0) _Ta27_Ellipsis(a0)\nslice_ty _Ta27_Ellipsis(PyArena *arena);\n#define Slice(a0, a1, a2, a3) _Ta27_Slice(a0, a1, a2, a3)\nslice_ty _Ta27_Slice(expr_ty lower, expr_ty upper, expr_ty step, PyArena *arena);\n#define ExtSlice(a0, a1) _Ta27_ExtSlice(a0, a1)\nslice_ty _Ta27_ExtSlice(asdl_seq * dims, PyArena *arena);\n#define Index(a0, a1) _Ta27_Index(a0, a1)\nslice_ty _Ta27_Index(expr_ty value, PyArena *arena);\n#define comprehension(a0, a1, a2, a3) _Ta27_comprehension(a0, a1, a2, a3)\ncomprehension_ty _Ta27_comprehension(expr_ty target, expr_ty iter, asdl_seq * ifs, PyArena *arena);\n#define ExceptHandler(a0, a1, a2, a3, a4, a5) _Ta27_ExceptHandler(a0, a1, a2, a3, a4, a5)\nexcepthandler_ty _Ta27_ExceptHandler(expr_ty type, expr_ty name, asdl_seq * body, int lineno, int\n                                     col_offset, PyArena *arena);\n#define arguments(a0, a1, a2, a3, a4, a5) _Ta27_arguments(a0, a1, a2, a3, a4, a5)\narguments_ty _Ta27_arguments(asdl_seq * args, identifier vararg, identifier kwarg, asdl_seq *\n                             defaults, asdl_seq * type_comments, PyArena *arena);\n#define keyword(a0, a1, a2) _Ta27_keyword(a0, a1, a2)\nkeyword_ty _Ta27_keyword(identifier arg, expr_ty value, PyArena *arena);\n#define alias(a0, a1, a2) _Ta27_alias(a0, a1, a2)\nalias_ty _Ta27_alias(identifier name, identifier asname, PyArena *arena);\n#define TypeIgnore(a0, a1, a2) _Ta27_TypeIgnore(a0, a1, a2)\ntype_ignore_ty _Ta27_TypeIgnore(int lineno, string tag, PyArena *arena);\n\nPyObject* Ta27AST_mod2obj(mod_ty t);\nmod_ty Ta27AST_obj2mod(PyObject* ast, PyArena* arena, int mode);\nint Ta27AST_Check(PyObject* obj);\n"
  },
  {
    "path": "ast27/Include/asdl.h",
    "content": "#ifndef Ta27_ASDL_H\n#define Ta27_ASDL_H\n\n#include \"../Include/pyarena.h\"\n\ntypedef PyObject * identifier;\ntypedef PyObject * string;\ntypedef PyObject * object;\n\n#ifndef __cplusplus\n#ifndef __bool_true_false_are_defined\ntypedef enum {false, true} bool;\n#endif\n#endif\n\n/* It would be nice if the code generated by asdl_c.py was completely\n   independent of Python, but it is a goal the requires too much work\n   at this stage.  So, for example, I'll represent identifiers as\n   interned Python strings.\n*/\n\n/* XXX A sequence should be typed so that its use can be typechecked. */\n\ntypedef struct {\n    int size;\n    void *elements[1];\n} asdl_seq;\n\ntypedef struct {\n    int size;\n    int elements[1];\n} asdl_int_seq;\n\n#define asdl_seq_new _Ta27_asdl_seq_new\n#define asdl_int_seq_new _Ta27_asdl_int_seq_new\nasdl_seq *asdl_seq_new(Py_ssize_t size, PyArena *arena);\nasdl_int_seq *asdl_int_seq_new(Py_ssize_t size, PyArena *arena);\n\n#define asdl_seq_GET(S, I) (S)->elements[(I)]\n#define asdl_seq_LEN(S) ((S) == NULL ? 0 : (S)->size)\n#ifdef Py_DEBUG\n#define asdl_seq_SET(S, I, V) { \\\n        int _asdl_i = (I); \\\n        assert((S) && _asdl_i < (S)->size); \\\n        (S)->elements[_asdl_i] = (V); \\\n}\n#else\n#define asdl_seq_SET(S, I, V) (S)->elements[I] = (V)\n#endif\n\n#endif /* !Ta27_ASDL_H */\n"
  },
  {
    "path": "ast27/Include/ast.h",
    "content": "#ifndef Ta27_AST_H\n#define Ta27_AST_H\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\nmod_ty Ta27AST_FromNode(const node *, PyCompilerFlags *flags,\n\t\t\t\t  const char *, PyArena *);\n\n#ifdef __cplusplus\n}\n#endif\n#endif /* !Ta27_AST_H */\n"
  },
  {
    "path": "ast27/Include/bitset.h",
    "content": "\n#ifndef Ta27_BITSET_H\n#define Ta27_BITSET_H\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n/* Bitset interface */\n\n#define BYTE\t\tchar\n\ntypedef BYTE *bitset;\n\nbitset newbitset(int nbits);\nvoid delbitset(bitset bs);\n#define testbit(ss, ibit) (((ss)[BIT2BYTE(ibit)] & BIT2MASK(ibit)) != 0)\nint addbit(bitset bs, int ibit); /* Returns 0 if already set */\nint samebitset(bitset bs1, bitset bs2, int nbits);\nvoid mergebitset(bitset bs1, bitset bs2, int nbits);\n\n#define BITSPERBYTE\t(8*sizeof(BYTE))\n#define NBYTES(nbits)\t(((nbits) + BITSPERBYTE - 1) / BITSPERBYTE)\n\n#define BIT2BYTE(ibit)\t((ibit) / BITSPERBYTE)\n#define BIT2SHIFT(ibit)\t((ibit) % BITSPERBYTE)\n#define BIT2MASK(ibit)\t(1 << BIT2SHIFT(ibit))\n#define BYTE2BIT(ibyte)\t((ibyte) * BITSPERBYTE)\n\n#ifdef __cplusplus\n}\n#endif\n#endif /* !Ta27_BITSET_H */\n"
  },
  {
    "path": "ast27/Include/compile.h",
    "content": "\n#ifndef Ta27_COMPILE_H\n#define Ta27_COMPILE_H\n\n#include \"Python.h\"\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n/* Public interface */\nPyAPI_FUNC(PyFutureFeatures *) PyFuture_FromAST(struct _mod *, const char *);\n\n\n#ifdef __cplusplus\n}\n#endif\n#endif /* !Ta27_COMPILE_H */\n"
  },
  {
    "path": "ast27/Include/errcode.h",
    "content": "#ifndef Ta27_ERRCODE_H\n#define Ta27_ERRCODE_H\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n\n/* Error codes passed around between file input, tokenizer, parser and\n   interpreter.  This is necessary so we can turn them into Python\n   exceptions at a higher level.  Note that some errors have a\n   slightly different meaning when passed from the tokenizer to the\n   parser than when passed from the parser to the interpreter; e.g.\n   the parser only returns E_EOF when it hits EOF immediately, and it\n   never returns E_OK. */\n\n#define E_OK\t\t10\t/* No error */\n#define E_EOF\t\t11\t/* End Of File */\n#define E_INTR\t\t12\t/* Interrupted */\n#define E_TOKEN\t\t13\t/* Bad token */\n#define E_SYNTAX\t14\t/* Syntax error */\n#define E_NOMEM\t\t15\t/* Ran out of memory */\n#define E_DONE\t\t16\t/* Parsing complete */\n#define E_ERROR\t\t17\t/* Execution error */\n#define E_TABSPACE\t18\t/* Inconsistent mixing of tabs and spaces */\n#define E_OVERFLOW      19\t/* Node had too many children */\n#define E_TOODEEP\t20\t/* Too many indentation levels */\n#define E_DEDENT\t21\t/* No matching outer block for dedent */\n#define E_DECODE\t22\t/* Error in decoding into Unicode */\n#define E_EOFS\t\t23\t/* EOF in triple-quoted string */\n#define E_EOLS\t\t24\t/* EOL in single-quoted string */\n#define E_LINECONT\t25\t/* Unexpected characters after a line continuation */\n\n#ifdef __cplusplus\n}\n#endif\n#endif /* !Ta27_ERRCODE_H */\n"
  },
  {
    "path": "ast27/Include/graminit.h",
    "content": "/* Generated by Parser/pgen */\n\n#define single_input 256\n#define file_input 257\n#define eval_input 258\n#define decorator 259\n#define decorators 260\n#define decorated 261\n#define funcdef 262\n#define parameters 263\n#define varargslist 264\n#define fpdef 265\n#define fplist 266\n#define stmt 267\n#define simple_stmt 268\n#define small_stmt 269\n#define expr_stmt 270\n#define augassign 271\n#define print_stmt 272\n#define del_stmt 273\n#define pass_stmt 274\n#define flow_stmt 275\n#define break_stmt 276\n#define continue_stmt 277\n#define return_stmt 278\n#define yield_stmt 279\n#define raise_stmt 280\n#define import_stmt 281\n#define import_name 282\n#define import_from 283\n#define import_as_name 284\n#define dotted_as_name 285\n#define import_as_names 286\n#define dotted_as_names 287\n#define dotted_name 288\n#define global_stmt 289\n#define exec_stmt 290\n#define assert_stmt 291\n#define compound_stmt 292\n#define if_stmt 293\n#define while_stmt 294\n#define for_stmt 295\n#define try_stmt 296\n#define with_stmt 297\n#define with_item 298\n#define except_clause 299\n#define suite 300\n#define testlist_safe 301\n#define old_test 302\n#define old_lambdef 303\n#define test 304\n#define or_test 305\n#define and_test 306\n#define not_test 307\n#define comparison 308\n#define comp_op 309\n#define expr 310\n#define xor_expr 311\n#define and_expr 312\n#define shift_expr 313\n#define arith_expr 314\n#define term 315\n#define factor 316\n#define power 317\n#define atom 318\n#define listmaker 319\n#define testlist_comp 320\n#define lambdef 321\n#define trailer 322\n#define subscriptlist 323\n#define subscript 324\n#define sliceop 325\n#define exprlist 326\n#define testlist 327\n#define dictorsetmaker 328\n#define classdef 329\n#define arglist 330\n#define argument 331\n#define list_iter 332\n#define list_for 333\n#define list_if 334\n#define comp_iter 335\n#define comp_for 336\n#define comp_if 337\n#define testlist1 338\n#define encoding_decl 339\n#define yield_expr 340\n#define func_type_input 341\n#define func_type 342\n#define typelist 343\n"
  },
  {
    "path": "ast27/Include/grammar.h",
    "content": "\n/* Grammar interface */\n\n#ifndef Ta27_GRAMMAR_H\n#define Ta27_GRAMMAR_H\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n#include \"../Include/bitset.h\"\n\n/* A label of an arc */\n\ntypedef struct {\n    int\t\t lb_type;\n    char\t*lb_str;\n} label;\n\n#define EMPTY 0\t\t/* Label number 0 is by definition the empty label */\n\n/* A list of labels */\n\ntypedef struct {\n    int\t\t ll_nlabels;\n    label\t*ll_label;\n} labellist;\n\n/* An arc from one state to another */\n\ntypedef struct {\n    short\ta_lbl;\t\t/* Label of this arc */\n    short\ta_arrow;\t/* State where this arc goes to */\n} arc;\n\n/* A state in a DFA */\n\ntypedef struct {\n    int\t\t s_narcs;\n    arc\t\t*s_arc;\t\t/* Array of arcs */\n\t\n    /* Optional accelerators */\n    int\t\t s_lower;\t/* Lowest label index */\n    int\t\t s_upper;\t/* Highest label index */\n    int\t\t*s_accel;\t/* Accelerator */\n    int\t\t s_accept;\t/* Nonzero for accepting state */\n} state;\n\n/* A DFA */\n\ntypedef struct {\n    int\t\t d_type;\t/* Non-terminal this represents */\n    char\t*d_name;\t/* For printing */\n    int\t\t d_initial;\t/* Initial state */\n    int\t\t d_nstates;\n    state\t*d_state;\t/* Array of states */\n    bitset\t d_first;\n} dfa;\n\n/* A grammar */\n\ntypedef struct {\n    int\t\t g_ndfas;\n    dfa\t\t*g_dfa;\t\t/* Array of DFAs */\n    labellist\t g_ll;\n    int\t\t g_start;\t/* Start symbol of the grammar */\n    int\t\t g_accel;\t/* Set if accelerators present */\n} grammar;\n\n/* FUNCTIONS */\n\ngrammar *newgrammar(int start);\ndfa *adddfa(grammar *g, int type, char *name);\nint addstate(dfa *d);\nvoid addarc(dfa *d, int from, int to, int lbl);\ndfa *Ta27Grammar_FindDFA(grammar *g, int type);\n\nint addlabel(labellist *ll, int type, char *str);\nint findlabel(labellist *ll, int type, char *str);\nchar *Ta27Grammar_LabelRepr(label *lb);\nvoid translatelabels(grammar *g);\n\nvoid addfirstsets(grammar *g);\n\nvoid Ta27Grammar_AddAccelerators(grammar *g);\nvoid Ta27Grammar_RemoveAccelerators(grammar *);\n\nvoid printgrammar(grammar *g, FILE *fp);\nvoid printnonterminals(grammar *g, FILE *fp);\n\n#ifdef __cplusplus\n}\n#endif\n#endif /* !Ta27_GRAMMAR_H */\n"
  },
  {
    "path": "ast27/Include/node.h",
    "content": "\n/* Parse tree node interface */\n\n#ifndef Ta27_NODE_H\n#define Ta27_NODE_H\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\ntypedef struct _node {\n    short\t\tn_type;\n    char\t\t*n_str;\n    int\t\t\tn_lineno;\n    int\t\t\tn_col_offset;\n    int\t\t\tn_nchildren;\n    struct _node\t*n_child;\n} node;\n\nnode *Ta27Node_New(int type);\nint Ta27Node_AddChild(node *n, int type,\n                      char *str, int lineno, int col_offset);\nvoid Ta27Node_Free(node *n);\nPy_ssize_t _Ta27Node_SizeOf(node *n);\n\n/* Node access functions */\n#define NCH(n)\t\t((n)->n_nchildren)\n\t\n#define CHILD(n, i)\t(&(n)->n_child[i])\n#define RCHILD(n, i)\t(CHILD(n, NCH(n) + i))\n#define TYPE(n)\t\t((n)->n_type)\n#define STR(n)\t\t((n)->n_str)\n\n/* Assert that the type of a node is what we expect */\n#define REQ(n, type) assert(TYPE(n) == (type))\n\nPyAPI_FUNC(void) PyNode_ListTree(node *);\n\n#ifdef __cplusplus\n}\n#endif\n#endif /* !Ta27_NODE_H */\n"
  },
  {
    "path": "ast27/Include/parsetok.h",
    "content": "\n/* Parser-tokenizer link interface */\n\n#ifndef Ta27_PARSETOK_H\n#define Ta27_PARSETOK_H\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\ntypedef struct {\n    int error;\n    PyObject *filename;\n    int lineno;\n    int offset;\n    char *text;\n    int token;\n    int expected;\n} perrdetail;\n\n#if 0\n#define PyPARSE_YIELD_IS_KEYWORD\t0x0001\n#endif\n\n#define PyPARSE_DONT_IMPLY_DEDENT\t0x0002\n\n#if 0\n#define PyPARSE_WITH_IS_KEYWORD\t\t0x0003\n#endif\n\n#define PyPARSE_PRINT_IS_FUNCTION       0x0004\n#define PyPARSE_UNICODE_LITERALS        0x0008\n\n#define PyPARSE_IGNORE_COOKIE 0x0010\n\n\nnode *Ta27Parser_ParseString(const char *, grammar *, int,\n                             perrdetail *);\nnode *Ta27Parser_ParseFile (FILE *, const char *, grammar *, int,\n                            char *, char *, perrdetail *);\n\nnode *Ta27Parser_ParseStringFlags(const char *, grammar *, int,\n                                  perrdetail *, int);\nnode *Ta27Parser_ParseFileFlags(FILE *, const char *, grammar *,\n       \t\t\t int, char *, char *,\n       \t\t\t perrdetail *, int);\nnode *Ta27Parser_ParseFileFlagsEx(FILE *, const char *, grammar *,\n       \t\t\t int, char *, char *,\n       \t\t\t perrdetail *, int *);\n\nnode *Ta27Parser_ParseStringFlagsFilename(const char *,\n       \t\t      const char *,\n       \t\t      grammar *, int,\n                perrdetail *, int);\nnode *Ta27Parser_ParseStringFlagsFilenameEx(const char *,\n\t\t\t\t\t      const char *,\n\t\t\t\t\t      grammar *, int,\n                                              perrdetail *, int *);\n\nnode *Ta27Parser_ParseStringObject(\n    const char *s,\n    PyObject *filename,\n    grammar *g,\n    int start,\n    perrdetail *err_ret,\n    int *flags);\n\n/* Note that he following function is defined in pythonrun.c not parsetok.c. */\nPyAPI_FUNC(void) PyParser_SetError(perrdetail *);\n\n#ifdef __cplusplus\n}\n#endif\n#endif /* !Ta27_PARSETOK_H */\n"
  },
  {
    "path": "ast27/Include/pgenheaders.h",
    "content": "#ifndef DUMMY_Py_PGENHEADERS_H\n#define DUMMY_Py_PGENHEADERS_H\n\n/* pgenheaders.h is included by a bunch of files but nothing in it is\n * used except for the Python.h import, and it was removed in Python\n * 3.8. Since some of those files are generated we provide a dummy\n * pgenheaders.h. */\n#include \"Python.h\"\n\n#endif /* !DUMMY_Py_PGENHEADERS_H */\n"
  },
  {
    "path": "ast27/Include/pyarena.h",
    "content": "/* An arena-like memory interface for the compiler.\n */\n\n#ifndef Ta27_PYARENA_H\n#define Ta27_PYARENA_H\n\n#if PY_MINOR_VERSION >= 10\n#include \"../Include/pycore_pyarena.h\"\n\n#define PyArena_New _PyArena_New\n#define PyArena_Free _PyArena_Free\n#define PyArena_Malloc _PyArena_Malloc\n#define PyArena_AddPyObject _PyArena_AddPyObject\n#endif\n\n#endif /* !Ta27_PYARENA_H */\n"
  },
  {
    "path": "ast27/Include/pycore_pyarena.h",
    "content": "/* An arena-like memory interface for the compiler.\n */\n\n#ifndef Ta27_INTERNAL_PYARENA_H\n#define Ta27_INTERNAL_PYARENA_H\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\ntypedef struct _arena PyArena;\n\n/* _PyArena_New() and _PyArena_Free() create a new arena and free it,\n   respectively.  Once an arena has been created, it can be used\n   to allocate memory via _PyArena_Malloc().  Pointers to PyObject can\n   also be registered with the arena via _PyArena_AddPyObject(), and the\n   arena will ensure that the PyObjects stay alive at least until\n   _PyArena_Free() is called.  When an arena is freed, all the memory it\n   allocated is freed, the arena releases internal references to registered\n   PyObject*, and none of its pointers are valid.\n   XXX (tim) What does \"none of its pointers are valid\" mean?  Does it\n   XXX mean that pointers previously obtained via _PyArena_Malloc() are\n   XXX no longer valid?  (That's clearly true, but not sure that's what\n   XXX the text is trying to say.)\n\n   _PyArena_New() returns an arena pointer.  On error, it\n   returns a negative number and sets an exception.\n   XXX (tim):  Not true.  On error, _PyArena_New() actually returns NULL,\n   XXX and looks like it may or may not set an exception (e.g., if the\n   XXX internal PyList_New(0) returns NULL, _PyArena_New() passes that on\n   XXX and an exception is set; OTOH, if the internal\n   XXX block_new(DEFAULT_BLOCK_SIZE) returns NULL, that's passed on but\n   XXX an exception is not set in that case).\n*/\nPyAPI_FUNC(PyArena*) _PyArena_New(void);\nPyAPI_FUNC(void) _PyArena_Free(PyArena *);\n\n/* Mostly like malloc(), return the address of a block of memory spanning\n * `size` bytes, or return NULL (without setting an exception) if enough\n * new memory can't be obtained.  Unlike malloc(0), _PyArena_Malloc() with\n * size=0 does not guarantee to return a unique pointer (the pointer\n * returned may equal one or more other pointers obtained from\n * _PyArena_Malloc()).\n * Note that pointers obtained via _PyArena_Malloc() must never be passed to\n * the system free() or realloc(), or to any of Python's similar memory-\n * management functions.  _PyArena_Malloc()-obtained pointers remain valid\n * until _PyArena_Free(ar) is called, at which point all pointers obtained\n * from the arena `ar` become invalid simultaneously.\n */\nPyAPI_FUNC(void*) _PyArena_Malloc(PyArena *, size_t size);\n\n/* This routine isn't a proper arena allocation routine.  It takes\n * a PyObject* and records it so that it can be DECREFed when the\n * arena is freed.\n */\nPyAPI_FUNC(int) _PyArena_AddPyObject(PyArena *, PyObject *);\n\n#ifdef __cplusplus\n}\n#endif\n#endif /* !Ta27_INTERNAL_PYARENA_H */\n"
  },
  {
    "path": "ast27/Include/token.h",
    "content": "\n/* Token types */\n\n#ifndef Ta27_TOKEN_H\n#define Ta27_TOKEN_H\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n#undef TILDE   /* Prevent clash of our definition with system macro. Ex AIX, ioctl.h */\n\n#define ENDMARKER\t0\n#define NAME\t\t1\n#define NUMBER\t\t2\n#define STRING\t\t3\n#define NEWLINE\t\t4\n#define INDENT\t\t5\n#define DEDENT\t\t6\n#define LPAR\t\t7\n#define RPAR\t\t8\n#define LSQB\t\t9\n#define RSQB\t\t10\n#define COLON\t\t11\n#define COMMA\t\t12\n#define SEMI\t\t13\n#define PLUS\t\t14\n#define MINUS\t\t15\n#define STAR\t\t16\n#define SLASH\t\t17\n#define VBAR\t\t18\n#define AMPER\t\t19\n#define LESS\t\t20\n#define GREATER\t\t21\n#define EQUAL\t\t22\n#define DOT\t\t23\n#define PERCENT\t\t24\n#define BACKQUOTE\t25\n#define LBRACE\t\t26\n#define RBRACE\t\t27\n#define EQEQUAL\t\t28\n#define NOTEQUAL\t29\n#define LESSEQUAL\t30\n#define GREATEREQUAL\t31\n#define TILDE\t\t32\n#define CIRCUMFLEX\t33\n#define LEFTSHIFT\t34\n#define RIGHTSHIFT\t35\n#define DOUBLESTAR\t36\n#define PLUSEQUAL\t37\n#define MINEQUAL\t38\n#define STAREQUAL\t39\n#define SLASHEQUAL\t40\n#define PERCENTEQUAL\t41\n#define AMPEREQUAL\t42\n#define VBAREQUAL\t43\n#define CIRCUMFLEXEQUAL\t44\n#define LEFTSHIFTEQUAL\t45\n#define RIGHTSHIFTEQUAL\t46\n#define DOUBLESTAREQUAL\t47\n#define DOUBLESLASH\t48\n#define DOUBLESLASHEQUAL 49\n#define AT              50\t\n/* Don't forget to update the table _Ta27Parser_TokenNames in tokenizer.c! */\n#define OP\t\t51\n#define RARROW          52\n#define TYPE_IGNORE\t53\n#define TYPE_COMMENT\t54\n#define ERRORTOKEN\t55\n#define N_TOKENS\t56\n\n/* Special definitions for cooperation with parser */\n\n#define NT_OFFSET\t\t256\n\n#define ISTERMINAL(x)\t\t((x) < NT_OFFSET)\n#define ISNONTERMINAL(x)\t((x) >= NT_OFFSET)\n#define ISEOF(x)\t\t((x) == ENDMARKER)\n\n\nextern char *_Ta27Parser_TokenNames[]; /* Token names */\nint Ta27Token_OneChar(int);\nint Ta27Token_TwoChars(int, int);\nint Ta27Token_ThreeChars(int, int, int);\n\n#ifdef __cplusplus\n}\n#endif\n#endif /* !Ta27_TOKEN_H */\n"
  },
  {
    "path": "ast27/Parser/Python.asdl",
    "content": "-- ASDL's five builtin types are identifier, int, string, object, bool\n\nmodule Python version \"$Revision$\"\n{\n\tmod = Module(stmt* body, type_ignore *type_ignores)\n\t    | Interactive(stmt* body)\n\t    | Expression(expr body)\n      | FunctionType(expr* argtypes, expr returns)\n\n\t    -- not really an actual node but useful in Jython's typesystem.\n\t    | Suite(stmt* body)\n\n\tstmt = FunctionDef(identifier name, arguments args,\n                            stmt* body, expr* decorator_list, string? type_comment)\n\t      | ClassDef(identifier name, expr* bases, stmt* body, expr* decorator_list)\n\t      | Return(expr? value)\n\n\t      | Delete(expr* targets)\n\t      | Assign(expr* targets, expr value, string? type_comment)\n\t      | AugAssign(expr target, operator op, expr value)\n\n\t      -- not sure if bool is allowed, can always use int\n \t      | Print(expr? dest, expr* values, bool nl)\n\n\t      -- use 'orelse' because else is a keyword in target languages\n\t      | For(expr target, expr iter, stmt* body, stmt* orelse, string? type_comment)\n\t      | While(expr test, stmt* body, stmt* orelse)\n\t      | If(expr test, stmt* body, stmt* orelse)\n\t      | With(expr context_expr, expr? optional_vars, stmt* body, string? type_comment)\n\n\t      -- 'type' is a bad name\n\t      | Raise(expr? type, expr? inst, expr? tback)\n\t      | TryExcept(stmt* body, excepthandler* handlers, stmt* orelse)\n\t      | TryFinally(stmt* body, stmt* finalbody)\n\t      | Assert(expr test, expr? msg)\n\n\t      | Import(alias* names)\n\t      | ImportFrom(identifier? module, alias* names, int? level)\n\n\t      -- Doesn't capture requirement that locals must be\n\t      -- defined if globals is\n\t      -- still supports use as a function!\n\t      | Exec(expr body, expr? globals, expr? locals)\n\n\t      | Global(identifier* names)\n\t      | Expr(expr value)\n\t      | Pass | Break | Continue\n\n\t      -- XXX Jython will be different\n\t      -- col_offset is the byte offset in the utf8 string the parser uses\n\t      attributes (int lineno, int col_offset)\n\n\t      -- BoolOp() can use left & right?\n\texpr = BoolOp(boolop op, expr* values)\n\t     | BinOp(expr left, operator op, expr right)\n\t     | UnaryOp(unaryop op, expr operand)\n\t     | Lambda(arguments args, expr body)\n\t     | IfExp(expr test, expr body, expr orelse)\n\t     | Dict(expr* keys, expr* values)\n\t     | Set(expr* elts)\n\t     | ListComp(expr elt, comprehension* generators)\n\t     | SetComp(expr elt, comprehension* generators)\n\t     | DictComp(expr key, expr value, comprehension* generators)\n\t     | GeneratorExp(expr elt, comprehension* generators)\n\t     -- the grammar constrains where yield expressions can occur\n\t     | Yield(expr? value)\n\t     -- need sequences for compare to distinguish between\n\t     -- x < 4 < 3 and (x < 4) < 3\n\t     | Compare(expr left, cmpop* ops, expr* comparators)\n\t     | Call(expr func, expr* args, keyword* keywords,\n\t\t\t expr? starargs, expr? kwargs)\n\t     | Repr(expr value)\n\t     | Num(object n) -- a number as a PyObject.\n\t     | Str(string s, string kind)\n\t     -- other literals? bools?\n\n\t     -- the following expression can appear in assignment context\n\t     | Attribute(expr value, identifier attr, expr_context ctx)\n\t     | Subscript(expr value, slice slice, expr_context ctx)\n\t     | Name(identifier id, expr_context ctx)\n\t     | List(expr* elts, expr_context ctx)\n\t     | Tuple(expr* elts, expr_context ctx)\n\n\t      -- col_offset is the byte offset in the utf8 string the parser uses\n\t      attributes (int lineno, int col_offset)\n\n\texpr_context = Load | Store | Del | AugLoad | AugStore | Param\n\n\tslice = Ellipsis | Slice(expr? lower, expr? upper, expr? step)\n\t      | ExtSlice(slice* dims)\n\t      | Index(expr value)\n\n\tboolop = And | Or\n\n\toperator = Add | Sub | Mult | Div | Mod | Pow | LShift\n                 | RShift | BitOr | BitXor | BitAnd | FloorDiv\n\n\tunaryop = Invert | Not | UAdd | USub\n\n\tcmpop = Eq | NotEq | Lt | LtE | Gt | GtE | Is | IsNot | In | NotIn\n\n\tcomprehension = (expr target, expr iter, expr* ifs)\n\n\t-- not sure what to call the first argument for raise and except\n\texcepthandler = ExceptHandler(expr? type, expr? name, stmt* body)\n\t                attributes (int lineno, int col_offset)\n\n\t-- type_comments is used to support the per-argument type comment syntax.\n\t-- It is either an empty list or a list with length equal to the number of\n\t-- args (including varargs and kwargs, if present) and with members set to the\n\t-- string of each arg's type comment, if present, or None otherwise.\n\targuments = (expr* args, identifier? vararg,\n\t\t     identifier? kwarg, expr* defaults, string* type_comments)\n\n        -- keyword arguments supplied to call\n        keyword = (identifier arg, expr value)\n\n        -- import name with optional 'as' alias.\n        alias = (identifier name, identifier? asname)\n\n  type_ignore = TypeIgnore(int lineno, string tag)\n}\n"
  },
  {
    "path": "ast27/Parser/acceler.c",
    "content": "\n/* Parser accelerator module */\n\n/* The parser as originally conceived had disappointing performance.\n   This module does some precomputation that speeds up the selection\n   of a DFA based upon a token, turning a search through an array\n   into a simple indexing operation.  The parser now cannot work\n   without the accelerators installed.  Note that the accelerators\n   are installed dynamically when the parser is initialized, they\n   are not part of the static data structure written on graminit.[ch]\n   by the parser generator. */\n\n#include \"../Include/pgenheaders.h\"\n#include \"../Include/grammar.h\"\n#include \"../Include/node.h\"\n#include \"../Include/token.h\"\n#include \"parser.h\"\n\n/* Forward references */\nstatic void fixdfa(grammar *, dfa *);\nstatic void fixstate(grammar *, state *);\n\nvoid\nTa27Grammar_AddAccelerators(grammar *g)\n{\n    dfa *d;\n    int i;\n    d = g->g_dfa;\n    for (i = g->g_ndfas; --i >= 0; d++)\n        fixdfa(g, d);\n    g->g_accel = 1;\n}\n\nvoid\nTa27Grammar_RemoveAccelerators(grammar *g)\n{\n    dfa *d;\n    int i;\n    g->g_accel = 0;\n    d = g->g_dfa;\n    for (i = g->g_ndfas; --i >= 0; d++) {\n        state *s;\n        int j;\n        s = d->d_state;\n        for (j = 0; j < d->d_nstates; j++, s++) {\n            if (s->s_accel)\n                PyObject_FREE(s->s_accel);\n            s->s_accel = NULL;\n        }\n    }\n}\n\nstatic void\nfixdfa(grammar *g, dfa *d)\n{\n    state *s;\n    int j;\n    s = d->d_state;\n    for (j = 0; j < d->d_nstates; j++, s++)\n        fixstate(g, s);\n}\n\nstatic void\nfixstate(grammar *g, state *s)\n{\n    arc *a;\n    int k;\n    int *accel;\n    int nl = g->g_ll.ll_nlabels;\n    s->s_accept = 0;\n    accel = (int *) PyObject_MALLOC(nl * sizeof(int));\n    if (accel == NULL) {\n        fprintf(stderr, \"no mem to build parser accelerators\\n\");\n        exit(1);\n    }\n    for (k = 0; k < nl; k++)\n        accel[k] = -1;\n    a = s->s_arc;\n    for (k = s->s_narcs; --k >= 0; a++) {\n        int lbl = a->a_lbl;\n        label *l = &g->g_ll.ll_label[lbl];\n        int type = l->lb_type;\n        if (a->a_arrow >= (1 << 7)) {\n            printf(\"XXX too many states!\\n\");\n            continue;\n        }\n        if (ISNONTERMINAL(type)) {\n            dfa *d1 = Ta27Grammar_FindDFA(g, type);\n            int ibit;\n            if (type - NT_OFFSET >= (1 << 7)) {\n                printf(\"XXX too high nonterminal number!\\n\");\n                continue;\n            }\n            for (ibit = 0; ibit < g->g_ll.ll_nlabels; ibit++) {\n                if (testbit(d1->d_first, ibit)) {\n                    if (accel[ibit] != -1)\n                        printf(\"XXX ambiguity!\\n\");\n                    accel[ibit] = a->a_arrow | (1 << 7) |\n                        ((type - NT_OFFSET) << 8);\n                }\n            }\n        }\n        else if (lbl == EMPTY)\n            s->s_accept = 1;\n        else if (lbl >= 0 && lbl < nl)\n            accel[lbl] = a->a_arrow;\n    }\n    while (nl > 0 && accel[nl-1] == -1)\n        nl--;\n    for (k = 0; k < nl && accel[k] == -1;)\n        k++;\n    if (k < nl) {\n        int i;\n        s->s_accel = (int *) PyObject_MALLOC((nl-k) * sizeof(int));\n        if (s->s_accel == NULL) {\n            fprintf(stderr, \"no mem to add parser accelerators\\n\");\n            exit(1);\n        }\n        s->s_lower = k;\n        s->s_upper = nl;\n        for (i = 0; k < nl; i++, k++)\n            s->s_accel[i] = accel[k];\n    }\n    PyObject_FREE(accel);\n}\n"
  },
  {
    "path": "ast27/Parser/asdl.py",
    "content": "\"\"\"An implementation of the Zephyr Abstract Syntax Definition Language.\n\nSee http://asdl.sourceforge.net/ and\nhttp://www.cs.princeton.edu/research/techreps/TR-554-97\n\nOnly supports top level module decl, not view.  I'm guessing that view\nis intended to support the browser and I'm not interested in the\nbrowser.\n\nChanges for Python: Add support for module versions\n\"\"\"\n\nimport os\nimport traceback\n\nimport spark\n\nclass Token(object):\n    # spark seems to dispatch in the parser based on a token's\n    # type attribute\n    def __init__(self, type, lineno):\n        self.type = type\n        self.lineno = lineno\n\n    def __str__(self):\n        return self.type\n\n    def __repr__(self):\n        return str(self)\n\nclass Id(Token):\n    def __init__(self, value, lineno):\n        self.type = 'Id'\n        self.value = value\n        self.lineno = lineno\n\n    def __str__(self):\n        return self.value\n\nclass String(Token):\n    def __init__(self, value, lineno):\n        self.type = 'String'\n        self.value = value\n        self.lineno = lineno\n\nclass ASDLSyntaxError(Exception):\n\n    def __init__(self, lineno, token=None, msg=None):\n        self.lineno = lineno\n        self.token = token\n        self.msg = msg\n\n    def __str__(self):\n        if self.msg is None:\n            return \"Error at '%s', line %d\" % (self.token, self.lineno)\n        else:\n            return \"%s, line %d\" % (self.msg, self.lineno)\n\nclass ASDLScanner(spark.GenericScanner, object):\n\n    def tokenize(self, input):\n        self.rv = []\n        self.lineno = 1\n        super(ASDLScanner, self).tokenize(input)\n        return self.rv\n\n    def t_id(self, s):\n        r\"[\\w\\.]+\"\n        # XXX doesn't distinguish upper vs. lower, which is\n        # significant for ASDL.\n        self.rv.append(Id(s, self.lineno))\n\n    def t_string(self, s):\n        r'\"[^\"]*\"'\n        self.rv.append(String(s, self.lineno))\n\n    def t_xxx(self, s): # not sure what this production means\n        r\"<=\"\n        self.rv.append(Token(s, self.lineno))\n\n    def t_punctuation(self, s):\n        r\"[\\{\\}\\*\\=\\|\\(\\)\\,\\?\\:]\"\n        self.rv.append(Token(s, self.lineno))\n\n    def t_comment(self, s):\n        r\"\\-\\-[^\\n]*\"\n        pass\n\n    def t_newline(self, s):\n        r\"\\n\"\n        self.lineno += 1\n\n    def t_whitespace(self, s):\n        r\"[ \\t]+\"\n        pass\n\n    def t_default(self, s):\n        r\" . +\"\n        raise ValueError, \"unmatched input: %s\" % `s`\n\nclass ASDLParser(spark.GenericParser, object):\n    def __init__(self):\n        super(ASDLParser, self).__init__(\"module\")\n\n    def typestring(self, tok):\n        return tok.type\n\n    def error(self, tok):\n        raise ASDLSyntaxError(tok.lineno, tok)\n\n    def p_module_0(self, (module, name, version, _0, _1)):\n        \" module ::= Id Id version { } \"\n        if module.value != \"module\":\n            raise ASDLSyntaxError(module.lineno,\n                                  msg=\"expected 'module', found %s\" % module)\n        return Module(name, None, version)\n\n    def p_module(self, (module, name, version, _0, definitions, _1)):\n        \" module ::= Id Id version { definitions } \"\n        if module.value != \"module\":\n            raise ASDLSyntaxError(module.lineno,\n                                  msg=\"expected 'module', found %s\" % module)\n        return Module(name, definitions, version)\n\n    def p_version(self, (version, V)):\n        \"version ::= Id String\"\n        if version.value != \"version\":\n            raise ASDLSyntaxError(version.lineno,\n                                msg=\"expected 'version', found %\" % version)\n        return V\n\n    def p_definition_0(self, (definition,)):\n        \" definitions ::= definition \"\n        return definition\n\n    def p_definition_1(self, (definitions, definition)):\n        \" definitions ::= definition definitions \"\n        return definitions + definition\n\n    def p_definition(self, (id, _, type)):\n        \" definition ::= Id = type \"\n        return [Type(id, type)]\n\n    def p_type_0(self, (product,)):\n        \" type ::= product \"\n        return product\n\n    def p_type_1(self, (sum,)):\n        \" type ::= sum \"\n        return Sum(sum)\n\n    def p_type_2(self, (sum, id, _0, attributes, _1)):\n        \" type ::= sum Id ( fields ) \"\n        if id.value != \"attributes\":\n            raise ASDLSyntaxError(id.lineno,\n                                  msg=\"expected attributes, found %s\" % id)\n        if attributes:\n            attributes.reverse()\n        return Sum(sum, attributes)\n\n    def p_product(self, (_0, fields, _1)):\n        \" product ::= ( fields ) \"\n        # XXX can't I just construct things in the right order?\n        fields.reverse()\n        return Product(fields)\n\n    def p_sum_0(self, (constructor,)):\n        \" sum ::= constructor \"\n        return [constructor]\n\n    def p_sum_1(self, (constructor, _, sum)):\n        \" sum ::= constructor | sum \"\n        return [constructor] + sum\n\n    def p_sum_2(self, (constructor, _, sum)):\n        \" sum ::= constructor | sum \"\n        return [constructor] + sum\n\n    def p_constructor_0(self, (id,)):\n        \" constructor ::= Id \"\n        return Constructor(id)\n\n    def p_constructor_1(self, (id, _0, fields, _1)):\n        \" constructor ::= Id ( fields ) \"\n        # XXX can't I just construct things in the right order?\n        fields.reverse()\n        return Constructor(id, fields)\n\n    def p_fields_0(self, (field,)):\n        \" fields ::= field \"\n        return [field]\n\n    def p_fields_1(self, (field, _, fields)):\n        \" fields ::= field , fields \"\n        return fields + [field]\n\n    def p_field_0(self, (type,)):\n        \" field ::= Id \"\n        return Field(type)\n\n    def p_field_1(self, (type, name)):\n        \" field ::= Id Id \"\n        return Field(type, name)\n\n    def p_field_2(self, (type, _, name)):\n        \" field ::= Id * Id \"\n        return Field(type, name, seq=True)\n\n    def p_field_3(self, (type, _, name)):\n        \" field ::= Id ? Id \"\n        return Field(type, name, opt=True)\n\n    def p_field_4(self, (type, _)):\n        \" field ::= Id * \"\n        return Field(type, seq=True)\n\n    def p_field_5(self, (type, _)):\n        \" field ::= Id ? \"\n        return Field(type, opt=True)\n\nbuiltin_types = (\"identifier\", \"string\", \"int\", \"bool\", \"object\")\n\n# below is a collection of classes to capture the AST of an AST :-)\n# not sure if any of the methods are useful yet, but I'm adding them\n# piecemeal as they seem helpful\n\nclass AST(object):\n    pass # a marker class\n\nclass Module(AST):\n    def __init__(self, name, dfns, version):\n        self.name = name\n        self.dfns = dfns\n        self.version = version\n        self.types = {} # maps type name to value (from dfns)\n        for type in dfns:\n            self.types[type.name.value] = type.value\n\n    def __repr__(self):\n        return \"Module(%s, %s)\" % (self.name, self.dfns)\n\nclass Type(AST):\n    def __init__(self, name, value):\n        self.name = name\n        self.value = value\n\n    def __repr__(self):\n        return \"Type(%s, %s)\" % (self.name, self.value)\n\nclass Constructor(AST):\n    def __init__(self, name, fields=None):\n        self.name = name\n        self.fields = fields or []\n\n    def __repr__(self):\n        return \"Constructor(%s, %s)\" % (self.name, self.fields)\n\nclass Field(AST):\n    def __init__(self, type, name=None, seq=False, opt=False):\n        self.type = type\n        self.name = name\n        self.seq = seq\n        self.opt = opt\n\n    def __repr__(self):\n        if self.seq:\n            extra = \", seq=True\"\n        elif self.opt:\n            extra = \", opt=True\"\n        else:\n            extra = \"\"\n        if self.name is None:\n            return \"Field(%s%s)\" % (self.type, extra)\n        else:\n            return \"Field(%s, %s%s)\" % (self.type, self.name, extra)\n\nclass Sum(AST):\n    def __init__(self, types, attributes=None):\n        self.types = types\n        self.attributes = attributes or []\n\n    def __repr__(self):\n        if self.attributes is None:\n            return \"Sum(%s)\" % self.types\n        else:\n            return \"Sum(%s, %s)\" % (self.types, self.attributes)\n\nclass Product(AST):\n    def __init__(self, fields):\n        self.fields = fields\n\n    def __repr__(self):\n        return \"Product(%s)\" % self.fields\n\nclass VisitorBase(object):\n\n    def __init__(self, skip=False):\n        self.cache = {}\n        self.skip = skip\n\n    def visit(self, object, *args):\n        meth = self._dispatch(object)\n        if meth is None:\n            return\n        try:\n            meth(object, *args)\n        except Exception, err:\n            print \"Error visiting\", repr(object)\n            print err\n            traceback.print_exc()\n            # XXX hack\n            if hasattr(self, 'file'):\n                self.file.flush()\n            os._exit(1)\n\n    def _dispatch(self, object):\n        assert isinstance(object, AST), repr(object)\n        klass = object.__class__\n        meth = self.cache.get(klass)\n        if meth is None:\n            methname = \"visit\" + klass.__name__\n            if self.skip:\n                meth = getattr(self, methname, None)\n            else:\n                meth = getattr(self, methname)\n            self.cache[klass] = meth\n        return meth\n\nclass Check(VisitorBase):\n\n    def __init__(self):\n        super(Check, self).__init__(skip=True)\n        self.cons = {}\n        self.errors = 0\n        self.types = {}\n\n    def visitModule(self, mod):\n        for dfn in mod.dfns:\n            self.visit(dfn)\n\n    def visitType(self, type):\n        self.visit(type.value, str(type.name))\n\n    def visitSum(self, sum, name):\n        for t in sum.types:\n            self.visit(t, name)\n\n    def visitConstructor(self, cons, name):\n        key = str(cons.name)\n        conflict = self.cons.get(key)\n        if conflict is None:\n            self.cons[key] = name\n        else:\n            print \"Redefinition of constructor %s\" % key\n            print \"Defined in %s and %s\" % (conflict, name)\n            self.errors += 1\n        for f in cons.fields:\n            self.visit(f, key)\n\n    def visitField(self, field, name):\n        key = str(field.type)\n        l = self.types.setdefault(key, [])\n        l.append(name)\n\n    def visitProduct(self, prod, name):\n        for f in prod.fields:\n            self.visit(f, name)\n\ndef check(mod):\n    v = Check()\n    v.visit(mod)\n\n    for t in v.types:\n        if t not in mod.types and not t in builtin_types:\n            v.errors += 1\n            uses = \", \".join(v.types[t])\n            print \"Undefined type %s, used in %s\" % (t, uses)\n\n    return not v.errors\n\ndef parse(file):\n    scanner = ASDLScanner()\n    parser = ASDLParser()\n\n    buf = open(file).read()\n    tokens = scanner.tokenize(buf)\n    try:\n        return parser.parse(tokens)\n    except ASDLSyntaxError, err:\n        print err\n        lines = buf.split(\"\\n\")\n        print lines[err.lineno - 1] # lines starts at 0, files at 1\n\nif __name__ == \"__main__\":\n    import glob\n    import sys\n\n    if len(sys.argv) > 1:\n        files = sys.argv[1:]\n    else:\n        testdir = \"tests\"\n        files = glob.glob(testdir + \"/*.asdl\")\n\n    for file in files:\n        print file\n        mod = parse(file)\n        print \"module\", mod.name\n        print len(mod.dfns), \"definitions\"\n        if not check(mod):\n            print \"Check failed\"\n        else:\n            for dfn in mod.dfns:\n                print dfn.type\n"
  },
  {
    "path": "ast27/Parser/asdl_c.py",
    "content": "#! /usr/bin/env python\n\"\"\"Generate C code from an ASDL description.\"\"\"\n\n# TO DO\n# handle fields that have a type but no name\n\nimport os, sys\n\nimport asdl\n\nTABSIZE = 8\nMAX_COL = 100\n\ndef get_c_type(name):\n    \"\"\"Return a string for the C name of the type.\n\n    This function special cases the default types provided by asdl:\n    identifier, string, int, bool.\n    \"\"\"\n    # XXX ack!  need to figure out where Id is useful and where string\n    if isinstance(name, asdl.Id):\n        name = name.value\n    if name in asdl.builtin_types:\n        return name\n    else:\n        return \"%s_ty\" % name\n\ndef reflow_lines(s, depth):\n    \"\"\"Reflow the line s indented depth tabs.\n\n    Return a sequence of lines where no line extends beyond MAX_COL\n    when properly indented.  The first line is properly indented based\n    exclusively on depth * TABSIZE.  All following lines -- these are\n    the reflowed lines generated by this function -- start at the same\n    column as the first character beyond the opening { in the first\n    line.\n    \"\"\"\n    size = MAX_COL - depth * TABSIZE\n    if len(s) < size:\n        return [s]\n\n    lines = []\n    cur = s\n    padding = \"\"\n    while len(cur) > size:\n        i = cur.rfind(' ', 0, size)\n        # XXX this should be fixed for real\n        if i == -1 and 'GeneratorExp' in cur:\n            i = size + 3\n        assert i != -1, \"Impossible line %d to reflow: %r\" % (size, s)\n        lines.append(padding + cur[:i])\n        if len(lines) == 1:\n            # find new size based on brace\n            j = cur.find('{', 0, i)\n            if j >= 0:\n                j += 2 # account for the brace and the space after it\n                size -= j\n                padding = \" \" * j\n            else:\n                j = cur.find('(', 0, i)\n                if j >= 0:\n                    j += 1 # account for the paren (no space after it)\n                    size -= j\n                    padding = \" \" * j\n        cur = cur[i+1:]\n    else:\n        lines.append(padding + cur)\n    return lines\n\ndef is_simple(sum):\n    \"\"\"Return True if a sum is a simple.\n\n    A sum is simple if its types have no fields, e.g.\n    unaryop = Invert | Not | UAdd | USub\n    \"\"\"\n    for t in sum.types:\n        if t.fields:\n            return False\n    return True\n\n\nclass EmitVisitor(asdl.VisitorBase):\n    \"\"\"Visit that emits lines\"\"\"\n\n    def __init__(self, file):\n        self.file = file\n        super(EmitVisitor, self).__init__()\n\n    def emit(self, s, depth, reflow=True):\n        # XXX reflow long lines?\n        if reflow:\n            lines = reflow_lines(s, depth)\n        else:\n            lines = [s]\n        for line in lines:\n            line = (\" \" * TABSIZE * depth) + line + \"\\n\"\n            self.file.write(line)\n\n\nclass TypeDefVisitor(EmitVisitor):\n    def visitModule(self, mod):\n        for dfn in mod.dfns:\n            self.visit(dfn)\n\n    def visitType(self, type, depth=0):\n        self.visit(type.value, type.name, depth)\n\n    def visitSum(self, sum, name, depth):\n        if is_simple(sum):\n            self.simple_sum(sum, name, depth)\n        else:\n            self.sum_with_constructors(sum, name, depth)\n\n    def simple_sum(self, sum, name, depth):\n        enum = []\n        for i in range(len(sum.types)):\n            type = sum.types[i]\n            enum.append(\"%s=%d\" % (type.name, i + 1))\n        enums = \", \".join(enum)\n        ctype = get_c_type(name)\n        s = \"typedef enum _%s { %s } %s;\" % (name, enums, ctype)\n        self.emit(s, depth)\n        self.emit(\"\", depth)\n\n    def sum_with_constructors(self, sum, name, depth):\n        ctype = get_c_type(name)\n        s = \"typedef struct _%(name)s *%(ctype)s;\" % locals()\n        self.emit(s, depth)\n        self.emit(\"\", depth)\n\n    def visitProduct(self, product, name, depth):\n        ctype = get_c_type(name)\n        s = \"typedef struct _%(name)s *%(ctype)s;\" % locals()\n        self.emit(s, depth)\n        self.emit(\"\", depth)\n\n\nclass StructVisitor(EmitVisitor):\n    \"\"\"Visitor to generate typdefs for AST.\"\"\"\n\n    def visitModule(self, mod):\n        for dfn in mod.dfns:\n            self.visit(dfn)\n\n    def visitType(self, type, depth=0):\n        self.visit(type.value, type.name, depth)\n\n    def visitSum(self, sum, name, depth):\n        if not is_simple(sum):\n            self.sum_with_constructors(sum, name, depth)\n\n    def sum_with_constructors(self, sum, name, depth):\n        def emit(s, depth=depth):\n            self.emit(s % sys._getframe(1).f_locals, depth)\n        enum = []\n        for i in range(len(sum.types)):\n            type = sum.types[i]\n            enum.append(\"%s_kind=%d\" % (type.name, i + 1))\n\n        emit(\"enum _%(name)s_kind {\" + \", \".join(enum) + \"};\")\n\n        emit(\"struct _%(name)s {\")\n        emit(\"enum _%(name)s_kind kind;\", depth + 1)\n        emit(\"union {\", depth + 1)\n        for t in sum.types:\n            self.visit(t, depth + 2)\n        emit(\"} v;\", depth + 1)\n        for field in sum.attributes:\n            # rudimentary attribute handling\n            type = str(field.type)\n            assert type in asdl.builtin_types, type\n            emit(\"%s %s;\" % (type, field.name), depth + 1);\n        emit(\"};\")\n        emit(\"\")\n\n    def visitConstructor(self, cons, depth):\n        if cons.fields:\n            self.emit(\"struct {\", depth)\n            for f in cons.fields:\n                self.visit(f, depth + 1)\n            self.emit(\"} %s;\" % cons.name, depth)\n            self.emit(\"\", depth)\n        else:\n            # XXX not sure what I want here, nothing is probably fine\n            pass\n\n    def visitField(self, field, depth):\n        # XXX need to lookup field.type, because it might be something\n        # like a builtin...\n        ctype = get_c_type(field.type)\n        name = field.name\n        if field.seq:\n            if field.type.value in ('cmpop',):\n                self.emit(\"asdl_int_seq *%(name)s;\" % locals(), depth)\n            else:\n                self.emit(\"asdl_seq *%(name)s;\" % locals(), depth)\n        else:\n            self.emit(\"%(ctype)s %(name)s;\" % locals(), depth)\n\n    def visitProduct(self, product, name, depth):\n        self.emit(\"struct _%(name)s {\" % locals(), depth)\n        for f in product.fields:\n            self.visit(f, depth + 1)\n        self.emit(\"};\", depth)\n        self.emit(\"\", depth)\n\n\nclass PrototypeVisitor(EmitVisitor):\n    \"\"\"Generate function prototypes for the .h file\"\"\"\n\n    def visitModule(self, mod):\n        for dfn in mod.dfns:\n            self.visit(dfn)\n\n    def visitType(self, type):\n        self.visit(type.value, type.name)\n\n    def visitSum(self, sum, name):\n        if is_simple(sum):\n            pass # XXX\n        else:\n            for t in sum.types:\n                self.visit(t, name, sum.attributes)\n\n    def get_args(self, fields):\n        \"\"\"Return list of C argument into, one for each field.\n\n        Argument info is 3-tuple of a C type, variable name, and flag\n        that is true if type can be NULL.\n        \"\"\"\n        args = []\n        unnamed = {}\n        for f in fields:\n            if f.name is None:\n                name = f.type\n                c = unnamed[name] = unnamed.get(name, 0) + 1\n                if c > 1:\n                    name = \"name%d\" % (c - 1)\n            else:\n                name = f.name\n            # XXX should extend get_c_type() to handle this\n            if f.seq:\n                if f.type.value in ('cmpop',):\n                    ctype = \"asdl_int_seq *\"\n                else:\n                    ctype = \"asdl_seq *\"\n            else:\n                ctype = get_c_type(f.type)\n            args.append((ctype, name, f.opt or f.seq))\n        return args\n\n    def visitConstructor(self, cons, type, attrs):\n        args = self.get_args(cons.fields)\n        attrs = self.get_args(attrs)\n        ctype = get_c_type(type)\n        self.emit_function(cons.name, ctype, args, attrs)\n\n    def emit_function(self, name, ctype, args, attrs, union=True):\n        args = args + attrs\n        if args:\n            argstr = \", \".join([\"%s %s\" % (atype, aname)\n                                for atype, aname, opt in args])\n            argstr += \", PyArena *arena\"\n        else:\n            argstr = \"PyArena *arena\"\n        margs = \"a0\"\n        for i in range(1, len(args)+1):\n            margs += \", a%d\" % i\n        self.emit(\"#define %s(%s) _Ta27_%s(%s)\" % (name, margs, name, margs), 0,\n                reflow=False)\n        self.emit(\"%s _Ta27_%s(%s);\" % (ctype, name, argstr), False)\n\n    def visitProduct(self, prod, name):\n        self.emit_function(name, get_c_type(name),\n                           self.get_args(prod.fields), [], union=False)\n\n\nclass FunctionVisitor(PrototypeVisitor):\n    \"\"\"Visitor to generate constructor functions for AST.\"\"\"\n\n    def emit_function(self, name, ctype, args, attrs, union=True):\n        def emit(s, depth=0, reflow=True):\n            self.emit(s, depth, reflow)\n        argstr = \", \".join([\"%s %s\" % (atype, aname)\n                            for atype, aname, opt in args + attrs])\n        if argstr:\n            argstr += \", PyArena *arena\"\n        else:\n            argstr = \"PyArena *arena\"\n        self.emit(\"%s\" % ctype, 0)\n        emit(\"%s(%s)\" % (name, argstr))\n        emit(\"{\")\n        emit(\"%s p;\" % ctype, 1)\n        for argtype, argname, opt in args:\n            # XXX hack alert: false is allowed for a bool\n            if not opt and not (argtype == \"bool\" or argtype == \"int\"):\n                emit(\"if (!%s) {\" % argname, 1)\n                emit(\"PyErr_SetString(PyExc_ValueError,\", 2)\n                msg = \"field %s is required for %s\" % (argname, name)\n                emit('                \"%s\");' % msg,\n                     2, reflow=False)\n                emit('return NULL;', 2)\n                emit('}', 1)\n\n        emit(\"p = (%s)PyArena_Malloc(arena, sizeof(*p));\" % ctype, 1);\n        emit(\"if (!p)\", 1)\n        emit(\"return NULL;\", 2)\n        if union:\n            self.emit_body_union(name, args, attrs)\n        else:\n            self.emit_body_struct(name, args, attrs)\n        emit(\"return p;\", 1)\n        emit(\"}\")\n        emit(\"\")\n\n    def emit_body_union(self, name, args, attrs):\n        def emit(s, depth=0, reflow=True):\n            self.emit(s, depth, reflow)\n        emit(\"p->kind = %s_kind;\" % name, 1)\n        for argtype, argname, opt in args:\n            emit(\"p->v.%s.%s = %s;\" % (name, argname, argname), 1)\n        for argtype, argname, opt in attrs:\n            emit(\"p->%s = %s;\" % (argname, argname), 1)\n\n    def emit_body_struct(self, name, args, attrs):\n        def emit(s, depth=0, reflow=True):\n            self.emit(s, depth, reflow)\n        for argtype, argname, opt in args:\n            emit(\"p->%s = %s;\" % (argname, argname), 1)\n        assert not attrs\n\n\nclass PickleVisitor(EmitVisitor):\n\n    def visitModule(self, mod):\n        for dfn in mod.dfns:\n            self.visit(dfn)\n\n    def visitType(self, type):\n        self.visit(type.value, type.name)\n\n    def visitSum(self, sum, name):\n        pass\n\n    def visitProduct(self, sum, name):\n        pass\n\n    def visitConstructor(self, cons, name):\n        pass\n\n    def visitField(self, sum):\n        pass\n\n\nclass Obj2ModPrototypeVisitor(PickleVisitor):\n    def visitProduct(self, prod, name):\n        code = \"static int obj2ast_%s(PyObject* obj, %s* out, PyArena* arena);\"\n        self.emit(code % (name, get_c_type(name)), 0)\n\n    visitSum = visitProduct\n\n\nclass Obj2ModVisitor(PickleVisitor):\n    def funcHeader(self, name):\n        ctype = get_c_type(name)\n        self.emit(\"int\", 0)\n        self.emit(\"obj2ast_%s(PyObject* obj, %s* out, PyArena* arena)\" % (name, ctype), 0)\n        self.emit(\"{\", 0)\n        self.emit(\"PyObject* tmp = NULL;\", 1)\n        self.emit(\"int isinstance;\", 1)\n        self.emit(\"\", 0)\n\n    def sumTrailer(self, name):\n        self.emit(\"\", 0)\n        self.emit(\"tmp = PyObject_Repr(obj);\", 1)\n        # there's really nothing more we can do if this fails ...\n        self.emit(\"if (tmp == NULL) goto failed;\", 1)\n        error = \"expected some sort of %s, but got %%.400s\" % name\n        format = \"PyErr_Format(PyExc_TypeError, \\\"%s\\\", _PyUnicode_AsString(tmp));\"\n        self.emit(format % error, 1, reflow=False)\n        self.emit(\"failed:\", 0)\n        self.emit(\"Py_XDECREF(tmp);\", 1)\n        self.emit(\"return 1;\", 1)\n        self.emit(\"}\", 0)\n        self.emit(\"\", 0)\n\n    def simpleSum(self, sum, name):\n        self.funcHeader(name)\n        for t in sum.types:\n            line = (\"isinstance = PyObject_IsInstance(obj, \"\n                    \"(PyObject *)%s_type);\")\n            self.emit(line % (t.name,), 1)\n            self.emit(\"if (isinstance == -1) {\", 1)\n            self.emit(\"return 1;\", 2)\n            self.emit(\"}\", 1)\n            self.emit(\"if (isinstance) {\", 1)\n            self.emit(\"*out = %s;\" % t.name, 2)\n            self.emit(\"return 0;\", 2)\n            self.emit(\"}\", 1)\n        self.sumTrailer(name)\n\n    def buildArgs(self, fields):\n        return \", \".join(fields + [\"arena\"])\n\n    def complexSum(self, sum, name):\n        self.funcHeader(name)\n        for a in sum.attributes:\n            self.visitAttributeDeclaration(a, name, sum=sum)\n        self.emit(\"\", 0)\n        # XXX: should we only do this for 'expr'?\n        self.emit(\"if (obj == Py_None) {\", 1)\n        self.emit(\"*out = NULL;\", 2)\n        self.emit(\"return 0;\", 2)\n        self.emit(\"}\", 1)\n        for a in sum.attributes:\n            self.visitField(a, name, sum=sum, depth=1)\n        for t in sum.types:\n            line = \"isinstance = PyObject_IsInstance(obj, (PyObject*)%s_type);\"\n            self.emit(line % (t.name,), 1)\n            self.emit(\"if (isinstance == -1) {\", 1)\n            self.emit(\"return 1;\", 2)\n            self.emit(\"}\", 1)\n            self.emit(\"if (isinstance) {\", 1)\n            for f in t.fields:\n                self.visitFieldDeclaration(f, t.name, sum=sum, depth=2)\n            self.emit(\"\", 0)\n            for f in t.fields:\n                self.visitField(f, t.name, sum=sum, depth=2)\n            args = [f.name.value for f in t.fields] + [a.name.value for a in sum.attributes]\n            self.emit(\"*out = %s(%s);\" % (t.name, self.buildArgs(args)), 2)\n            self.emit(\"if (*out == NULL) goto failed;\", 2)\n            self.emit(\"return 0;\", 2)\n            self.emit(\"}\", 1)\n        self.sumTrailer(name)\n\n    def visitAttributeDeclaration(self, a, name, sum=sum):\n        ctype = get_c_type(a.type)\n        self.emit(\"%s %s;\" % (ctype, a.name), 1)\n\n    def visitSum(self, sum, name):\n        if is_simple(sum):\n            self.simpleSum(sum, name)\n        else:\n            self.complexSum(sum, name)\n\n    def visitProduct(self, prod, name):\n        ctype = get_c_type(name)\n        self.emit(\"int\", 0)\n        self.emit(\"obj2ast_%s(PyObject* obj, %s* out, PyArena* arena)\" % (name, ctype), 0)\n        self.emit(\"{\", 0)\n        self.emit(\"PyObject* tmp = NULL;\", 1)\n        for f in prod.fields:\n            self.visitFieldDeclaration(f, name, prod=prod, depth=1)\n        self.emit(\"\", 0)\n        for f in prod.fields:\n            self.visitField(f, name, prod=prod, depth=1)\n        args = [f.name.value for f in prod.fields]\n        self.emit(\"*out = %s(%s);\" % (name, self.buildArgs(args)), 1)\n        self.emit(\"return 0;\", 1)\n        self.emit(\"failed:\", 0)\n        self.emit(\"Py_XDECREF(tmp);\", 1)\n        self.emit(\"return 1;\", 1)\n        self.emit(\"}\", 0)\n        self.emit(\"\", 0)\n\n    def visitFieldDeclaration(self, field, name, sum=None, prod=None, depth=0):\n        ctype = get_c_type(field.type)\n        if field.seq:\n            if self.isSimpleType(field):\n                self.emit(\"asdl_int_seq* %s;\" % field.name, depth)\n            else:\n                self.emit(\"asdl_seq* %s;\" % field.name, depth)\n        else:\n            ctype = get_c_type(field.type)\n            self.emit(\"%s %s;\" % (ctype, field.name), depth)\n\n    def isSimpleSum(self, field):\n        # XXX can the members of this list be determined automatically?\n        return field.type.value in ('expr_context', 'boolop', 'operator',\n                                    'unaryop', 'cmpop')\n\n    def isNumeric(self, field):\n        return get_c_type(field.type) in (\"int\", \"bool\")\n\n    def isSimpleType(self, field):\n        return self.isSimpleSum(field) or self.isNumeric(field)\n\n    def visitField(self, field, name, sum=None, prod=None, depth=0):\n        ctype = get_c_type(field.type)\n        self.emit(\"if (PyObject_HasAttrString(obj, \\\"%s\\\")) {\" % field.name, depth)\n        self.emit(\"int res;\", depth+1)\n        if field.seq:\n            self.emit(\"Py_ssize_t len;\", depth+1)\n            self.emit(\"Py_ssize_t i;\", depth+1)\n        self.emit(\"tmp = PyObject_GetAttrString(obj, \\\"%s\\\");\" % field.name, depth+1)\n        self.emit(\"if (tmp == NULL) goto failed;\", depth+1)\n        if field.seq:\n            self.emit(\"if (!PyList_Check(tmp)) {\", depth+1)\n            self.emit(\"PyErr_Format(PyExc_TypeError, \\\"%s field \\\\\\\"%s\\\\\\\" must \"\n                      \"be a list, not a %%.200s\\\", tmp->ob_type->tp_name);\" %\n                      (name, field.name),\n                      depth+2, reflow=False)\n            self.emit(\"goto failed;\", depth+2)\n            self.emit(\"}\", depth+1)\n            self.emit(\"len = PyList_GET_SIZE(tmp);\", depth+1)\n            if self.isSimpleType(field):\n                self.emit(\"%s = asdl_int_seq_new(len, arena);\" % field.name, depth+1)\n            else:\n                self.emit(\"%s = asdl_seq_new(len, arena);\" % field.name, depth+1)\n            self.emit(\"if (%s == NULL) goto failed;\" % field.name, depth+1)\n            self.emit(\"for (i = 0; i < len; i++) {\", depth+1)\n            self.emit(\"%s value;\" % ctype, depth+2)\n            self.emit(\"res = obj2ast_%s(PyList_GET_ITEM(tmp, i), &value, arena);\" %\n                      field.type, depth+2, reflow=False)\n            self.emit(\"if (res != 0) goto failed;\", depth+2)\n            self.emit(\"asdl_seq_SET(%s, i, value);\" % field.name, depth+2)\n            self.emit(\"}\", depth+1)\n        else:\n            self.emit(\"res = obj2ast_%s(tmp, &%s, arena);\" %\n                      (field.type, field.name), depth+1)\n            self.emit(\"if (res != 0) goto failed;\", depth+1)\n\n        self.emit(\"Py_XDECREF(tmp);\", depth+1)\n        self.emit(\"tmp = NULL;\", depth+1)\n        self.emit(\"} else {\", depth)\n        if not field.opt:\n            message = \"required field \\\\\\\"%s\\\\\\\" missing from %s\" % (field.name, name)\n            format = \"PyErr_SetString(PyExc_TypeError, \\\"%s\\\");\"\n            self.emit(format % message, depth+1, reflow=False)\n            self.emit(\"return 1;\", depth+1)\n        else:\n            if self.isNumeric(field):\n                self.emit(\"%s = 0;\" % field.name, depth+1)\n            elif not self.isSimpleType(field):\n                self.emit(\"%s = NULL;\" % field.name, depth+1)\n            else:\n                raise TypeError(\"could not determine the default value for %s\" % field.name)\n        self.emit(\"}\", depth)\n\n\nclass MarshalPrototypeVisitor(PickleVisitor):\n\n    def prototype(self, sum, name):\n        ctype = get_c_type(name)\n        self.emit(\"static int marshal_write_%s(PyObject **, int *, %s);\"\n                  % (name, ctype), 0)\n\n    visitProduct = visitSum = prototype\n\n\nclass PyTypesDeclareVisitor(PickleVisitor):\n\n    def visitProduct(self, prod, name):\n        self.emit(\"static PyTypeObject *%s_type;\" % name, 0)\n        self.emit(\"static PyObject* ast2obj_%s(void*);\" % name, 0)\n        if prod.fields:\n            self.emit(\"static char *%s_fields[]={\" % name,0)\n            for f in prod.fields:\n                self.emit('\"%s\",' % f.name, 1)\n            self.emit(\"};\", 0)\n\n    def visitSum(self, sum, name):\n        self.emit(\"static PyTypeObject *%s_type;\" % name, 0)\n        if sum.attributes:\n            self.emit(\"static char *%s_attributes[] = {\" % name, 0)\n            for a in sum.attributes:\n                self.emit('\"%s\",' % a.name, 1)\n            self.emit(\"};\", 0)\n        ptype = \"void*\"\n        if is_simple(sum):\n            ptype = get_c_type(name)\n            tnames = []\n            for t in sum.types:\n                tnames.append(str(t.name)+\"_singleton\")\n            tnames = \", *\".join(tnames)\n            self.emit(\"static PyObject *%s;\" % tnames, 0)\n        self.emit(\"static PyObject* ast2obj_%s(%s);\" % (name, ptype), 0)\n        for t in sum.types:\n            self.visitConstructor(t, name)\n\n    def visitConstructor(self, cons, name):\n        self.emit(\"static PyTypeObject *%s_type;\" % cons.name, 0)\n        if cons.fields:\n            self.emit(\"static char *%s_fields[]={\" % cons.name, 0)\n            for t in cons.fields:\n                self.emit('\"%s\",' % t.name, 1)\n            self.emit(\"};\",0)\n\nclass PyTypesVisitor(PickleVisitor):\n\n    def visitModule(self, mod):\n        self.emit(\"\"\"\nstatic int\nast_type_init(PyObject *self, PyObject *args, PyObject *kw)\n{\n    Py_ssize_t i, numfields = 0;\n    int res = -1;\n    PyObject *key, *value, *fields;\n    fields = PyObject_GetAttrString((PyObject*)Py_TYPE(self), \"_fields\");\n    if (!fields)\n        PyErr_Clear();\n    if (fields) {\n        numfields = PySequence_Size(fields);\n        if (numfields == -1)\n            goto cleanup;\n    }\n    res = 0; /* if no error occurs, this stays 0 to the end */\n    if (PyTuple_GET_SIZE(args) > 0) {\n        if (numfields != PyTuple_GET_SIZE(args)) {\n            PyErr_Format(PyExc_TypeError, \"%.400s constructor takes %s\"\n                         \"%zd positional argument%s\",\n                         Py_TYPE(self)->tp_name,\n                         numfields == 0 ? \"\" : \"either 0 or \",\n                         numfields, numfields == 1 ? \"\" : \"s\");\n            res = -1;\n            goto cleanup;\n        }\n        for (i = 0; i < PyTuple_GET_SIZE(args); i++) {\n            /* cannot be reached when fields is NULL */\n            PyObject *name = PySequence_GetItem(fields, i);\n            if (!name) {\n                res = -1;\n                goto cleanup;\n            }\n            res = PyObject_SetAttr(self, name, PyTuple_GET_ITEM(args, i));\n            Py_DECREF(name);\n            if (res < 0)\n                goto cleanup;\n        }\n    }\n    if (kw) {\n        i = 0;  /* needed by PyDict_Next */\n        while (PyDict_Next(kw, &i, &key, &value)) {\n            res = PyObject_SetAttr(self, key, value);\n            if (res < 0)\n                goto cleanup;\n        }\n    }\n  cleanup:\n    Py_XDECREF(fields);\n    return res;\n}\n\n/* Pickling support */\nstatic PyObject *\nast_type_reduce(PyObject *self, PyObject *unused)\n{\n    PyObject *res;\n    PyObject *dict = PyObject_GetAttrString(self, \"__dict__\");\n    if (dict == NULL) {\n        if (PyErr_ExceptionMatches(PyExc_AttributeError))\n            PyErr_Clear();\n        else\n            return NULL;\n    }\n    if (dict) {\n        res = Py_BuildValue(\"O()O\", Py_TYPE(self), dict);\n        Py_DECREF(dict);\n        return res;\n    }\n    return Py_BuildValue(\"O()\", Py_TYPE(self));\n}\n\nstatic PyMethodDef ast_type_methods[] = {\n    {\"__reduce__\", ast_type_reduce, METH_NOARGS, NULL},\n    {NULL}\n};\n\nstatic PyTypeObject AST_type = {\n    PyVarObject_HEAD_INIT(NULL, 0)\n    \"typed_ast._ast27.AST\",\n    sizeof(PyObject),\n    0,\n    0,                       /* tp_dealloc */\n    0,                       /* tp_print */\n    0,                       /* tp_getattr */\n    0,                       /* tp_setattr */\n    0,                       /* tp_compare */\n    0,                       /* tp_repr */\n    0,                       /* tp_as_number */\n    0,                       /* tp_as_sequence */\n    0,                       /* tp_as_mapping */\n    0,                       /* tp_hash */\n    0,                       /* tp_call */\n    0,                       /* tp_str */\n    PyObject_GenericGetAttr, /* tp_getattro */\n    PyObject_GenericSetAttr, /* tp_setattro */\n    0,                       /* tp_as_buffer */\n    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */\n    0,                       /* tp_doc */\n    0,                       /* tp_traverse */\n    0,                       /* tp_clear */\n    0,                       /* tp_richcompare */\n    0,                       /* tp_weaklistoffset */\n    0,                       /* tp_iter */\n    0,                       /* tp_iternext */\n    ast_type_methods,        /* tp_methods */\n    0,                       /* tp_members */\n    0,                       /* tp_getset */\n    0,                       /* tp_base */\n    0,                       /* tp_dict */\n    0,                       /* tp_descr_get */\n    0,                       /* tp_descr_set */\n    0,                       /* tp_dictoffset */\n    (initproc)ast_type_init, /* tp_init */\n    PyType_GenericAlloc,     /* tp_alloc */\n    PyType_GenericNew,       /* tp_new */\n    PyObject_Del,            /* tp_free */\n};\n\n\nstatic PyTypeObject* make_type(char *type, PyTypeObject* base, char**fields, int num_fields)\n{\n    PyObject *fnames, *result;\n    int i;\n    fnames = PyTuple_New(num_fields);\n    if (!fnames) return NULL;\n    for (i = 0; i < num_fields; i++) {\n        PyObject *field = PyUnicode_FromString(fields[i]);\n        if (!field) {\n            Py_DECREF(fnames);\n            return NULL;\n        }\n        PyTuple_SET_ITEM(fnames, i, field);\n    }\n    result = PyObject_CallFunction((PyObject*)&PyType_Type, \"s(O){sOss}\",\n                    type, base, \"_fields\", fnames, \"__module__\", \"typed_ast._ast27\");\n    Py_DECREF(fnames);\n    return (PyTypeObject*)result;\n}\n\nstatic int add_attributes(PyTypeObject* type, char**attrs, int num_fields)\n{\n    int i, result;\n    PyObject *s, *l = PyTuple_New(num_fields);\n    if (!l)\n        return 0;\n    for (i = 0; i < num_fields; i++) {\n        s = PyUnicode_FromString(attrs[i]);\n        if (!s) {\n            Py_DECREF(l);\n            return 0;\n        }\n        PyTuple_SET_ITEM(l, i, s);\n    }\n    result = PyObject_SetAttrString((PyObject*)type, \"_attributes\", l) >= 0;\n    Py_DECREF(l);\n    return result;\n}\n\n/* Conversion AST -> Python */\n\nstatic PyObject* ast2obj_list(asdl_seq *seq, PyObject* (*func)(void*))\n{\n    int i, n = asdl_seq_LEN(seq);\n    PyObject *result = PyList_New(n);\n    PyObject *value;\n    if (!result)\n        return NULL;\n    for (i = 0; i < n; i++) {\n        value = func(asdl_seq_GET(seq, i));\n        if (!value) {\n            Py_DECREF(result);\n            return NULL;\n        }\n        PyList_SET_ITEM(result, i, value);\n    }\n    return result;\n}\n\nstatic PyObject* ast2obj_object(void *o)\n{\n    if (!o)\n        o = Py_None;\n    Py_INCREF((PyObject*)o);\n    return (PyObject*)o;\n}\n#define ast2obj_identifier ast2obj_object\n#define ast2obj_string ast2obj_object\nstatic PyObject* ast2obj_bool(bool b)\n{\n    return PyBool_FromLong(b);\n}\n\nstatic PyObject* ast2obj_int(long b)\n{\n    return PyLong_FromLong(b);\n}\n\n/* Conversion Python -> AST */\n\nstatic int obj2ast_object(PyObject* obj, PyObject** out, PyArena* arena)\n{\n    if (obj == Py_None)\n        obj = NULL;\n    if (obj)\n        PyArena_AddPyObject(arena, obj);\n    Py_XINCREF(obj);\n    *out = obj;\n    return 0;\n}\n\nstatic int obj2ast_identifier(PyObject* obj, PyObject** out, PyArena* arena)\n{\n    if (!PyUnicode_CheckExact(obj) && obj != Py_None) {\n        PyErr_Format(PyExc_TypeError,\n                    \"AST identifier must be of type str\");\n        return 1;\n    }\n    return obj2ast_object(obj, out, arena);\n}\n\nstatic int obj2ast_string(PyObject* obj, PyObject** out, PyArena* arena)\n{\n    if (!PyUnicode_CheckExact(obj) && !PyUnicode_CheckExact(obj)) {\n        PyErr_SetString(PyExc_TypeError,\n                       \"AST string must be of type str or unicode\");\n        return 1;\n    }\n    return obj2ast_object(obj, out, arena);\n}\n\nstatic int obj2ast_int(PyObject* obj, int* out, PyArena* arena)\n{\n    int i;\n    if (!PyLong_Check(obj) && !PyLong_Check(obj)) {\n        PyObject *s = PyObject_Repr(obj);\n        if (s == NULL) return 1;\n        PyErr_Format(PyExc_ValueError, \"invalid integer value: %.400s\",\n                     _PyUnicode_AsString(s));\n        Py_DECREF(s);\n        return 1;\n    }\n\n    i = (int)PyLong_AsLong(obj);\n    if (i == -1 && PyErr_Occurred())\n        return 1;\n    *out = i;\n    return 0;\n}\n\nstatic int obj2ast_bool(PyObject* obj, bool* out, PyArena* arena)\n{\n    if (!PyBool_Check(obj)) {\n        PyObject *s = PyObject_Repr(obj);\n        if (s == NULL) return 1;\n        PyErr_Format(PyExc_ValueError, \"invalid boolean value: %.400s\",\n                     _PyUnicode_AsString(s));\n        Py_DECREF(s);\n        return 1;\n    }\n\n    *out = (obj == Py_True);\n    return 0;\n}\n\nstatic int add_ast_fields(void)\n{\n    PyObject *empty_tuple, *d;\n    if (PyType_Ready(&AST_type) < 0)\n        return -1;\n    d = AST_type.tp_dict;\n    empty_tuple = PyTuple_New(0);\n    if (!empty_tuple ||\n        PyDict_SetItemString(d, \"_fields\", empty_tuple) < 0 ||\n        PyDict_SetItemString(d, \"_attributes\", empty_tuple) < 0) {\n        Py_XDECREF(empty_tuple);\n        return -1;\n    }\n    Py_DECREF(empty_tuple);\n    return 0;\n}\n\n\"\"\", 0, reflow=False)\n\n        self.emit(\"static int init_types(void)\",0)\n        self.emit(\"{\", 0)\n        self.emit(\"static int initialized;\", 1)\n        self.emit(\"if (initialized) return 1;\", 1)\n        self.emit(\"if (add_ast_fields() < 0) return 0;\", 1)\n        for dfn in mod.dfns:\n            self.visit(dfn)\n        self.emit(\"initialized = 1;\", 1)\n        self.emit(\"return 1;\", 1);\n        self.emit(\"}\", 0)\n\n    def visitProduct(self, prod, name):\n        if prod.fields:\n            fields = name.value+\"_fields\"\n        else:\n            fields = \"NULL\"\n        self.emit('%s_type = make_type(\"%s\", &AST_type, %s, %d);' %\n                        (name, name, fields, len(prod.fields)), 1)\n        self.emit(\"if (!%s_type) return 0;\" % name, 1)\n\n    def visitSum(self, sum, name):\n        self.emit('%s_type = make_type(\"%s\", &AST_type, NULL, 0);' %\n                  (name, name), 1)\n        self.emit(\"if (!%s_type) return 0;\" % name, 1)\n        if sum.attributes:\n            self.emit(\"if (!add_attributes(%s_type, %s_attributes, %d)) return 0;\" %\n                            (name, name, len(sum.attributes)), 1)\n        else:\n            self.emit(\"if (!add_attributes(%s_type, NULL, 0)) return 0;\" % name, 1)\n        simple = is_simple(sum)\n        for t in sum.types:\n            self.visitConstructor(t, name, simple)\n\n    def visitConstructor(self, cons, name, simple):\n        if cons.fields:\n            fields = cons.name.value+\"_fields\"\n        else:\n            fields = \"NULL\"\n        self.emit('%s_type = make_type(\"%s\", %s_type, %s, %d);' %\n                            (cons.name, cons.name, name, fields, len(cons.fields)), 1)\n        self.emit(\"if (!%s_type) return 0;\" % cons.name, 1)\n        if simple:\n            self.emit(\"%s_singleton = PyType_GenericNew(%s_type, NULL, NULL);\" %\n                             (cons.name, cons.name), 1)\n            self.emit(\"if (!%s_singleton) return 0;\" % cons.name, 1)\n\n\nclass ASTModuleVisitor(PickleVisitor):\n\n    def visitModule(self, mod):\n        self.emit('PyObject *ast27_parse(PyObject *self, PyObject *args);', 0)\n        self.emit('static PyMethodDef ast27_methods[] = {', 0)\n        self.emit('{\"parse\",  ast27_parse, METH_VARARGS, \"Parse string into typed AST.\"},', 1)\n        self.emit('{NULL, NULL, 0, NULL}', 1)\n        self.emit('};', 0)\n\n        self.emit(\"static struct PyModuleDef _astmodule27 = {\", 0)\n        self.emit('  PyModuleDef_HEAD_INIT, \"_ast27\", NULL, 0, ast27_methods', 0)\n        self.emit(\"};\", 0)\n        self.emit(\"PyMODINIT_FUNC\", 0)\n        self.emit(\"PyInit__ast27(void)\", 0)\n        self.emit(\"{\", 0)\n        self.emit(\"PyObject *m, *d;\", 1)\n        self.emit(\"if (!init_types()) return NULL;\", 1)\n        self.emit('m = PyModule_Create(&_astmodule27);', 1)\n        self.emit(\"if (!m) return NULL;\", 1)\n        self.emit(\"d = PyModule_GetDict(m);\", 1)\n        self.emit('if (PyDict_SetItemString(d, \"AST\", (PyObject*)&AST_type) < 0) return NULL;', 1)\n        self.emit('if (PyModule_AddIntMacro(m, PyCF_ONLY_AST) < 0)', 1)\n        self.emit(\"return NULL;\", 2)\n        for dfn in mod.dfns:\n            self.visit(dfn)\n        self.emit(\"return m;\", 1)\n        self.emit(\"}\", 0)\n\n    def visitProduct(self, prod, name):\n        self.addObj(name)\n\n    def visitSum(self, sum, name):\n        self.addObj(name)\n        for t in sum.types:\n            self.visitConstructor(t, name)\n\n    def visitConstructor(self, cons, name):\n        self.addObj(cons.name)\n\n    def addObj(self, name):\n        self.emit('if (PyDict_SetItemString(d, \"%s\", (PyObject*)%s_type) < 0) return NULL;' % (name, name), 1)\n\n\n_SPECIALIZED_SEQUENCES = ('stmt', 'expr')\n\ndef find_sequence(fields, doing_specialization):\n    \"\"\"Return True if any field uses a sequence.\"\"\"\n    for f in fields:\n        if f.seq:\n            if not doing_specialization:\n                return True\n            if str(f.type) not in _SPECIALIZED_SEQUENCES:\n                return True\n    return False\n\ndef has_sequence(types, doing_specialization):\n    for t in types:\n        if find_sequence(t.fields, doing_specialization):\n            return True\n    return False\n\n\nclass StaticVisitor(PickleVisitor):\n    CODE = '''Very simple, always emit this static code.  Override CODE'''\n\n    def visit(self, object):\n        self.emit(self.CODE, 0, reflow=False)\n\n\nclass ObjVisitor(PickleVisitor):\n\n    def func_begin(self, name):\n        ctype = get_c_type(name)\n        self.emit(\"PyObject*\", 0)\n        self.emit(\"ast2obj_%s(void* _o)\" % (name), 0)\n        self.emit(\"{\", 0)\n        self.emit(\"%s o = (%s)_o;\" % (ctype, ctype), 1)\n        self.emit(\"PyObject *result = NULL, *value = NULL;\", 1)\n        self.emit('if (!o) {', 1)\n        self.emit(\"Py_INCREF(Py_None);\", 2)\n        self.emit('return Py_None;', 2)\n        self.emit(\"}\", 1)\n        self.emit('', 0)\n\n    def func_end(self):\n        self.emit(\"return result;\", 1)\n        self.emit(\"failed:\", 0)\n        self.emit(\"Py_XDECREF(value);\", 1)\n        self.emit(\"Py_XDECREF(result);\", 1)\n        self.emit(\"return NULL;\", 1)\n        self.emit(\"}\", 0)\n        self.emit(\"\", 0)\n\n    def visitSum(self, sum, name):\n        if is_simple(sum):\n            self.simpleSum(sum, name)\n            return\n        self.func_begin(name)\n        self.emit(\"switch (o->kind) {\", 1)\n        for i in range(len(sum.types)):\n            t = sum.types[i]\n            self.visitConstructor(t, i + 1, name)\n        self.emit(\"}\", 1)\n        for a in sum.attributes:\n            self.emit(\"value = ast2obj_%s(o->%s);\" % (a.type, a.name), 1)\n            self.emit(\"if (!value) goto failed;\", 1)\n            self.emit('if (PyObject_SetAttrString(result, \"%s\", value) < 0)' % a.name, 1)\n            self.emit('goto failed;', 2)\n            self.emit('Py_DECREF(value);', 1)\n        self.func_end()\n\n    def simpleSum(self, sum, name):\n        self.emit(\"PyObject* ast2obj_%s(%s_ty o)\" % (name, name), 0)\n        self.emit(\"{\", 0)\n        self.emit(\"switch(o) {\", 1)\n        for t in sum.types:\n            self.emit(\"case %s:\" % t.name, 2)\n            self.emit(\"Py_INCREF(%s_singleton);\" % t.name, 3)\n            self.emit(\"return %s_singleton;\" % t.name, 3)\n        self.emit(\"default:\", 2)\n        self.emit('/* should never happen, but just in case ... */', 3)\n        code = \"PyErr_Format(PyExc_SystemError, \\\"unknown %s found\\\");\" % name\n        self.emit(code, 3, reflow=False)\n        self.emit(\"return NULL;\", 3)\n        self.emit(\"}\", 1)\n        self.emit(\"}\", 0)\n\n    def visitProduct(self, prod, name):\n        self.func_begin(name)\n        self.emit(\"result = PyType_GenericNew(%s_type, NULL, NULL);\" % name, 1);\n        self.emit(\"if (!result) return NULL;\", 1)\n        for field in prod.fields:\n            self.visitField(field, name, 1, True)\n        self.func_end()\n\n    def visitConstructor(self, cons, enum, name):\n        self.emit(\"case %s_kind:\" % cons.name, 1)\n        self.emit(\"result = PyType_GenericNew(%s_type, NULL, NULL);\" % cons.name, 2);\n        self.emit(\"if (!result) goto failed;\", 2)\n        for f in cons.fields:\n            self.visitField(f, cons.name, 2, False)\n        self.emit(\"break;\", 2)\n\n    def visitField(self, field, name, depth, product):\n        def emit(s, d):\n            self.emit(s, depth + d)\n        if product:\n            value = \"o->%s\" % field.name\n        else:\n            value = \"o->v.%s.%s\" % (name, field.name)\n        self.set(field, value, depth)\n        emit(\"if (!value) goto failed;\", 0)\n        emit('if (PyObject_SetAttrString(result, \"%s\", value) == -1)' % field.name, 0)\n        emit(\"goto failed;\", 1)\n        emit(\"Py_DECREF(value);\", 0)\n\n    def emitSeq(self, field, value, depth, emit):\n        emit(\"seq = %s;\" % value, 0)\n        emit(\"n = asdl_seq_LEN(seq);\", 0)\n        emit(\"value = PyList_New(n);\", 0)\n        emit(\"if (!value) goto failed;\", 0)\n        emit(\"for (i = 0; i < n; i++) {\", 0)\n        self.set(\"value\", field, \"asdl_seq_GET(seq, i)\", depth + 1)\n        emit(\"if (!value1) goto failed;\", 1)\n        emit(\"PyList_SET_ITEM(value, i, value1);\", 1)\n        emit(\"value1 = NULL;\", 1)\n        emit(\"}\", 0)\n\n    def set(self, field, value, depth):\n        if field.seq:\n            # XXX should really check for is_simple, but that requires a symbol table\n            if field.type.value == \"cmpop\":\n                # While the sequence elements are stored as void*,\n                # ast2obj_cmpop expects an enum\n                self.emit(\"{\", depth)\n                self.emit(\"int i, n = asdl_seq_LEN(%s);\" % value, depth+1)\n                self.emit(\"value = PyList_New(n);\", depth+1)\n                self.emit(\"if (!value) goto failed;\", depth+1)\n                self.emit(\"for(i = 0; i < n; i++)\", depth+1)\n                # This cannot fail, so no need for error handling\n                self.emit(\"PyList_SET_ITEM(value, i, ast2obj_cmpop((cmpop_ty)asdl_seq_GET(%s, i)));\" % value,\n                          depth+2, reflow=False)\n                self.emit(\"}\", depth)\n            else:\n                self.emit(\"value = ast2obj_list(%s, ast2obj_%s);\" % (value, field.type), depth)\n        else:\n            ctype = get_c_type(field.type)\n            self.emit(\"value = ast2obj_%s(%s);\" % (field.type, value), depth, reflow=False)\n\n\nclass PartingShots(StaticVisitor):\n\n    CODE = \"\"\"\nPyObject* Ta27AST_mod2obj(mod_ty t)\n{\n    init_types();\n    return ast2obj_mod(t);\n}\n\n/* mode is 0 for \"exec\", 1 for \"eval\" and 2 for \"single\" input */\nmod_ty Ta27AST_obj2mod(PyObject* ast, PyArena* arena, int mode)\n{\n    mod_ty res;\n    PyObject *req_type[3];\n    char *req_name[3];\n    int isinstance;\n\n    req_type[0] = (PyObject*)Module_type;\n    req_type[1] = (PyObject*)Expression_type;\n    req_type[2] = (PyObject*)Interactive_type;\n\n    req_name[0] = \"Module\";\n    req_name[1] = \"Expression\";\n    req_name[2] = \"Interactive\";\n\n    assert(0 <= mode && mode <= 2);\n\n    init_types();\n\n    isinstance = PyObject_IsInstance(ast, req_type[mode]);\n    if (isinstance == -1)\n        return NULL;\n    if (!isinstance) {\n        PyErr_Format(PyExc_TypeError, \"expected %s node, got %.400s\",\n                     req_name[mode], Py_TYPE(ast)->tp_name);\n        return NULL;\n    }\n    if (obj2ast_mod(ast, &res, arena) != 0)\n        return NULL;\n    else\n        return res;\n}\n\nint Ta27AST_Check(PyObject* obj)\n{\n    init_types();\n    return PyObject_IsInstance(obj, (PyObject*)&AST_type);\n}\n\"\"\"\n\nclass ChainOfVisitors:\n    def __init__(self, *visitors):\n        self.visitors = visitors\n\n    def visit(self, object):\n        for v in self.visitors:\n            v.visit(object)\n            v.emit(\"\", 0)\n\ncommon_msg = \"/* File automatically generated by %s. */\\n\\n\"\n\nc_file_msg = \"\"\"\n/*\n   __version__ %s.\n\n   This module must be committed separately after each AST grammar change;\n   The __version__ number is set to the revision number of the commit\n   containing the grammar change.\n*/\n\n\"\"\"\n\ndef main(srcfile):\n    argv0 = sys.argv[0]\n    components = argv0.split(os.sep)\n    argv0 = os.sep.join(components[-2:])\n    auto_gen_msg = common_msg % argv0\n    mod = asdl.parse(srcfile)\n    mod.version = \"82160\"\n    if not asdl.check(mod):\n        sys.exit(1)\n    if INC_DIR:\n        p = \"%s/%s-ast.h\" % (INC_DIR, mod.name)\n        f = open(p, \"wb\")\n        f.write(auto_gen_msg)\n        f.write('#include \"asdl.h\"\\n\\n')\n        c = ChainOfVisitors(TypeDefVisitor(f),\n                            StructVisitor(f),\n                            PrototypeVisitor(f),\n                            )\n        c.visit(mod)\n        f.write(\"PyObject* Ta27AST_mod2obj(mod_ty t);\\n\")\n        f.write(\"mod_ty Ta27AST_obj2mod(PyObject* ast, PyArena* arena, int mode);\\n\")\n        f.write(\"int Ta27AST_Check(PyObject* obj);\\n\")\n        f.close()\n\n    if SRC_DIR:\n        p = os.path.join(SRC_DIR, str(mod.name) + \"-ast.c\")\n        f = open(p, \"wb\")\n        f.write(auto_gen_msg)\n        f.write(c_file_msg % mod.version)\n        f.write('#include \"Python.h\"\\n')\n        f.write('#include \"%s-ast.h\"\\n' % mod.name)\n        f.write('\\n')\n        f.write(\"static PyTypeObject AST_type;\\n\")\n        v = ChainOfVisitors(\n            PyTypesDeclareVisitor(f),\n            PyTypesVisitor(f),\n            Obj2ModPrototypeVisitor(f),\n            FunctionVisitor(f),\n            ObjVisitor(f),\n            Obj2ModVisitor(f),\n            ASTModuleVisitor(f),\n            PartingShots(f),\n            )\n        v.visit(mod)\n        f.close()\n\nif __name__ == \"__main__\":\n    import sys\n    import getopt\n\n    INC_DIR = ''\n    SRC_DIR = ''\n    opts, args = getopt.getopt(sys.argv[1:], \"h:c:\")\n    if len(opts) != 1:\n        print \"Must specify exactly one output file\"\n        sys.exit(1)\n    for o, v in opts:\n        if o == '-h':\n            INC_DIR = v\n        if o == '-c':\n            SRC_DIR = v\n    if len(args) != 1:\n        print \"Must specify single input file\"\n        sys.exit(1)\n    main(args[0])\n"
  },
  {
    "path": "ast27/Parser/bitset.c",
    "content": "\n/* Bitset primitives used by the parser generator */\n\n#include \"../Include/pgenheaders.h\"\n#include \"../Include/bitset.h\"\n\nbitset\nnewbitset(int nbits)\n{\n    int nbytes = NBYTES(nbits);\n    bitset ss = (char *)PyObject_MALLOC(sizeof(BYTE) *  nbytes);\n\n    if (ss == NULL)\n        Py_FatalError(\"no mem for bitset\");\n\n    ss += nbytes;\n    while (--nbytes >= 0)\n        *--ss = 0;\n    return ss;\n}\n\nvoid\ndelbitset(bitset ss)\n{\n    PyObject_FREE(ss);\n}\n\nint\naddbit(bitset ss, int ibit)\n{\n    int ibyte = BIT2BYTE(ibit);\n    BYTE mask = BIT2MASK(ibit);\n\n    if (ss[ibyte] & mask)\n        return 0; /* Bit already set */\n    ss[ibyte] |= mask;\n    return 1;\n}\n\n#if 0 /* Now a macro */\nint\ntestbit(bitset ss, int ibit)\n{\n    return (ss[BIT2BYTE(ibit)] & BIT2MASK(ibit)) != 0;\n}\n#endif\n\nint\nsamebitset(bitset ss1, bitset ss2, int nbits)\n{\n    int i;\n\n    for (i = NBYTES(nbits); --i >= 0; )\n        if (*ss1++ != *ss2++)\n            return 0;\n    return 1;\n}\n\nvoid\nmergebitset(bitset ss1, bitset ss2, int nbits)\n{\n    int i;\n\n    for (i = NBYTES(nbits); --i >= 0; )\n        *ss1++ |= *ss2++;\n}\n"
  },
  {
    "path": "ast27/Parser/grammar.c",
    "content": "\n/* Grammar implementation */\n\n#include \"Python.h\"\n#include \"../Include/pgenheaders.h\"\n\n#include <ctype.h>\n\n#include \"../Include/token.h\"\n#include \"../Include/grammar.h\"\n\n#ifdef RISCOS\n#include <unixlib.h>\n#endif\n\nPyAPI_DATA(int) Py_DebugFlag;\n\ngrammar *\nnewgrammar(int start)\n{\n    grammar *g;\n\n    g = (grammar *)PyObject_MALLOC(sizeof(grammar));\n    if (g == NULL)\n        Py_FatalError(\"no mem for new grammar\");\n    g->g_ndfas = 0;\n    g->g_dfa = NULL;\n    g->g_start = start;\n    g->g_ll.ll_nlabels = 0;\n    g->g_ll.ll_label = NULL;\n    g->g_accel = 0;\n    return g;\n}\n\ndfa *\nadddfa(grammar *g, int type, char *name)\n{\n    dfa *d;\n\n    g->g_dfa = (dfa *)PyObject_REALLOC(g->g_dfa,\n                                        sizeof(dfa) * (g->g_ndfas + 1));\n    if (g->g_dfa == NULL)\n        Py_FatalError(\"no mem to resize dfa in adddfa\");\n    d = &g->g_dfa[g->g_ndfas++];\n    d->d_type = type;\n    d->d_name = strdup(name);\n    d->d_nstates = 0;\n    d->d_state = NULL;\n    d->d_initial = -1;\n    d->d_first = NULL;\n    return d; /* Only use while fresh! */\n}\n\nint\naddstate(dfa *d)\n{\n    state *s;\n\n    d->d_state = (state *)PyObject_REALLOC(d->d_state,\n                                  sizeof(state) * (d->d_nstates + 1));\n    if (d->d_state == NULL)\n        Py_FatalError(\"no mem to resize state in addstate\");\n    s = &d->d_state[d->d_nstates++];\n    s->s_narcs = 0;\n    s->s_arc = NULL;\n    s->s_lower = 0;\n    s->s_upper = 0;\n    s->s_accel = NULL;\n    s->s_accept = 0;\n    return s - d->d_state;\n}\n\nvoid\naddarc(dfa *d, int from, int to, int lbl)\n{\n    state *s;\n    arc *a;\n\n    assert(0 <= from && from < d->d_nstates);\n    assert(0 <= to && to < d->d_nstates);\n\n    s = &d->d_state[from];\n    s->s_arc = (arc *)PyObject_REALLOC(s->s_arc, sizeof(arc) * (s->s_narcs + 1));\n    if (s->s_arc == NULL)\n        Py_FatalError(\"no mem to resize arc list in addarc\");\n    a = &s->s_arc[s->s_narcs++];\n    a->a_lbl = lbl;\n    a->a_arrow = to;\n}\n\nint\naddlabel(labellist *ll, int type, char *str)\n{\n    int i;\n    label *lb;\n\n    for (i = 0; i < ll->ll_nlabels; i++) {\n        if (ll->ll_label[i].lb_type == type &&\n            strcmp(ll->ll_label[i].lb_str, str) == 0)\n            return i;\n    }\n    ll->ll_label = (label *)PyObject_REALLOC(ll->ll_label,\n                                    sizeof(label) * (ll->ll_nlabels + 1));\n    if (ll->ll_label == NULL)\n        Py_FatalError(\"no mem to resize labellist in addlabel\");\n    lb = &ll->ll_label[ll->ll_nlabels++];\n    lb->lb_type = type;\n    lb->lb_str = strdup(str);\n    if (Py_DebugFlag)\n        printf(\"Label @ %8p, %d: %s\\n\", ll, ll->ll_nlabels,\n               Ta27Grammar_LabelRepr(lb));\n    return lb - ll->ll_label;\n}\n\n/* Same, but rather dies than adds */\n\nint\nfindlabel(labellist *ll, int type, char *str)\n{\n    int i;\n\n    for (i = 0; i < ll->ll_nlabels; i++) {\n        if (ll->ll_label[i].lb_type == type /*&&\n            strcmp(ll->ll_label[i].lb_str, str) == 0*/)\n            return i;\n    }\n    fprintf(stderr, \"Label %d/'%s' not found\\n\", type, str);\n    Py_FatalError(\"grammar.c:findlabel()\");\n    return 0; /* Make gcc -Wall happy */\n}\n\n/* Forward */\nstatic void translabel(grammar *, label *);\n\nvoid\ntranslatelabels(grammar *g)\n{\n    int i;\n\n#ifdef Py_DEBUG\n    printf(\"Translating labels ...\\n\");\n#endif\n    /* Don't translate EMPTY */\n    for (i = EMPTY+1; i < g->g_ll.ll_nlabels; i++)\n        translabel(g, &g->g_ll.ll_label[i]);\n}\n\nstatic void\ntranslabel(grammar *g, label *lb)\n{\n    int i;\n\n    if (Py_DebugFlag)\n        printf(\"Translating label %s ...\\n\", Ta27Grammar_LabelRepr(lb));\n\n    if (lb->lb_type == NAME) {\n        for (i = 0; i < g->g_ndfas; i++) {\n            if (strcmp(lb->lb_str, g->g_dfa[i].d_name) == 0) {\n                if (Py_DebugFlag)\n                    printf(\n                        \"Label %s is non-terminal %d.\\n\",\n                        lb->lb_str,\n                        g->g_dfa[i].d_type);\n                lb->lb_type = g->g_dfa[i].d_type;\n                free(lb->lb_str);\n                lb->lb_str = NULL;\n                return;\n            }\n        }\n        for (i = 0; i < (int)N_TOKENS; i++) {\n            if (strcmp(lb->lb_str, _Ta27Parser_TokenNames[i]) == 0) {\n                if (Py_DebugFlag)\n                    printf(\"Label %s is terminal %d.\\n\",\n                        lb->lb_str, i);\n                lb->lb_type = i;\n                free(lb->lb_str);\n                lb->lb_str = NULL;\n                return;\n            }\n        }\n        printf(\"Can't translate NAME label '%s'\\n\", lb->lb_str);\n        return;\n    }\n\n    if (lb->lb_type == STRING) {\n        if (isalpha(Py_CHARMASK(lb->lb_str[1])) ||\n            lb->lb_str[1] == '_') {\n            char *p;\n            char *src;\n            char *dest;\n            size_t name_len;\n            if (Py_DebugFlag)\n                printf(\"Label %s is a keyword\\n\", lb->lb_str);\n            lb->lb_type = NAME;\n            src = lb->lb_str + 1;\n            p = strchr(src, '\\'');\n            if (p)\n                name_len = p - src;\n            else\n                name_len = strlen(src);\n            dest = (char *)malloc(name_len + 1);\n            if (!dest) {\n                printf(\"Can't alloc dest '%s'\\n\", src);\n                return;\n            }\n            strncpy(dest, src, name_len);\n            dest[name_len] = '\\0';\n            free(lb->lb_str);\n            lb->lb_str = dest;\n        }\n        else if (lb->lb_str[2] == lb->lb_str[0]) {\n            int type = (int) Ta27Token_OneChar(lb->lb_str[1]);\n            if (type != OP) {\n                lb->lb_type = type;\n                free(lb->lb_str);\n                lb->lb_str = NULL;\n            }\n            else\n                printf(\"Unknown OP label %s\\n\",\n                    lb->lb_str);\n        }\n        else if (lb->lb_str[2] && lb->lb_str[3] == lb->lb_str[0]) {\n            int type = (int) Ta27Token_TwoChars(lb->lb_str[1],\n                                       lb->lb_str[2]);\n            if (type != OP) {\n                lb->lb_type = type;\n                free(lb->lb_str);\n                lb->lb_str = NULL;\n            }\n            else\n                printf(\"Unknown OP label %s\\n\",\n                    lb->lb_str);\n        }\n        else if (lb->lb_str[2] && lb->lb_str[3] && lb->lb_str[4] == lb->lb_str[0]) {\n            int type = (int) Ta27Token_ThreeChars(lb->lb_str[1],\n                                                lb->lb_str[2],\n                                                lb->lb_str[3]);\n            if (type != OP) {\n                lb->lb_type = type;\n                free(lb->lb_str);\n                lb->lb_str = NULL;\n            }\n            else\n                printf(\"Unknown OP label %s\\n\",\n                    lb->lb_str);\n        }\n        else\n            printf(\"Can't translate STRING label %s\\n\",\n                lb->lb_str);\n    }\n    else\n        printf(\"Can't translate label '%s'\\n\",\n               Ta27Grammar_LabelRepr(lb));\n}\n"
  },
  {
    "path": "ast27/Parser/grammar1.c",
    "content": "\n/* Grammar subroutines needed by parser */\n\n#include \"Python.h\"\n#include \"../Include/pgenheaders.h\"\n#include \"../Include/grammar.h\"\n#include \"../Include/token.h\"\n\n/* Return the DFA for the given type */\n\ndfa *\nTa27Grammar_FindDFA(grammar *g, register int type)\n{\n    register dfa *d;\n#if 1\n    /* Massive speed-up */\n    d = &g->g_dfa[type - NT_OFFSET];\n    assert(d->d_type == type);\n    return d;\n#else\n    /* Old, slow version */\n    register int i;\n\n    for (i = g->g_ndfas, d = g->g_dfa; --i >= 0; d++) {\n        if (d->d_type == type)\n            return d;\n    }\n    assert(0);\n    /* NOTREACHED */\n#endif\n}\n\nchar *\nTa27Grammar_LabelRepr(label *lb)\n{\n    static char buf[100];\n\n    if (lb->lb_type == ENDMARKER)\n        return \"EMPTY\";\n    else if (ISNONTERMINAL(lb->lb_type)) {\n        if (lb->lb_str == NULL) {\n            PyOS_snprintf(buf, sizeof(buf), \"NT%d\", lb->lb_type);\n            return buf;\n        }\n        else\n            return lb->lb_str;\n    }\n    else {\n        if (lb->lb_str == NULL)\n            return _Ta27Parser_TokenNames[lb->lb_type];\n        else {\n            PyOS_snprintf(buf, sizeof(buf), \"%.32s(%.32s)\",\n                _Ta27Parser_TokenNames[lb->lb_type], lb->lb_str);\n            return buf;\n        }\n    }\n}\n"
  },
  {
    "path": "ast27/Parser/node.c",
    "content": "/* Parse tree node implementation */\n\n#include \"Python.h\"\n#include \"../Include/node.h\"\n#include \"../Include/errcode.h\"\n\nnode *\nTa27Node_New(int type)\n{\n    node *n = (node *) PyObject_MALLOC(1 * sizeof(node));\n    if (n == NULL)\n        return NULL;\n    n->n_type = type;\n    n->n_str = NULL;\n    n->n_lineno = 0;\n    n->n_nchildren = 0;\n    n->n_child = NULL;\n    return n;\n}\n\n/* See comments at XXXROUNDUP below.  Returns -1 on overflow. */\nstatic int\nfancy_roundup(int n)\n{\n    /* Round up to the closest power of 2 >= n. */\n    int result = 256;\n    assert(n > 128);\n    while (result < n) {\n        result <<= 1;\n        if (result <= 0)\n            return -1;\n    }\n    return result;\n}\n\n/* A gimmick to make massive numbers of reallocs quicker.  The result is\n * a number >= the input.  In Ta27Node_AddChild, it's used like so, when\n * we're about to add child number current_size + 1:\n *\n *     if XXXROUNDUP(current_size) < XXXROUNDUP(current_size + 1):\n *         allocate space for XXXROUNDUP(current_size + 1) total children\n *     else:\n *         we already have enough space\n *\n * Since a node starts out empty, we must have\n *\n *     XXXROUNDUP(0) < XXXROUNDUP(1)\n *\n * so that we allocate space for the first child.  One-child nodes are very\n * common (presumably that would change if we used a more abstract form\n * of syntax tree), so to avoid wasting memory it's desirable that\n * XXXROUNDUP(1) == 1.  That in turn forces XXXROUNDUP(0) == 0.\n *\n * Else for 2 <= n <= 128, we round up to the closest multiple of 4.  Why 4?\n * Rounding up to a multiple of an exact power of 2 is very efficient, and\n * most nodes with more than one child have <= 4 kids.\n *\n * Else we call fancy_roundup() to grow proportionately to n.  We've got an\n * extreme case then (like test_longexp.py), and on many platforms doing\n * anything less than proportional growth leads to exorbitant runtime\n * (e.g., MacPython), or extreme fragmentation of user address space (e.g.,\n * Win98).\n *\n * In a run of compileall across the 2.3a0 Lib directory, Andrew MacIntyre\n * reported that, with this scheme, 89% of PyObject_REALLOC calls in\n * Ta27Node_AddChild passed 1 for the size, and 9% passed 4.  So this usually\n * wastes very little memory, but is very effective at sidestepping\n * platform-realloc disasters on vulnerable platforms.\n *\n * Note that this would be straightforward if a node stored its current\n * capacity.  The code is tricky to avoid that.\n */\n#define XXXROUNDUP(n) ((n) <= 1 ? (n) :                 \\\n               (n) <= 128 ? (((n) + 3) & ~3) :          \\\n               fancy_roundup(n))\n\n\nint\nTa27Node_AddChild(register node *n1, int type, char *str, int lineno, int col_offset)\n{\n    const int nch = n1->n_nchildren;\n    int current_capacity;\n    int required_capacity;\n    node *n;\n\n    if (nch == INT_MAX || nch < 0)\n        return E_OVERFLOW;\n\n    current_capacity = XXXROUNDUP(nch);\n    required_capacity = XXXROUNDUP(nch + 1);\n    if (current_capacity < 0 || required_capacity < 0)\n        return E_OVERFLOW;\n    if (current_capacity < required_capacity) {\n        if ((size_t)required_capacity > PY_SIZE_MAX / sizeof(node)) {\n            return E_NOMEM;\n        }\n        n = n1->n_child;\n        n = (node *) PyObject_REALLOC(n,\n                                      required_capacity * sizeof(node));\n        if (n == NULL)\n            return E_NOMEM;\n        n1->n_child = n;\n    }\n\n    n = &n1->n_child[n1->n_nchildren++];\n    n->n_type = type;\n    n->n_str = str;\n    n->n_lineno = lineno;\n    n->n_col_offset = col_offset;\n    n->n_nchildren = 0;\n    n->n_child = NULL;\n    return 0;\n}\n\n/* Forward */\nstatic void freechildren(node *);\nstatic Py_ssize_t sizeofchildren(node *n);\n\n\nvoid\nTa27Node_Free(node *n)\n{\n    if (n != NULL) {\n        freechildren(n);\n        PyObject_FREE(n);\n    }\n}\n\nPy_ssize_t\n_Ta27Node_SizeOf(node *n)\n{\n    Py_ssize_t res = 0;\n\n    if (n != NULL)\n        res = sizeof(node) + sizeofchildren(n);\n    return res;\n}\n\nstatic void\nfreechildren(node *n)\n{\n    int i;\n    for (i = NCH(n); --i >= 0; )\n        freechildren(CHILD(n, i));\n    if (n->n_child != NULL)\n        PyObject_FREE(n->n_child);\n    if (STR(n) != NULL)\n        PyObject_FREE(STR(n));\n}\n\nstatic Py_ssize_t\nsizeofchildren(node *n)\n{\n    Py_ssize_t res = 0;\n    int i;\n    for (i = NCH(n); --i >= 0; )\n        res += sizeofchildren(CHILD(n, i));\n    if (n->n_child != NULL)\n        /* allocated size of n->n_child array */\n        res += XXXROUNDUP(NCH(n)) * sizeof(node);\n    if (STR(n) != NULL)\n        res += strlen(STR(n)) + 1;\n    return res;\n}\n"
  },
  {
    "path": "ast27/Parser/parser.c",
    "content": "\n/* Parser implementation */\n\n/* For a description, see the comments at end of this file */\n\n/* XXX To do: error recovery */\n\n#include \"Python.h\"\n#include \"../Include/pgenheaders.h\"\n#include \"../Include/token.h\"\n#include \"../Include/grammar.h\"\n#include \"../Include/node.h\"\n#include \"parser.h\"\n#include \"../Include/errcode.h\"\n\n\n#ifdef Py_DEBUG\nPyAPI_DATA(int) Py_DebugFlag;\n#define D(x) if (!Py_DebugFlag); else x\n#else\n#define D(x)\n#endif\n\n\n/* STACK DATA TYPE */\n\nstatic void s_reset(stack *);\n\nstatic void\ns_reset(stack *s)\n{\n    s->s_top = &s->s_base[MAXSTACK];\n}\n\n#define s_empty(s) ((s)->s_top == &(s)->s_base[MAXSTACK])\n\nstatic int\ns_push(register stack *s, dfa *d, node *parent)\n{\n    register stackentry *top;\n    if (s->s_top == s->s_base) {\n        fprintf(stderr, \"s_push: parser stack overflow\\n\");\n        return E_NOMEM;\n    }\n    top = --s->s_top;\n    top->s_dfa = d;\n    top->s_parent = parent;\n    top->s_state = 0;\n    return 0;\n}\n\n#ifdef Py_DEBUG\n\nstatic void\ns_pop(register stack *s)\n{\n    if (s_empty(s))\n        Py_FatalError(\"s_pop: parser stack underflow -- FATAL\");\n    s->s_top++;\n}\n\n#else /* !Py_DEBUG */\n\n#define s_pop(s) (s)->s_top++\n\n#endif\n\n\n/* PARSER CREATION */\n\nparser_state *\nTa27Parser_New(grammar *g, int start)\n{\n    parser_state *ps;\n\n    if (!g->g_accel)\n        Ta27Grammar_AddAccelerators(g);\n    ps = (parser_state *)PyMem_MALLOC(sizeof(parser_state));\n    if (ps == NULL)\n        return NULL;\n    ps->p_grammar = g;\n#ifdef PY_PARSER_REQUIRES_FUTURE_KEYWORD\n    ps->p_flags = 0;\n#endif\n    ps->p_tree = Ta27Node_New(start);\n    if (ps->p_tree == NULL) {\n        PyMem_FREE(ps);\n        return NULL;\n    }\n    s_reset(&ps->p_stack);\n    (void) s_push(&ps->p_stack, Ta27Grammar_FindDFA(g, start), ps->p_tree);\n    return ps;\n}\n\nvoid\nTa27Parser_Delete(parser_state *ps)\n{\n    /* NB If you want to save the parse tree,\n       you must set p_tree to NULL before calling delparser! */\n    Ta27Node_Free(ps->p_tree);\n    PyMem_FREE(ps);\n}\n\n\n/* PARSER STACK OPERATIONS */\n\nstatic int\nshift(register stack *s, int type, char *str, int newstate, int lineno, int col_offset)\n{\n    int err;\n    assert(!s_empty(s));\n    err = Ta27Node_AddChild(s->s_top->s_parent, type, str, lineno, col_offset);\n    if (err)\n        return err;\n    s->s_top->s_state = newstate;\n    return 0;\n}\n\nstatic int\npush(register stack *s, int type, dfa *d, int newstate, int lineno, int col_offset)\n{\n    int err;\n    register node *n;\n    n = s->s_top->s_parent;\n    assert(!s_empty(s));\n    err = Ta27Node_AddChild(n, type, (char *)NULL, lineno, col_offset);\n    if (err)\n        return err;\n    s->s_top->s_state = newstate;\n    return s_push(s, d, CHILD(n, NCH(n)-1));\n}\n\n\n/* PARSER PROPER */\n\nstatic int\nclassify(parser_state *ps, int type, char *str)\n{\n    grammar *g = ps->p_grammar;\n    register int n = g->g_ll.ll_nlabels;\n\n    if (type == NAME) {\n        register char *s = str;\n        register label *l = g->g_ll.ll_label;\n        register int i;\n        for (i = n; i > 0; i--, l++) {\n            if (l->lb_type != NAME || l->lb_str == NULL ||\n                l->lb_str[0] != s[0] ||\n                strcmp(l->lb_str, s) != 0)\n                continue;\n#ifdef PY_PARSER_REQUIRES_FUTURE_KEYWORD\n            if (ps->p_flags & CO_FUTURE_PRINT_FUNCTION &&\n                s[0] == 'p' && strcmp(s, \"print\") == 0) {\n                break; /* no longer a keyword */\n            }\n#endif\n            D(printf(\"It's a keyword\\n\"));\n            return n - i;\n        }\n    }\n\n    {\n        register label *l = g->g_ll.ll_label;\n        register int i;\n        for (i = n; i > 0; i--, l++) {\n            if (l->lb_type == type && l->lb_str == NULL) {\n                D(printf(\"It's a token we know\\n\"));\n                return n - i;\n            }\n        }\n    }\n\n    D(printf(\"Illegal token\\n\"));\n    return -1;\n}\n\n#ifdef PY_PARSER_REQUIRES_FUTURE_KEYWORD\nstatic void\nfuture_hack(parser_state *ps)\n{\n    node *n = ps->p_stack.s_top->s_parent;\n    node *ch, *cch;\n    int i;\n\n    /* from __future__ import ..., must have at least 4 children */\n    n = CHILD(n, 0);\n    if (NCH(n) < 4)\n        return;\n    ch = CHILD(n, 0);\n    if (STR(ch) == NULL || strcmp(STR(ch), \"from\") != 0)\n        return;\n    ch = CHILD(n, 1);\n    if (NCH(ch) == 1 && STR(CHILD(ch, 0)) &&\n        strcmp(STR(CHILD(ch, 0)), \"__future__\") != 0)\n        return;\n    ch = CHILD(n, 3);\n    /* ch can be a star, a parenthesis or import_as_names */\n    if (TYPE(ch) == STAR)\n        return;\n    if (TYPE(ch) == LPAR)\n        ch = CHILD(n, 4);\n\n    for (i = 0; i < NCH(ch); i += 2) {\n        cch = CHILD(ch, i);\n        if (NCH(cch) >= 1 && TYPE(CHILD(cch, 0)) == NAME) {\n            char *str_ch = STR(CHILD(cch, 0));\n            if (strcmp(str_ch, FUTURE_WITH_STATEMENT) == 0) {\n                ps->p_flags |= CO_FUTURE_WITH_STATEMENT;\n            } else if (strcmp(str_ch, FUTURE_PRINT_FUNCTION) == 0) {\n                ps->p_flags |= CO_FUTURE_PRINT_FUNCTION;\n            } else if (strcmp(str_ch, FUTURE_UNICODE_LITERALS) == 0) {\n                ps->p_flags |= CO_FUTURE_UNICODE_LITERALS;\n            }\n        }\n    }\n}\n#endif /* future keyword */\n\nint\nTa27Parser_AddToken(register parser_state *ps, register int type, char *str,\n                  int lineno, int col_offset, int *expected_ret)\n{\n    register int ilabel;\n    int err;\n\n    D(printf(\"Token %s/'%s' ... \", _Ta27Parser_TokenNames[type], str));\n\n    /* Find out which label this token is */\n    ilabel = classify(ps, type, str);\n    if (ilabel < 0)\n        return E_SYNTAX;\n\n    /* Loop until the token is shifted or an error occurred */\n    for (;;) {\n        /* Fetch the current dfa and state */\n        register dfa *d = ps->p_stack.s_top->s_dfa;\n        register state *s = &d->d_state[ps->p_stack.s_top->s_state];\n\n        D(printf(\" DFA '%s', state %d:\",\n            d->d_name, ps->p_stack.s_top->s_state));\n\n        /* Check accelerator */\n        if (s->s_lower <= ilabel && ilabel < s->s_upper) {\n            register int x = s->s_accel[ilabel - s->s_lower];\n            if (x != -1) {\n                if (x & (1<<7)) {\n                    /* Push non-terminal */\n                    int nt = (x >> 8) + NT_OFFSET;\n                    int arrow = x & ((1<<7)-1);\n                    dfa *d1 = Ta27Grammar_FindDFA(\n                        ps->p_grammar, nt);\n                    if ((err = push(&ps->p_stack, nt, d1,\n                        arrow, lineno, col_offset)) > 0) {\n                        D(printf(\" MemError: push\\n\"));\n                        return err;\n                    }\n                    D(printf(\" Push ...\\n\"));\n                    continue;\n                }\n\n                /* Shift the token */\n                if ((err = shift(&ps->p_stack, type, str,\n                                x, lineno, col_offset)) > 0) {\n                    D(printf(\" MemError: shift.\\n\"));\n                    return err;\n                }\n                D(printf(\" Shift.\\n\"));\n                /* Pop while we are in an accept-only state */\n                while (s = &d->d_state\n                                [ps->p_stack.s_top->s_state],\n                    s->s_accept && s->s_narcs == 1) {\n                    D(printf(\"  DFA '%s', state %d: \"\n                             \"Direct pop.\\n\",\n                             d->d_name,\n                             ps->p_stack.s_top->s_state));\n#ifdef PY_PARSER_REQUIRES_FUTURE_KEYWORD\n                    if (d->d_name[0] == 'i' &&\n                        strcmp(d->d_name,\n                           \"import_stmt\") == 0)\n                        future_hack(ps);\n#endif\n                    s_pop(&ps->p_stack);\n                    if (s_empty(&ps->p_stack)) {\n                        D(printf(\"  ACCEPT.\\n\"));\n                        return E_DONE;\n                    }\n                    d = ps->p_stack.s_top->s_dfa;\n                }\n                return E_OK;\n            }\n        }\n\n        if (s->s_accept) {\n#ifdef PY_PARSER_REQUIRES_FUTURE_KEYWORD\n            if (d->d_name[0] == 'i' &&\n                strcmp(d->d_name, \"import_stmt\") == 0)\n                future_hack(ps);\n#endif\n            /* Pop this dfa and try again */\n            s_pop(&ps->p_stack);\n            D(printf(\" Pop ...\\n\"));\n            if (s_empty(&ps->p_stack)) {\n                D(printf(\" Error: bottom of stack.\\n\"));\n                return E_SYNTAX;\n            }\n            continue;\n        }\n\n        /* Stuck, report syntax error */\n        D(printf(\" Error.\\n\"));\n        if (expected_ret) {\n            if (s->s_lower == s->s_upper - 1) {\n                /* Only one possible expected token */\n                *expected_ret = ps->p_grammar->\n                    g_ll.ll_label[s->s_lower].lb_type;\n            }\n            else\n                *expected_ret = -1;\n        }\n        return E_SYNTAX;\n    }\n}\n\n\n#ifdef Py_DEBUG\n\n/* DEBUG OUTPUT */\n\nvoid\ndumptree(grammar *g, node *n)\n{\n    int i;\n\n    if (n == NULL)\n        printf(\"NIL\");\n    else {\n        label l;\n        l.lb_type = TYPE(n);\n        l.lb_str = STR(n);\n        printf(\"%s\", Ta27Grammar_LabelRepr(&l));\n        if (ISNONTERMINAL(TYPE(n))) {\n            printf(\"(\");\n            for (i = 0; i < NCH(n); i++) {\n                if (i > 0)\n                    printf(\",\");\n                dumptree(g, CHILD(n, i));\n            }\n            printf(\")\");\n        }\n    }\n}\n\nvoid\nshowtree(grammar *g, node *n)\n{\n    int i;\n\n    if (n == NULL)\n        return;\n    if (ISNONTERMINAL(TYPE(n))) {\n        for (i = 0; i < NCH(n); i++)\n            showtree(g, CHILD(n, i));\n    }\n    else if (ISTERMINAL(TYPE(n))) {\n        printf(\"%s\", _Ta27Parser_TokenNames[TYPE(n)]);\n        if (TYPE(n) == NUMBER || TYPE(n) == NAME)\n            printf(\"(%s)\", STR(n));\n        printf(\" \");\n    }\n    else\n        printf(\"? \");\n}\n\n#endif /* Py_DEBUG */\n\n/*\n\nDescription\n-----------\n\nThe parser's interface is different than usual: the function addtoken()\nmust be called for each token in the input.  This makes it possible to\nturn it into an incremental parsing system later.  The parsing system\nconstructs a parse tree as it goes.\n\nA parsing rule is represented as a Deterministic Finite-state Automaton\n(DFA).  A node in a DFA represents a state of the parser; an arc represents\na transition.  Transitions are either labeled with terminal symbols or\nwith non-terminals.  When the parser decides to follow an arc labeled\nwith a non-terminal, it is invoked recursively with the DFA representing\nthe parsing rule for that as its initial state; when that DFA accepts,\nthe parser that invoked it continues.  The parse tree constructed by the\nrecursively called parser is inserted as a child in the current parse tree.\n\nThe DFA's can be constructed automatically from a more conventional\nlanguage description.  An extended LL(1) grammar (ELL(1)) is suitable.\nCertain restrictions make the parser's life easier: rules that can produce\nthe empty string should be outlawed (there are other ways to put loops\nor optional parts in the language).  To avoid the need to construct\nFIRST sets, we can require that all but the last alternative of a rule\n(really: arc going out of a DFA's state) must begin with a terminal\nsymbol.\n\nAs an example, consider this grammar:\n\nexpr:   term (OP term)*\nterm:   CONSTANT | '(' expr ')'\n\nThe DFA corresponding to the rule for expr is:\n\n------->.---term-->.------->\n    ^          |\n    |          |\n    \\----OP----/\n\nThe parse tree generated for the input a+b is:\n\n(expr: (term: (NAME: a)), (OP: +), (term: (NAME: b)))\n\n*/\n"
  },
  {
    "path": "ast27/Parser/parser.h",
    "content": "#ifndef Ta27_PARSER_H\n#define Ta27_PARSER_H\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n\n/* Parser interface */\n\n#define MAXSTACK 1500\n\ntypedef struct {\n\tint\t\t s_state;\t/* State in current DFA */\n\tdfa\t\t*s_dfa;\t\t/* Current DFA */\n\tstruct _node\t*s_parent;\t/* Where to add next node */\n} stackentry;\n\ntypedef struct {\n\tstackentry\t*s_top;\t\t/* Top entry */\n\tstackentry\t s_base[MAXSTACK];/* Array of stack entries */\n\t\t\t\t\t/* NB The stack grows down */\n} stack;\n\ntypedef struct {\n\tstack\t \tp_stack;\t/* Stack of parser states */\n\tgrammar\t\t*p_grammar;\t/* Grammar to use */\n\tnode\t\t*p_tree;\t/* Top of parse tree */\n#ifdef PY_PARSER_REQUIRES_FUTURE_KEYWORD\n\tunsigned long\tp_flags;\t/* see co_flags in Include/code.h */\n#endif\n} parser_state;\n\nparser_state *Ta27Parser_New(grammar *g, int start);\nvoid Ta27Parser_Delete(parser_state *ps);\nint Ta27Parser_AddToken(parser_state *ps, int type, char *str, int lineno, int col_offset,\n                      int *expected_ret);\nvoid Ta27Grammar_AddAccelerators(grammar *g);\n\n#ifdef __cplusplus\n}\n#endif\n#endif /* !Ta27_PARSER_H */\n"
  },
  {
    "path": "ast27/Parser/parsetok.c",
    "content": "\n/* Parser-tokenizer link implementation */\n\n#include \"../Include/pgenheaders.h\"\n#include \"tokenizer.h\"\n#include \"../Include/node.h\"\n#include \"../Include/grammar.h\"\n#include \"parser.h\"\n#include \"../Include/parsetok.h\"\n#include \"../Include/errcode.h\"\n#include \"../Include/graminit.h\"\n\nint Ta27_TabcheckFlag;\n\n\n/* Forward */\nstatic node *parsetok(struct tok_state *, grammar *, int, perrdetail *, int *);\nstatic void initerr(perrdetail *err_ret, const char* filename);\nstatic int initerr_object(perrdetail *err_ret, PyObject *filename);\n\n/* Parse input coming from a string.  Return error code, print some errors. */\nnode *\nTa27Parser_ParseString(const char *s, grammar *g, int start, perrdetail *err_ret)\n{\n    return Ta27Parser_ParseStringFlagsFilename(s, NULL, g, start, err_ret, 0);\n}\n\nnode *\nTa27Parser_ParseStringFlags(const char *s, grammar *g, int start,\n                          perrdetail *err_ret, int flags)\n{\n    return Ta27Parser_ParseStringFlagsFilename(s, NULL,\n                                             g, start, err_ret, flags);\n}\n\nnode *\nTa27Parser_ParseStringFlagsFilename(const char *s, const char *filename,\n                          grammar *g, int start,\n                          perrdetail *err_ret, int flags)\n{\n    int iflags = flags;\n    return Ta27Parser_ParseStringFlagsFilenameEx(s, filename, g, start,\n                                               err_ret, &iflags);\n}\n\nnode *\nTa27Parser_ParseStringFlagsFilenameEx(const char *s, const char *filename,\n                          grammar *g, int start,\n                          perrdetail *err_ret, int *flags)\n{\n    struct tok_state *tok;\n\n    initerr(err_ret, filename);\n\n    if ((tok = Ta27Tokenizer_FromString(s, start == file_input)) == NULL) {\n        err_ret->error = PyErr_Occurred() ? E_DECODE : E_NOMEM;\n        return NULL;\n    }\n\n    tok->filename = filename ? filename : \"<string>\";\n    if (Ta27_TabcheckFlag || Py_VerboseFlag) {\n        tok->altwarning = (tok->filename != NULL);\n        if (Ta27_TabcheckFlag >= 2)\n            tok->alterror++;\n    }\n\n    return parsetok(tok, g, start, err_ret, flags);\n}\n\nnode *\nTa27Parser_ParseStringObject(const char *s, PyObject *filename,\n                           grammar *g, int start,\n                           perrdetail *err_ret, int *flags)\n{\n    struct tok_state *tok;\n    int exec_input = start == file_input;\n\n    initerr_object(err_ret, filename);\n\n    if (*flags & PyPARSE_IGNORE_COOKIE)\n        tok = Ta27Tokenizer_FromUTF8(s, exec_input);\n    else\n        tok = Ta27Tokenizer_FromString(s, exec_input);\n\n    if (tok == NULL) {\n        err_ret->error = PyErr_Occurred() ? E_DECODE : E_NOMEM;\n        return NULL;\n    }\n\n#ifndef PGEN\n    Py_INCREF(err_ret->filename);\n    tok->filename = PyUnicode_AsUTF8(err_ret->filename);\n#endif\n    return parsetok(tok, g, start, err_ret, flags);\n}\n\n/* Parse input coming from a file.  Return error code, print some errors. */\n\nnode *\nTa27Parser_ParseFile(FILE *fp, const char *filename, grammar *g, int start,\n                   char *ps1, char *ps2, perrdetail *err_ret)\n{\n    return Ta27Parser_ParseFileFlags(fp, filename, g, start, ps1, ps2,\n                                   err_ret, 0);\n}\n\nnode *\nTa27Parser_ParseFileFlags(FILE *fp, const char *filename, grammar *g, int start,\n                        char *ps1, char *ps2, perrdetail *err_ret, int flags)\n{\n    int iflags = flags;\n    return Ta27Parser_ParseFileFlagsEx(fp, filename, g, start, ps1, ps2, err_ret, &iflags);\n}\n\nnode *\nTa27Parser_ParseFileFlagsEx(FILE *fp, const char *filename, grammar *g, int start,\n                          char *ps1, char *ps2, perrdetail *err_ret, int *flags)\n{\n    struct tok_state *tok;\n\n    initerr(err_ret, filename);\n\n    if ((tok = Ta27Tokenizer_FromFile(fp, ps1, ps2)) == NULL) {\n        err_ret->error = E_NOMEM;\n        return NULL;\n    }\n    tok->filename = filename;\n    if (Ta27_TabcheckFlag || Py_VerboseFlag) {\n        tok->altwarning = (filename != NULL);\n        if (Ta27_TabcheckFlag >= 2)\n            tok->alterror++;\n    }\n\n    return parsetok(tok, g, start, err_ret, flags);\n}\n\n#if 0\nstatic char with_msg[] =\n\"%s:%d: Warning: 'with' will become a reserved keyword in Python 2.6\\n\";\n\nstatic char as_msg[] =\n\"%s:%d: Warning: 'as' will become a reserved keyword in Python 2.6\\n\";\n\nstatic void\nwarn(const char *msg, const char *filename, int lineno)\n{\n    if (filename == NULL)\n        filename = \"<string>\";\n    PySys_WriteStderr(msg, filename, lineno);\n}\n#endif\n\n\ntypedef struct {\n    struct {\n        int lineno;\n        char *comment;\n    } *items;\n    size_t size;\n    size_t num_items;\n} growable_comment_array;\n\nstatic int\ngrowable_comment_array_init(growable_comment_array *arr, size_t initial_size) {\n    assert(initial_size > 0);\n    arr->items = malloc(initial_size * sizeof(*arr->items));\n    arr->size = initial_size;\n    arr->num_items = 0;\n\n    return arr->items != NULL;\n}\n\nstatic int\ngrowable_comment_array_add(growable_comment_array *arr, int lineno, char *comment) {\n    if (arr->num_items >= arr->size) {\n        arr->size *= 2;\n        arr->items = realloc(arr->items, arr->size * sizeof(*arr->items));\n        if (!arr->items) {\n            return 0;\n        }\n    }\n\n    arr->items[arr->num_items].lineno = lineno;\n    arr->items[arr->num_items].comment = comment;\n    arr->num_items++;\n    return 1;\n}\n\nstatic void\ngrowable_comment_array_deallocate(growable_comment_array *arr) {\n    unsigned i;\n    for (i = 0; i < arr->num_items; i++) {\n        PyObject_FREE(arr->items[i].comment);\n    }\n    free(arr->items);\n}\n\n\n/* Parse input coming from the given tokenizer structure.\n   Return error code. */\n\nstatic node *\nparsetok(struct tok_state *tok, grammar *g, int start, perrdetail *err_ret,\n         int *flags)\n{\n    parser_state *ps;\n    node *n;\n    int started = 0;\n\n    growable_comment_array type_ignores;\n    if (!growable_comment_array_init(&type_ignores, 10)) {\n        err_ret->error = E_NOMEM;\n        Ta27Tokenizer_Free(tok);\n        return NULL;\n    }\n\n    if ((ps = Ta27Parser_New(g, start)) == NULL) {\n        fprintf(stderr, \"no mem for new parser\\n\");\n        err_ret->error = E_NOMEM;\n        Ta27Tokenizer_Free(tok);\n        return NULL;\n    }\n#ifdef PY_PARSER_REQUIRES_FUTURE_KEYWORD\n    if (*flags & PyPARSE_PRINT_IS_FUNCTION) {\n        ps->p_flags |= CO_FUTURE_PRINT_FUNCTION;\n    }\n    if (*flags & PyPARSE_UNICODE_LITERALS) {\n        ps->p_flags |= CO_FUTURE_UNICODE_LITERALS;\n    }\n\n#endif\n\n    for (;;) {\n        char *a, *b;\n        int type;\n        size_t len;\n        char *str;\n        int col_offset;\n\n        type = Ta27Tokenizer_Get(tok, &a, &b);\n        if (type == ERRORTOKEN) {\n            err_ret->error = tok->done;\n            break;\n        }\n        if (type == ENDMARKER && started) {\n            type = NEWLINE; /* Add an extra newline */\n            started = 0;\n            /* Add the right number of dedent tokens,\n               except if a certain flag is given --\n               codeop.py uses this. */\n            if (tok->indent &&\n                !(*flags & PyPARSE_DONT_IMPLY_DEDENT))\n            {\n                tok->pendin = -tok->indent;\n                tok->indent = 0;\n            }\n        }\n        else\n            started = 1;\n        len = b - a; /* XXX this may compute NULL - NULL */\n        str = (char *) PyObject_MALLOC(len + 1);\n        if (str == NULL) {\n            fprintf(stderr, \"no mem for next token\\n\");\n            err_ret->error = E_NOMEM;\n            break;\n        }\n        if (len > 0)\n            strncpy(str, a, len);\n        str[len] = '\\0';\n\n#ifdef PY_PARSER_REQUIRES_FUTURE_KEYWORD\n#endif\n        if (a >= tok->line_start)\n            col_offset = a - tok->line_start;\n        else\n            col_offset = -1;\n\n        if (type == TYPE_IGNORE) {\n            if (!growable_comment_array_add(&type_ignores, tok->lineno, str)) {\n                err_ret->error = E_NOMEM;\n                break;\n            }\n            continue;\n        }\n\n        if ((err_ret->error =\n             Ta27Parser_AddToken(ps, (int)type, str, tok->lineno, col_offset,\n                               &(err_ret->expected))) != E_OK) {\n            if (err_ret->error != E_DONE) {\n                PyObject_FREE(str);\n                err_ret->token = type;\n            }\n            break;\n        }\n    }\n\n    if (err_ret->error == E_DONE) {\n        n = ps->p_tree;\n        ps->p_tree = NULL;\n\n        if (n->n_type == file_input) {\n            /* Put type_ignore nodes in the ENDMARKER of file_input. */\n            int num;\n            node *ch;\n            size_t i;\n\n            num = NCH(n);\n            ch = CHILD(n, num - 1);\n            REQ(ch, ENDMARKER);\n\n            for (i = 0; i < type_ignores.num_items; i++) {\n                int res = Ta27Node_AddChild(ch, TYPE_IGNORE, type_ignores.items[i].comment,\n                                            type_ignores.items[i].lineno, 0);\n                if (res != 0) {\n                    err_ret->error = res;\n                    Ta27Node_Free(n);\n                    n = NULL;\n                    break;\n                }\n                type_ignores.items[i].comment = NULL;\n            }\n        }\n    }\n    else\n        n = NULL;\n\n    growable_comment_array_deallocate(&type_ignores);\n\n#ifdef PY_PARSER_REQUIRES_FUTURE_KEYWORD\n    *flags = ps->p_flags;\n#endif\n    Ta27Parser_Delete(ps);\n\n    if (n == NULL) {\n        if (tok->lineno <= 1 && tok->done == E_EOF)\n            err_ret->error = E_EOF;\n        err_ret->lineno = tok->lineno;\n        if (tok->buf != NULL) {\n            char *text = NULL;\n            size_t len;\n            assert(tok->cur - tok->buf < INT_MAX);\n            err_ret->offset = (int)(tok->cur - tok->buf);\n            len = tok->inp - tok->buf;\n#ifdef Py_USING_UNICODE\n            text = Ta27Tokenizer_RestoreEncoding(tok, len, &err_ret->offset);\n\n#endif\n            if (text == NULL) {\n                text = (char *) PyObject_MALLOC(len + 1);\n                if (text != NULL) {\n                    if (len > 0)\n                        strncpy(text, tok->buf, len);\n                    text[len] = '\\0';\n                }\n            }\n            err_ret->text = text;\n        }\n    } else if (tok->encoding != NULL) {\n        /* 'nodes->n_str' uses PyObject_*, while 'tok->encoding' was\n         * allocated using PyMem_\n         */\n        node* r = Ta27Node_New(encoding_decl);\n        if (r)\n            r->n_str = PyObject_MALLOC(strlen(tok->encoding)+1);\n        if (!r || !r->n_str) {\n            err_ret->error = E_NOMEM;\n            if (r)\n                PyObject_FREE(r);\n            n = NULL;\n            goto done;\n        }\n        strcpy(r->n_str, tok->encoding);\n        PyMem_FREE(tok->encoding);\n        tok->encoding = NULL;\n        r->n_nchildren = 1;\n        r->n_child = n;\n        n = r;\n    }\n\ndone:\n    Ta27Tokenizer_Free(tok);\n\n    return n;\n}\n\nstatic void\niniterr(perrdetail *err_ret, const char *filename)\n{\n  initerr_object(err_ret, PyUnicode_FromString(filename));\n}\n\nstatic int\niniterr_object(perrdetail *err_ret, PyObject *filename)\n{\n    err_ret->error = E_OK;\n    err_ret->lineno = 0;\n    err_ret->offset = 0;\n    err_ret->text = NULL;\n    err_ret->token = -1;\n    err_ret->expected = -1;\n#ifndef PGEN\n    if (filename) {\n        Py_INCREF(filename);\n        err_ret->filename = filename;\n    }\n    else {\n        err_ret->filename = PyUnicode_FromString(\"<string>\");\n        if (err_ret->filename == NULL) {\n            err_ret->error = E_ERROR;\n            return -1;\n        }\n    }\n#endif\n    return 0;\n}\n"
  },
  {
    "path": "ast27/Parser/spark.py",
    "content": "#  Copyright (c) 1998-2002 John Aycock\n#\n#  Permission is hereby granted, free of charge, to any person obtaining\n#  a copy of this software and associated documentation files (the\n#  \"Software\"), to deal in the Software without restriction, including\n#  without limitation the rights to use, copy, modify, merge, publish,\n#  distribute, sublicense, and/or sell copies of the Software, and to\n#  permit persons to whom the Software is furnished to do so, subject to\n#  the following conditions:\n#\n#  The above copyright notice and this permission notice shall be\n#  included in all copies or substantial portions of the Software.\n#\n#  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n#  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n#  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\n#  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\n#  CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\n#  TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n#  SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n__version__ = 'SPARK-0.7 (pre-alpha-5)'\n\nimport re\nimport string\n\ndef _namelist(instance):\n    namelist, namedict, classlist = [], {}, [instance.__class__]\n    for c in classlist:\n        for b in c.__bases__:\n            classlist.append(b)\n        for name in c.__dict__.keys():\n            if not namedict.has_key(name):\n                namelist.append(name)\n                namedict[name] = 1\n    return namelist\n\nclass GenericScanner:\n    def __init__(self, flags=0):\n        pattern = self.reflect()\n        self.re = re.compile(pattern, re.VERBOSE|flags)\n\n        self.index2func = {}\n        for name, number in self.re.groupindex.items():\n            self.index2func[number-1] = getattr(self, 't_' + name)\n\n    def makeRE(self, name):\n        doc = getattr(self, name).__doc__\n        rv = '(?P<%s>%s)' % (name[2:], doc)\n        return rv\n\n    def reflect(self):\n        rv = []\n        for name in _namelist(self):\n            if name[:2] == 't_' and name != 't_default':\n                rv.append(self.makeRE(name))\n\n        rv.append(self.makeRE('t_default'))\n        return string.join(rv, '|')\n\n    def error(self, s, pos):\n        print \"Lexical error at position %s\" % pos\n        raise SystemExit\n\n    def tokenize(self, s):\n        pos = 0\n        n = len(s)\n        while pos < n:\n            m = self.re.match(s, pos)\n            if m is None:\n                self.error(s, pos)\n\n            groups = m.groups()\n            for i in range(len(groups)):\n                if groups[i] and self.index2func.has_key(i):\n                    self.index2func[i](groups[i])\n            pos = m.end()\n\n    def t_default(self, s):\n        r'( . | \\n )+'\n        print \"Specification error: unmatched input\"\n        raise SystemExit\n\n#\n#  Extracted from GenericParser and made global so that [un]picking works.\n#\nclass _State:\n    def __init__(self, stateno, items):\n        self.T, self.complete, self.items = [], [], items\n        self.stateno = stateno\n\nclass GenericParser:\n    #\n    #  An Earley parser, as per J. Earley, \"An Efficient Context-Free\n    #  Parsing Algorithm\", CACM 13(2), pp. 94-102.  Also J. C. Earley,\n    #  \"An Efficient Context-Free Parsing Algorithm\", Ph.D. thesis,\n    #  Carnegie-Mellon University, August 1968.  New formulation of\n    #  the parser according to J. Aycock, \"Practical Earley Parsing\n    #  and the SPARK Toolkit\", Ph.D. thesis, University of Victoria,\n    #  2001, and J. Aycock and R. N. Horspool, \"Practical Earley\n    #  Parsing\", unpublished paper, 2001.\n    #\n\n    def __init__(self, start):\n        self.rules = {}\n        self.rule2func = {}\n        self.rule2name = {}\n        self.collectRules()\n        self.augment(start)\n        self.ruleschanged = 1\n\n    _NULLABLE = '\\e_'\n    _START = 'START'\n    _BOF = '|-'\n\n    #\n    #  When pickling, take the time to generate the full state machine;\n    #  some information is then extraneous, too.  Unfortunately we\n    #  can't save the rule2func map.\n    #\n    def __getstate__(self):\n        if self.ruleschanged:\n            #\n            #  XXX - duplicated from parse()\n            #\n            self.computeNull()\n            self.newrules = {}\n            self.new2old = {}\n            self.makeNewRules()\n            self.ruleschanged = 0\n            self.edges, self.cores = {}, {}\n            self.states = { 0: self.makeState0() }\n            self.makeState(0, self._BOF)\n        #\n        #  XXX - should find a better way to do this..\n        #\n        changes = 1\n        while changes:\n            changes = 0\n            for k, v in self.edges.items():\n                if v is None:\n                    state, sym = k\n                    if self.states.has_key(state):\n                        self.goto(state, sym)\n                        changes = 1\n        rv = self.__dict__.copy()\n        for s in self.states.values():\n            del s.items\n        del rv['rule2func']\n        del rv['nullable']\n        del rv['cores']\n        return rv\n\n    def __setstate__(self, D):\n        self.rules = {}\n        self.rule2func = {}\n        self.rule2name = {}\n        self.collectRules()\n        start = D['rules'][self._START][0][1][1]        # Blech.\n        self.augment(start)\n        D['rule2func'] = self.rule2func\n        D['makeSet'] = self.makeSet_fast\n        self.__dict__ = D\n\n    #\n    #  A hook for GenericASTBuilder and GenericASTMatcher.  Mess\n    #  thee not with this; nor shall thee toucheth the _preprocess\n    #  argument to addRule.\n    #\n    def preprocess(self, rule, func):       return rule, func\n\n    def addRule(self, doc, func, _preprocess=1):\n        fn = func\n        rules = string.split(doc)\n\n        index = []\n        for i in range(len(rules)):\n            if rules[i] == '::=':\n                index.append(i-1)\n        index.append(len(rules))\n\n        for i in range(len(index)-1):\n            lhs = rules[index[i]]\n            rhs = rules[index[i]+2:index[i+1]]\n            rule = (lhs, tuple(rhs))\n\n            if _preprocess:\n                rule, fn = self.preprocess(rule, func)\n\n            if self.rules.has_key(lhs):\n                self.rules[lhs].append(rule)\n            else:\n                self.rules[lhs] = [ rule ]\n            self.rule2func[rule] = fn\n            self.rule2name[rule] = func.__name__[2:]\n        self.ruleschanged = 1\n\n    def collectRules(self):\n        for name in _namelist(self):\n            if name[:2] == 'p_':\n                func = getattr(self, name)\n                doc = func.__doc__\n                self.addRule(doc, func)\n\n    def augment(self, start):\n        rule = '%s ::= %s %s' % (self._START, self._BOF, start)\n        self.addRule(rule, lambda args: args[1], 0)\n\n    def computeNull(self):\n        self.nullable = {}\n        tbd = []\n\n        for rulelist in self.rules.values():\n            lhs = rulelist[0][0]\n            self.nullable[lhs] = 0\n            for rule in rulelist:\n                rhs = rule[1]\n                if len(rhs) == 0:\n                    self.nullable[lhs] = 1\n                    continue\n                #\n                #  We only need to consider rules which\n                #  consist entirely of nonterminal symbols.\n                #  This should be a savings on typical\n                #  grammars.\n                #\n                for sym in rhs:\n                    if not self.rules.has_key(sym):\n                        break\n                else:\n                    tbd.append(rule)\n        changes = 1\n        while changes:\n            changes = 0\n            for lhs, rhs in tbd:\n                if self.nullable[lhs]:\n                    continue\n                for sym in rhs:\n                    if not self.nullable[sym]:\n                        break\n                else:\n                    self.nullable[lhs] = 1\n                    changes = 1\n\n    def makeState0(self):\n        s0 = _State(0, [])\n        for rule in self.newrules[self._START]:\n            s0.items.append((rule, 0))\n        return s0\n\n    def finalState(self, tokens):\n        #\n        #  Yuck.\n        #\n        if len(self.newrules[self._START]) == 2 and len(tokens) == 0:\n            return 1\n        start = self.rules[self._START][0][1][1]\n        return self.goto(1, start)\n\n    def makeNewRules(self):\n        worklist = []\n        for rulelist in self.rules.values():\n            for rule in rulelist:\n                worklist.append((rule, 0, 1, rule))\n\n        for rule, i, candidate, oldrule in worklist:\n            lhs, rhs = rule\n            n = len(rhs)\n            while i < n:\n                sym = rhs[i]\n                if not self.rules.has_key(sym) or \\\n                   not self.nullable[sym]:\n                    candidate = 0\n                    i = i + 1\n                    continue\n\n                newrhs = list(rhs)\n                newrhs[i] = self._NULLABLE+sym\n                newrule = (lhs, tuple(newrhs))\n                worklist.append((newrule, i+1,\n                                 candidate, oldrule))\n                candidate = 0\n                i = i + 1\n            else:\n                if candidate:\n                    lhs = self._NULLABLE+lhs\n                    rule = (lhs, rhs)\n                if self.newrules.has_key(lhs):\n                    self.newrules[lhs].append(rule)\n                else:\n                    self.newrules[lhs] = [ rule ]\n                self.new2old[rule] = oldrule\n\n    def typestring(self, token):\n        return None\n\n    def error(self, token):\n        print \"Syntax error at or near `%s' token\" % token\n        raise SystemExit\n\n    def parse(self, tokens):\n        sets = [ [(1,0), (2,0)] ]\n        self.links = {}\n\n        if self.ruleschanged:\n            self.computeNull()\n            self.newrules = {}\n            self.new2old = {}\n            self.makeNewRules()\n            self.ruleschanged = 0\n            self.edges, self.cores = {}, {}\n            self.states = { 0: self.makeState0() }\n            self.makeState(0, self._BOF)\n\n        for i in xrange(len(tokens)):\n            sets.append([])\n\n            if sets[i] == []:\n                break\n            self.makeSet(tokens[i], sets, i)\n        else:\n            sets.append([])\n            self.makeSet(None, sets, len(tokens))\n\n        #_dump(tokens, sets, self.states)\n\n        finalitem = (self.finalState(tokens), 0)\n        if finalitem not in sets[-2]:\n            if len(tokens) > 0:\n                self.error(tokens[i-1])\n            else:\n                self.error(None)\n\n        return self.buildTree(self._START, finalitem,\n                              tokens, len(sets)-2)\n\n    def isnullable(self, sym):\n        #\n        #  For symbols in G_e only.  If we weren't supporting 1.5,\n        #  could just use sym.startswith().\n        #\n        return self._NULLABLE == sym[0:len(self._NULLABLE)]\n\n    def skip(self, (lhs, rhs), pos=0):\n        n = len(rhs)\n        while pos < n:\n            if not self.isnullable(rhs[pos]):\n                break\n            pos = pos + 1\n        return pos\n\n    def makeState(self, state, sym):\n        assert sym is not None\n        #\n        #  Compute \\epsilon-kernel state's core and see if\n        #  it exists already.\n        #\n        kitems = []\n        for rule, pos in self.states[state].items:\n            lhs, rhs = rule\n            if rhs[pos:pos+1] == (sym,):\n                kitems.append((rule, self.skip(rule, pos+1)))\n        core = kitems\n\n        core.sort()\n        tcore = tuple(core)\n        if self.cores.has_key(tcore):\n            return self.cores[tcore]\n        #\n        #  Nope, doesn't exist.  Compute it and the associated\n        #  \\epsilon-nonkernel state together; we'll need it right away.\n        #\n        k = self.cores[tcore] = len(self.states)\n        K, NK = _State(k, kitems), _State(k+1, [])\n        self.states[k] = K\n        predicted = {}\n\n        edges = self.edges\n        rules = self.newrules\n        for X in K, NK:\n            worklist = X.items\n            for item in worklist:\n                rule, pos = item\n                lhs, rhs = rule\n                if pos == len(rhs):\n                    X.complete.append(rule)\n                    continue\n\n                nextSym = rhs[pos]\n                key = (X.stateno, nextSym)\n                if not rules.has_key(nextSym):\n                    if not edges.has_key(key):\n                        edges[key] = None\n                        X.T.append(nextSym)\n                else:\n                    edges[key] = None\n                    if not predicted.has_key(nextSym):\n                        predicted[nextSym] = 1\n                        for prule in rules[nextSym]:\n                            ppos = self.skip(prule)\n                            new = (prule, ppos)\n                            NK.items.append(new)\n            #\n            #  Problem: we know K needs generating, but we\n            #  don't yet know about NK.  Can't commit anything\n            #  regarding NK to self.edges until we're sure.  Should\n            #  we delay committing on both K and NK to avoid this\n            #  hacky code?  This creates other problems..\n            #\n            if X is K:\n                edges = {}\n\n        if NK.items == []:\n            return k\n\n        #\n        #  Check for \\epsilon-nonkernel's core.  Unfortunately we\n        #  need to know the entire set of predicted nonterminals\n        #  to do this without accidentally duplicating states.\n        #\n        core = predicted.keys()\n        core.sort()\n        tcore = tuple(core)\n        if self.cores.has_key(tcore):\n            self.edges[(k, None)] = self.cores[tcore]\n            return k\n\n        nk = self.cores[tcore] = self.edges[(k, None)] = NK.stateno\n        self.edges.update(edges)\n        self.states[nk] = NK\n        return k\n\n    def goto(self, state, sym):\n        key = (state, sym)\n        if not self.edges.has_key(key):\n            #\n            #  No transitions from state on sym.\n            #\n            return None\n\n        rv = self.edges[key]\n        if rv is None:\n            #\n            #  Target state isn't generated yet.  Remedy this.\n            #\n            rv = self.makeState(state, sym)\n            self.edges[key] = rv\n        return rv\n\n    def gotoT(self, state, t):\n        return [self.goto(state, t)]\n\n    def gotoST(self, state, st):\n        rv = []\n        for t in self.states[state].T:\n            if st == t:\n                rv.append(self.goto(state, t))\n        return rv\n\n    def add(self, set, item, i=None, predecessor=None, causal=None):\n        if predecessor is None:\n            if item not in set:\n                set.append(item)\n        else:\n            key = (item, i)\n            if item not in set:\n                self.links[key] = []\n                set.append(item)\n            self.links[key].append((predecessor, causal))\n\n    def makeSet(self, token, sets, i):\n        cur, next = sets[i], sets[i+1]\n\n        ttype = token is not None and self.typestring(token) or None\n        if ttype is not None:\n            fn, arg = self.gotoT, ttype\n        else:\n            fn, arg = self.gotoST, token\n\n        for item in cur:\n            ptr = (item, i)\n            state, parent = item\n            add = fn(state, arg)\n            for k in add:\n                if k is not None:\n                    self.add(next, (k, parent), i+1, ptr)\n                    nk = self.goto(k, None)\n                    if nk is not None:\n                        self.add(next, (nk, i+1))\n\n            if parent == i:\n                continue\n\n            for rule in self.states[state].complete:\n                lhs, rhs = rule\n                for pitem in sets[parent]:\n                    pstate, pparent = pitem\n                    k = self.goto(pstate, lhs)\n                    if k is not None:\n                        why = (item, i, rule)\n                        pptr = (pitem, parent)\n                        self.add(cur, (k, pparent),\n                                 i, pptr, why)\n                        nk = self.goto(k, None)\n                        if nk is not None:\n                            self.add(cur, (nk, i))\n\n    def makeSet_fast(self, token, sets, i):\n        #\n        #  Call *only* when the entire state machine has been built!\n        #  It relies on self.edges being filled in completely, and\n        #  then duplicates and inlines code to boost speed at the\n        #  cost of extreme ugliness.\n        #\n        cur, next = sets[i], sets[i+1]\n        ttype = token is not None and self.typestring(token) or None\n\n        for item in cur:\n            ptr = (item, i)\n            state, parent = item\n            if ttype is not None:\n                k = self.edges.get((state, ttype), None)\n                if k is not None:\n                    #self.add(next, (k, parent), i+1, ptr)\n                    #INLINED --v\n                    new = (k, parent)\n                    key = (new, i+1)\n                    if new not in next:\n                        self.links[key] = []\n                        next.append(new)\n                    self.links[key].append((ptr, None))\n                    #INLINED --^\n                    #nk = self.goto(k, None)\n                    nk = self.edges.get((k, None), None)\n                    if nk is not None:\n                        #self.add(next, (nk, i+1))\n                        #INLINED --v\n                        new = (nk, i+1)\n                        if new not in next:\n                            next.append(new)\n                        #INLINED --^\n            else:\n                add = self.gotoST(state, token)\n                for k in add:\n                    if k is not None:\n                        self.add(next, (k, parent), i+1, ptr)\n                        #nk = self.goto(k, None)\n                        nk = self.edges.get((k, None), None)\n                        if nk is not None:\n                            self.add(next, (nk, i+1))\n\n            if parent == i:\n                continue\n\n            for rule in self.states[state].complete:\n                lhs, rhs = rule\n                for pitem in sets[parent]:\n                    pstate, pparent = pitem\n                    #k = self.goto(pstate, lhs)\n                    k = self.edges.get((pstate, lhs), None)\n                    if k is not None:\n                        why = (item, i, rule)\n                        pptr = (pitem, parent)\n                        #self.add(cur, (k, pparent),\n                        #        i, pptr, why)\n                        #INLINED --v\n                        new = (k, pparent)\n                        key = (new, i)\n                        if new not in cur:\n                            self.links[key] = []\n                            cur.append(new)\n                        self.links[key].append((pptr, why))\n                        #INLINED --^\n                        #nk = self.goto(k, None)\n                        nk = self.edges.get((k, None), None)\n                        if nk is not None:\n                            #self.add(cur, (nk, i))\n                            #INLINED --v\n                            new = (nk, i)\n                            if new not in cur:\n                                cur.append(new)\n                            #INLINED --^\n\n    def predecessor(self, key, causal):\n        for p, c in self.links[key]:\n            if c == causal:\n                return p\n        assert 0\n\n    def causal(self, key):\n        links = self.links[key]\n        if len(links) == 1:\n            return links[0][1]\n        choices = []\n        rule2cause = {}\n        for p, c in links:\n            rule = c[2]\n            choices.append(rule)\n            rule2cause[rule] = c\n        return rule2cause[self.ambiguity(choices)]\n\n    def deriveEpsilon(self, nt):\n        if len(self.newrules[nt]) > 1:\n            rule = self.ambiguity(self.newrules[nt])\n        else:\n            rule = self.newrules[nt][0]\n        #print rule\n\n        rhs = rule[1]\n        attr = [None] * len(rhs)\n\n        for i in range(len(rhs)-1, -1, -1):\n            attr[i] = self.deriveEpsilon(rhs[i])\n        return self.rule2func[self.new2old[rule]](attr)\n\n    def buildTree(self, nt, item, tokens, k):\n        state, parent = item\n\n        choices = []\n        for rule in self.states[state].complete:\n            if rule[0] == nt:\n                choices.append(rule)\n        rule = choices[0]\n        if len(choices) > 1:\n            rule = self.ambiguity(choices)\n        #print rule\n\n        rhs = rule[1]\n        attr = [None] * len(rhs)\n\n        for i in range(len(rhs)-1, -1, -1):\n            sym = rhs[i]\n            if not self.newrules.has_key(sym):\n                if sym != self._BOF:\n                    attr[i] = tokens[k-1]\n                    key = (item, k)\n                    item, k = self.predecessor(key, None)\n            #elif self.isnullable(sym):\n            elif self._NULLABLE == sym[0:len(self._NULLABLE)]:\n                attr[i] = self.deriveEpsilon(sym)\n            else:\n                key = (item, k)\n                why = self.causal(key)\n                attr[i] = self.buildTree(sym, why[0],\n                                         tokens, why[1])\n                item, k = self.predecessor(key, why)\n        return self.rule2func[self.new2old[rule]](attr)\n\n    def ambiguity(self, rules):\n        #\n        #  XXX - problem here and in collectRules() if the same rule\n        #        appears in >1 method.  Also undefined results if rules\n        #        causing the ambiguity appear in the same method.\n        #\n        sortlist = []\n        name2index = {}\n        for i in range(len(rules)):\n            lhs, rhs = rule = rules[i]\n            name = self.rule2name[self.new2old[rule]]\n            sortlist.append((len(rhs), name))\n            name2index[name] = i\n        sortlist.sort()\n        list = map(lambda (a,b): b, sortlist)\n        return rules[name2index[self.resolve(list)]]\n\n    def resolve(self, list):\n        #\n        #  Resolve ambiguity in favor of the shortest RHS.\n        #  Since we walk the tree from the top down, this\n        #  should effectively resolve in favor of a \"shift\".\n        #\n        return list[0]\n\n#\n#  GenericASTBuilder automagically constructs a concrete/abstract syntax tree\n#  for a given input.  The extra argument is a class (not an instance!)\n#  which supports the \"__setslice__\" and \"__len__\" methods.\n#\n#  XXX - silently overrides any user code in methods.\n#\n\nclass GenericASTBuilder(GenericParser):\n    def __init__(self, AST, start):\n        GenericParser.__init__(self, start)\n        self.AST = AST\n\n    def preprocess(self, rule, func):\n        rebind = lambda lhs, self=self: \\\n                        lambda args, lhs=lhs, self=self: \\\n                                self.buildASTNode(args, lhs)\n        lhs, rhs = rule\n        return rule, rebind(lhs)\n\n    def buildASTNode(self, args, lhs):\n        children = []\n        for arg in args:\n            if isinstance(arg, self.AST):\n                children.append(arg)\n            else:\n                children.append(self.terminal(arg))\n        return self.nonterminal(lhs, children)\n\n    def terminal(self, token):      return token\n\n    def nonterminal(self, type, args):\n        rv = self.AST(type)\n        rv[:len(args)] = args\n        return rv\n\n#\n#  GenericASTTraversal is a Visitor pattern according to Design Patterns.  For\n#  each node it attempts to invoke the method n_<node type>, falling\n#  back onto the default() method if the n_* can't be found.  The preorder\n#  traversal also looks for an exit hook named n_<node type>_exit (no default\n#  routine is called if it's not found).  To prematurely halt traversal\n#  of a subtree, call the prune() method -- this only makes sense for a\n#  preorder traversal.  Node type is determined via the typestring() method.\n#\n\nclass GenericASTTraversalPruningException:\n    pass\n\nclass GenericASTTraversal:\n    def __init__(self, ast):\n        self.ast = ast\n\n    def typestring(self, node):\n        return node.type\n\n    def prune(self):\n        raise GenericASTTraversalPruningException\n\n    def preorder(self, node=None):\n        if node is None:\n            node = self.ast\n\n        try:\n            name = 'n_' + self.typestring(node)\n            if hasattr(self, name):\n                func = getattr(self, name)\n                func(node)\n            else:\n                self.default(node)\n        except GenericASTTraversalPruningException:\n            return\n\n        for kid in node:\n            self.preorder(kid)\n\n        name = name + '_exit'\n        if hasattr(self, name):\n            func = getattr(self, name)\n            func(node)\n\n    def postorder(self, node=None):\n        if node is None:\n            node = self.ast\n\n        for kid in node:\n            self.postorder(kid)\n\n        name = 'n_' + self.typestring(node)\n        if hasattr(self, name):\n            func = getattr(self, name)\n            func(node)\n        else:\n            self.default(node)\n\n\n    def default(self, node):\n        pass\n\n#\n#  GenericASTMatcher.  AST nodes must have \"__getitem__\" and \"__cmp__\"\n#  implemented.\n#\n#  XXX - makes assumptions about how GenericParser walks the parse tree.\n#\n\nclass GenericASTMatcher(GenericParser):\n    def __init__(self, start, ast):\n        GenericParser.__init__(self, start)\n        self.ast = ast\n\n    def preprocess(self, rule, func):\n        rebind = lambda func, self=self: \\\n                        lambda args, func=func, self=self: \\\n                                self.foundMatch(args, func)\n        lhs, rhs = rule\n        rhslist = list(rhs)\n        rhslist.reverse()\n\n        return (lhs, tuple(rhslist)), rebind(func)\n\n    def foundMatch(self, args, func):\n        func(args[-1])\n        return args[-1]\n\n    def match_r(self, node):\n        self.input.insert(0, node)\n        children = 0\n\n        for child in node:\n            if children == 0:\n                self.input.insert(0, '(')\n            children = children + 1\n            self.match_r(child)\n\n        if children > 0:\n            self.input.insert(0, ')')\n\n    def match(self, ast=None):\n        if ast is None:\n            ast = self.ast\n        self.input = []\n\n        self.match_r(ast)\n        self.parse(self.input)\n\n    def resolve(self, list):\n        #\n        #  Resolve ambiguity in favor of the longest RHS.\n        #\n        return list[-1]\n\ndef _dump(tokens, sets, states):\n    for i in range(len(sets)):\n        print 'set', i\n        for item in sets[i]:\n            print '\\t', item\n            for (lhs, rhs), pos in states[item[0]].items:\n                print '\\t\\t', lhs, '::=',\n                print string.join(rhs[:pos]),\n                print '.',\n                print string.join(rhs[pos:])\n        if i < len(tokens):\n            print\n            print 'token', str(tokens[i])\n            print\n"
  },
  {
    "path": "ast27/Parser/tokenizer.c",
    "content": "\n/* Tokenizer implementation */\n\n#include \"Python.h\"\n#include \"../Include/pgenheaders.h\"\n\n#include <ctype.h>\n#include <assert.h>\n\n#include \"tokenizer.h\"\n#include \"../Include/errcode.h\"\n\n#ifndef PGEN\n#include \"unicodeobject.h\"\n#include \"bytesobject.h\"\n#include \"fileobject.h\"\n#include \"codecs.h\"\n#include \"abstract.h\"\n#endif /* PGEN */\n\n#if PY_MINOR_VERSION >= 4\nPyAPI_FUNC(char *) PyOS_Readline(FILE *, FILE *, const char *);\n#else\nPyAPI_FUNC(char *) PyOS_Readline(FILE *, FILE *, char *);\n#endif\n/* Return malloc'ed string including trailing \\n;\n   empty malloc'ed string for EOF;\n   NULL if interrupted */\n\n/* Don't ever change this -- it would break the portability of Python code */\n#define TABSIZE 8\n\n/* Forward */\nstatic struct tok_state *tok_new(void);\nstatic int tok_nextc(struct tok_state *tok);\nstatic void tok_backup(struct tok_state *tok, int c);\n\n/* Token names */\n\nchar *_Ta27Parser_TokenNames[] = {\n    \"ENDMARKER\",\n    \"NAME\",\n    \"NUMBER\",\n    \"STRING\",\n    \"NEWLINE\",\n    \"INDENT\",\n    \"DEDENT\",\n    \"LPAR\",\n    \"RPAR\",\n    \"LSQB\",\n    \"RSQB\",\n    \"COLON\",\n    \"COMMA\",\n    \"SEMI\",\n    \"PLUS\",\n    \"MINUS\",\n    \"STAR\",\n    \"SLASH\",\n    \"VBAR\",\n    \"AMPER\",\n    \"LESS\",\n    \"GREATER\",\n    \"EQUAL\",\n    \"DOT\",\n    \"PERCENT\",\n    \"BACKQUOTE\",\n    \"LBRACE\",\n    \"RBRACE\",\n    \"EQEQUAL\",\n    \"NOTEQUAL\",\n    \"LESSEQUAL\",\n    \"GREATEREQUAL\",\n    \"TILDE\",\n    \"CIRCUMFLEX\",\n    \"LEFTSHIFT\",\n    \"RIGHTSHIFT\",\n    \"DOUBLESTAR\",\n    \"PLUSEQUAL\",\n    \"MINEQUAL\",\n    \"STAREQUAL\",\n    \"SLASHEQUAL\",\n    \"PERCENTEQUAL\",\n    \"AMPEREQUAL\",\n    \"VBAREQUAL\",\n    \"CIRCUMFLEXEQUAL\",\n    \"LEFTSHIFTEQUAL\",\n    \"RIGHTSHIFTEQUAL\",\n    \"DOUBLESTAREQUAL\",\n    \"DOUBLESLASH\",\n    \"DOUBLESLASHEQUAL\",\n    \"AT\",\n    /* This table must match the #defines in token.h! */\n    \"OP\",\n    \"RARROW\",\n    \"TYPE_IGNORE\",\n    \"TYPE_COMMENT\",\n    \"<ERRORTOKEN>\",\n    \"<N_TOKENS>\"\n};\n\n/* Spaces in this constant are treated as \"zero or more spaces or tabs\" when\n   tokenizing. */\nstatic const char* type_comment_prefix = \"# type: \";\n\n/* Create and initialize a new tok_state structure */\n\nstatic struct tok_state *\ntok_new(void)\n{\n    struct tok_state *tok = (struct tok_state *)PyMem_MALLOC(\n                                            sizeof(struct tok_state));\n    if (tok == NULL)\n        return NULL;\n    tok->buf = tok->cur = tok->end = tok->inp = tok->start = NULL;\n    tok->done = E_OK;\n    tok->fp = NULL;\n    tok->input = NULL;\n    tok->tabsize = TABSIZE;\n    tok->indent = 0;\n    tok->indstack[0] = 0;\n    tok->atbol = 1;\n    tok->pendin = 0;\n    tok->prompt = tok->nextprompt = NULL;\n    tok->lineno = 0;\n    tok->level = 0;\n    tok->filename = NULL;\n    tok->altwarning = 0;\n    tok->alterror = 0;\n    tok->alttabsize = 1;\n    tok->altindstack[0] = 0;\n    tok->decoding_state = 0;\n    tok->decoding_erred = 0;\n    tok->read_coding_spec = 0;\n    tok->encoding = NULL;\n    tok->cont_line = 0;\n#ifndef PGEN\n    tok->decoding_readline = NULL;\n    tok->decoding_buffer = NULL;\n#endif\n    return tok;\n}\n\nstatic char *\nnew_string(const char *s, Py_ssize_t len)\n{\n    char* result = (char *)PyMem_MALLOC(len + 1);\n    if (result != NULL) {\n        memcpy(result, s, len);\n        result[len] = '\\0';\n    }\n    return result;\n}\n\n#ifdef PGEN\n\nstatic char *\ndecoding_fgets(char *s, int size, struct tok_state *tok)\n{\n    return fgets(s, size, tok->fp);\n}\n\nstatic int\ndecoding_feof(struct tok_state *tok)\n{\n    return feof(tok->fp);\n}\n\nstatic char *\ndecode_str(const char *str, int exec_input, struct tok_state *tok)\n{\n    return new_string(str, strlen(str));\n}\n\n#else /* PGEN */\n\nstatic char *\nerror_ret(struct tok_state *tok) /* XXX */\n{\n    tok->decoding_erred = 1;\n    if (tok->fp != NULL && tok->buf != NULL) /* see Ta27Tokenizer_Free */\n        PyMem_FREE(tok->buf);\n    tok->buf = tok->cur = tok->end = tok->inp = tok->start = NULL;\n    tok->done = E_DECODE;\n    return NULL;                /* as if it were EOF */\n}\n\n\nstatic char *\nget_normal_name(char *s)        /* for utf-8 and latin-1 */\n{\n    char buf[13];\n    int i;\n    for (i = 0; i < 12; i++) {\n        int c = s[i];\n        if (c == '\\0')\n            break;\n        else if (c == '_')\n            buf[i] = '-';\n        else\n            buf[i] = tolower(c);\n    }\n    buf[i] = '\\0';\n    if (strcmp(buf, \"utf-8\") == 0 ||\n        strncmp(buf, \"utf-8-\", 6) == 0)\n        return \"utf-8\";\n    else if (strcmp(buf, \"latin-1\") == 0 ||\n             strcmp(buf, \"iso-8859-1\") == 0 ||\n             strcmp(buf, \"iso-latin-1\") == 0 ||\n             strncmp(buf, \"latin-1-\", 8) == 0 ||\n             strncmp(buf, \"iso-8859-1-\", 11) == 0 ||\n             strncmp(buf, \"iso-latin-1-\", 12) == 0)\n        return \"iso-8859-1\";\n    else\n        return s;\n}\n\n/* Return the coding spec in S, or NULL if none is found.  */\n\nstatic char *\nget_coding_spec(const char *s, Py_ssize_t size)\n{\n    Py_ssize_t i;\n    /* Coding spec must be in a comment, and that comment must be\n     * the only statement on the source code line. */\n    for (i = 0; i < size - 6; i++) {\n        if (s[i] == '#')\n            break;\n        if (s[i] != ' ' && s[i] != '\\t' && s[i] != '\\014')\n            return NULL;\n    }\n    for (; i < size - 6; i++) { /* XXX inefficient search */\n        const char* t = s + i;\n        if (strncmp(t, \"coding\", 6) == 0) {\n            const char* begin = NULL;\n            t += 6;\n            if (t[0] != ':' && t[0] != '=')\n                continue;\n            do {\n                t++;\n            } while (t[0] == '\\x20' || t[0] == '\\t');\n\n            begin = t;\n            while (Py_ISALNUM(t[0]) ||\n                   t[0] == '-' || t[0] == '_' || t[0] == '.')\n                t++;\n\n            if (begin < t) {\n                char* r = new_string(begin, t - begin);\n                char* q;\n                if (!r)\n                    return NULL;\n                q = get_normal_name(r);\n                if (r != q) {\n                    PyMem_FREE(r);\n                    r = new_string(q, strlen(q));\n                }\n                return r;\n            }\n        }\n    }\n    return NULL;\n}\n\n/* Check whether the line contains a coding spec. If it does,\n   invoke the set_readline function for the new encoding.\n   This function receives the tok_state and the new encoding.\n   Return 1 on success, 0 on failure.  */\n\nstatic int\ncheck_coding_spec(const char* line, Py_ssize_t size, struct tok_state *tok,\n                  int set_readline(struct tok_state *, const char *))\n{\n    char * cs;\n    int r = 1;\n\n    if (tok->cont_line) {\n        /* It's a continuation line, so it can't be a coding spec. */\n        tok->read_coding_spec = 1;\n        return 1;\n    }\n    cs = get_coding_spec(line, size);\n    if (!cs) {\n        Py_ssize_t i;\n        for (i = 0; i < size; i++) {\n            if (line[i] == '#' || line[i] == '\\n' || line[i] == '\\r')\n                break;\n            if (line[i] != ' ' && line[i] != '\\t' && line[i] != '\\014') {\n                /* Stop checking coding spec after a line containing\n                 * anything except a comment. */\n                tok->read_coding_spec = 1;\n                break;\n            }\n        }\n    } else {\n        tok->read_coding_spec = 1;\n        if (tok->encoding == NULL) {\n            assert(tok->decoding_state == 1); /* raw */\n            if (strcmp(cs, \"utf-8\") == 0 ||\n                strcmp(cs, \"iso-8859-1\") == 0) {\n                tok->encoding = cs;\n            } else {\n#ifdef Py_USING_UNICODE\n                r = set_readline(tok, cs);\n                if (r) {\n                    tok->encoding = cs;\n                    tok->decoding_state = -1;\n                }\n                else {\n                    PyErr_Format(PyExc_SyntaxError,\n                                 \"encoding problem: %s\", cs);\n                    PyMem_FREE(cs);\n                }\n#else\n                /* Without Unicode support, we cannot\n                   process the coding spec. Since there\n                   won't be any Unicode literals, that\n                   won't matter. */\n                PyMem_FREE(cs);\n#endif\n            }\n        } else {                /* then, compare cs with BOM */\n            r = (strcmp(tok->encoding, cs) == 0);\n            if (!r)\n                PyErr_Format(PyExc_SyntaxError,\n                             \"encoding problem: %s with BOM\", cs);\n            PyMem_FREE(cs);\n        }\n    }\n    return r;\n}\n\n/* See whether the file starts with a BOM. If it does,\n   invoke the set_readline function with the new encoding.\n   Return 1 on success, 0 on failure.  */\n\nstatic int\ncheck_bom(int get_char(struct tok_state *),\n          void unget_char(int, struct tok_state *),\n          int set_readline(struct tok_state *, const char *),\n          struct tok_state *tok)\n{\n    int ch1, ch2, ch3;\n    ch1 = get_char(tok);\n    tok->decoding_state = 1;\n    if (ch1 == EOF) {\n        return 1;\n    } else if (ch1 == 0xEF) {\n        ch2 = get_char(tok);\n        if (ch2 != 0xBB) {\n            unget_char(ch2, tok);\n            unget_char(ch1, tok);\n            return 1;\n        }\n        ch3 = get_char(tok);\n        if (ch3 != 0xBF) {\n            unget_char(ch3, tok);\n            unget_char(ch2, tok);\n            unget_char(ch1, tok);\n            return 1;\n        }\n#if 0\n    /* Disable support for UTF-16 BOMs until a decision\n       is made whether this needs to be supported.  */\n    } else if (ch1 == 0xFE) {\n        ch2 = get_char(tok);\n        if (ch2 != 0xFF) {\n            unget_char(ch2, tok);\n            unget_char(ch1, tok);\n            return 1;\n        }\n        if (!set_readline(tok, \"utf-16-be\"))\n            return 0;\n        tok->decoding_state = -1;\n    } else if (ch1 == 0xFF) {\n        ch2 = get_char(tok);\n        if (ch2 != 0xFE) {\n            unget_char(ch2, tok);\n            unget_char(ch1, tok);\n            return 1;\n        }\n        if (!set_readline(tok, \"utf-16-le\"))\n            return 0;\n        tok->decoding_state = -1;\n#endif\n    } else {\n        unget_char(ch1, tok);\n        return 1;\n    }\n    if (tok->encoding != NULL)\n        PyMem_FREE(tok->encoding);\n    tok->encoding = new_string(\"utf-8\", 5);     /* resulting is in utf-8 */\n    return 1;\n}\n\n/* Read a line of text from TOK into S, using the stream in TOK.\n   Return NULL on failure, else S.\n\n   On entry, tok->decoding_buffer will be one of:\n     1) NULL: need to call tok->decoding_readline to get a new line\n     2) PyUnicodeObject *: decoding_feof has called tok->decoding_readline and\n       stored the result in tok->decoding_buffer\n     3) PyBytesObject *: previous call to fp_readl did not have enough room\n       (in the s buffer) to copy entire contents of the line read\n       by tok->decoding_readline.  tok->decoding_buffer has the overflow.\n       In this case, fp_readl is called in a loop (with an expanded buffer)\n       until the buffer ends with a '\\n' (or until the end of the file is\n       reached): see tok_nextc and its calls to decoding_fgets.\n*/\n\nstatic char *\nfp_readl(char *s, int size, struct tok_state *tok)\n{\n#ifndef Py_USING_UNICODE\n    /* In a non-Unicode built, this should never be called. */\n    Py_FatalError(\"fp_readl should not be called in this build.\");\n    return NULL; /* Keep compiler happy (not reachable) */\n#else\n    PyObject* utf8 = NULL;\n    PyObject* buf = tok->decoding_buffer;\n    char *str;\n    Py_ssize_t utf8len;\n\n    /* Ask for one less byte so we can terminate it */\n    assert(size > 0);\n    size--;\n\n    if (buf == NULL) {\n        buf = PyObject_CallObject(tok->decoding_readline, NULL);\n        if (buf == NULL)\n            return error_ret(tok);\n        if (!PyUnicode_Check(buf)) {\n            Py_DECREF(buf);\n            PyErr_SetString(PyExc_SyntaxError,\n                            \"codec did not return a unicode object\");\n            return error_ret(tok);\n        }\n    } else {\n        tok->decoding_buffer = NULL;\n        if (PyBytes_CheckExact(buf))\n            utf8 = buf;\n    }\n    if (utf8 == NULL) {\n        utf8 = PyUnicode_AsUTF8String(buf);\n        Py_DECREF(buf);\n        if (utf8 == NULL)\n            return error_ret(tok);\n    }\n    str = PyBytes_AsString(utf8);\n    utf8len = PyBytes_GET_SIZE(utf8);\n    if (utf8len > size) {\n        tok->decoding_buffer = PyBytes_FromStringAndSize(str+size, utf8len-size);\n        if (tok->decoding_buffer == NULL) {\n            Py_DECREF(utf8);\n            return error_ret(tok);\n        }\n        utf8len = size;\n    }\n    memcpy(s, str, utf8len);\n    s[utf8len] = '\\0';\n    Py_DECREF(utf8);\n    if (utf8len == 0)\n        return NULL; /* EOF */\n    return s;\n#endif\n}\n\n/* Set the readline function for TOK to a StreamReader's\n   readline function. The StreamReader is named ENC.\n\n   This function is called from check_bom and check_coding_spec.\n\n   ENC is usually identical to the future value of tok->encoding,\n   except for the (currently unsupported) case of UTF-16.\n\n   Return 1 on success, 0 on failure. */\n\n/* taken from Python 3.5.1 */\n\nstatic int\nfp_setreadl(struct tok_state *tok, const char* enc)\n{\n    PyObject *readline = NULL, *stream = NULL, *io = NULL;\n    _Py_IDENTIFIER(open);\n    _Py_IDENTIFIER(readline);\n    int fd;\n    long pos;\n\n    io = PyImport_ImportModuleNoBlock(\"io\");\n    if (io == NULL)\n        goto cleanup;\n\n    fd = fileno(tok->fp);\n    /* Due to buffering the file offset for fd can be different from the file\n     * position of tok->fp.  If tok->fp was opened in text mode on Windows,\n     * its file position counts CRLF as one char and can't be directly mapped\n     * to the file offset for fd.  Instead we step back one byte and read to\n     * the end of line.*/\n    pos = ftell(tok->fp);\n    if (pos == -1 ||\n        lseek(fd, (off_t)(pos > 0 ? pos - 1 : pos), SEEK_SET) == (off_t)-1) {\n        PyErr_SetFromErrnoWithFilename(PyExc_OSError, NULL);\n        goto cleanup;\n    }\n\n    stream = _PyObject_CallMethodId(io, &PyId_open, \"isisOOO\",\n                    fd, \"r\", -1, enc, Py_None, Py_None, Py_False);\n    if (stream == NULL)\n        goto cleanup;\n\n    Py_XDECREF(tok->decoding_readline);\n    readline = _PyObject_GetAttrId(stream, &PyId_readline);\n    tok->decoding_readline = readline;\n    if (pos > 0) {\n        if (PyObject_CallObject(readline, NULL) == NULL) {\n            readline = NULL;\n            goto cleanup;\n        }\n    }\n\n  cleanup:\n    Py_XDECREF(stream);\n    Py_XDECREF(io);\n    return readline != NULL;\n}\n\n/* Fetch the next byte from TOK. */\n\nstatic int fp_getc(struct tok_state *tok) {\n    return getc(tok->fp);\n}\n\n/* Unfetch the last byte back into TOK.  */\n\nstatic void fp_ungetc(int c, struct tok_state *tok) {\n    ungetc(c, tok->fp);\n}\n\n/* Read a line of input from TOK. Determine encoding\n   if necessary.  */\n\nstatic char *\ndecoding_fgets(char *s, int size, struct tok_state *tok)\n{\n    char *line = NULL;\n    int badchar = 0;\n    for (;;) {\n        if (tok->decoding_state < 0) {\n            /* We already have a codec associated with\n               this input. */\n            line = fp_readl(s, size, tok);\n            break;\n        } else if (tok->decoding_state > 0) {\n            /* We want a 'raw' read. */\n            line = Py_UniversalNewlineFgets(s, size,\n                                            tok->fp, NULL);\n            break;\n        } else {\n            /* We have not yet determined the encoding.\n               If an encoding is found, use the file-pointer\n               reader functions from now on. */\n            if (!check_bom(fp_getc, fp_ungetc, fp_setreadl, tok))\n                return error_ret(tok);\n            assert(tok->decoding_state != 0);\n        }\n    }\n    if (line != NULL && tok->lineno < 2 && !tok->read_coding_spec) {\n        if (!check_coding_spec(line, strlen(line), tok, fp_setreadl)) {\n            return error_ret(tok);\n        }\n    }\n#ifndef PGEN\n    /* The default encoding is ASCII, so make sure we don't have any\n       non-ASCII bytes in it. */\n    if (line && !tok->encoding) {\n        unsigned char *c;\n        for (c = (unsigned char *)line; *c; c++)\n            if (*c > 127) {\n                badchar = *c;\n                break;\n            }\n    }\n    if (badchar) {\n        char buf[500];\n        /* Need to add 1 to the line number, since this line\n           has not been counted, yet.  */\n        sprintf(buf,\n            \"Non-ASCII character '\\\\x%.2x' \"\n            \"in file %.200s on line %i, \"\n            \"but no encoding declared; \"\n            \"see http://python.org/dev/peps/pep-0263/ for details\",\n            badchar, tok->filename, tok->lineno + 1);\n        PyErr_SetString(PyExc_SyntaxError, buf);\n        return error_ret(tok);\n    }\n#endif\n    return line;\n}\n\nstatic int\ndecoding_feof(struct tok_state *tok)\n{\n    if (tok->decoding_state >= 0) {\n        return feof(tok->fp);\n    } else {\n        PyObject* buf = tok->decoding_buffer;\n        if (buf == NULL) {\n            buf = PyObject_CallObject(tok->decoding_readline, NULL);\n            if (buf == NULL) {\n                error_ret(tok);\n                return 1;\n            } else {\n                tok->decoding_buffer = buf;\n            }\n        }\n        return PyObject_Length(buf) == 0;\n    }\n}\n\n/* Fetch a byte from TOK, using the string buffer. */\n\nstatic int\nbuf_getc(struct tok_state *tok) {\n    return Py_CHARMASK(*tok->str++);\n}\n\n/* Unfetch a byte from TOK, using the string buffer. */\n\nstatic void\nbuf_ungetc(int c, struct tok_state *tok) {\n    tok->str--;\n    assert(Py_CHARMASK(*tok->str) == c);        /* tok->cur may point to read-only segment */\n}\n\n/* Set the readline function for TOK to ENC. For the string-based\n   tokenizer, this means to just record the encoding. */\n\nstatic int\nbuf_setreadl(struct tok_state *tok, const char* enc) {\n    tok->enc = enc;\n    return 1;\n}\n\n/* Return a UTF-8 encoding Python string object from the\n   C byte string STR, which is encoded with ENC. */\n\n#ifdef Py_USING_UNICODE\nstatic PyObject *\ntranslate_into_utf8(const char* str, const char* enc) {\n    PyObject *utf8;\n    PyObject* buf = PyUnicode_Decode(str, strlen(str), enc, NULL);\n    if (buf == NULL)\n        return NULL;\n    utf8 = PyUnicode_AsUTF8String(buf);\n    Py_DECREF(buf);\n    return utf8;\n}\n#endif\n\n\nstatic char *\ntranslate_newlines(const char *s, int exec_input, struct tok_state *tok) {\n    int skip_next_lf = 0, needed_length = strlen(s) + 2, final_length;\n    char *buf, *current;\n    char c = '\\0';\n    buf = PyMem_MALLOC(needed_length);\n    if (buf == NULL) {\n        tok->done = E_NOMEM;\n        return NULL;\n    }\n    for (current = buf; *s; s++, current++) {\n        c = *s;\n        if (skip_next_lf) {\n            skip_next_lf = 0;\n            if (c == '\\n') {\n                c = *++s;\n                if (!c)\n                    break;\n            }\n        }\n        if (c == '\\r') {\n            skip_next_lf = 1;\n            c = '\\n';\n        }\n        *current = c;\n    }\n    /* If this is exec input, add a newline to the end of the string if\n       there isn't one already. */\n    if (exec_input && c != '\\n') {\n        *current = '\\n';\n        current++;\n    }\n    *current = '\\0';\n    final_length = current - buf + 1;\n    if (final_length < needed_length && final_length)\n        /* should never fail */\n        buf = PyMem_REALLOC(buf, final_length);\n    return buf;\n}\n\n/* Decode a byte string STR for use as the buffer of TOK.\n   Look for encoding declarations inside STR, and record them\n   inside TOK.  */\n\nstatic const char *\ndecode_str(const char *input, int single, struct tok_state *tok)\n{\n    PyObject* utf8 = NULL;\n    const char *str;\n    const char *s;\n    const char *newl[2] = {NULL, NULL};\n    int lineno = 0;\n    tok->input = str = translate_newlines(input, single, tok);\n    if (str == NULL)\n        return NULL;\n    tok->enc = NULL;\n    tok->str = str;\n    if (!check_bom(buf_getc, buf_ungetc, buf_setreadl, tok))\n        return error_ret(tok);\n    str = tok->str;             /* string after BOM if any */\n    assert(str);\n#ifdef Py_USING_UNICODE\n    if (tok->enc != NULL) {\n        utf8 = translate_into_utf8(str, tok->enc);\n        if (utf8 == NULL)\n            return error_ret(tok);\n        str = PyBytes_AsString(utf8);\n    }\n#endif\n    for (s = str;; s++) {\n        if (*s == '\\0') break;\n        else if (*s == '\\n') {\n            assert(lineno < 2);\n            newl[lineno] = s;\n            lineno++;\n            if (lineno == 2) break;\n        }\n    }\n    tok->enc = NULL;\n    /* need to check line 1 and 2 separately since check_coding_spec\n       assumes a single line as input */\n    if (newl[0]) {\n        if (!check_coding_spec(str, newl[0] - str, tok, buf_setreadl))\n            return error_ret(tok);\n        if (tok->enc == NULL && !tok->read_coding_spec && newl[1]) {\n            if (!check_coding_spec(newl[0]+1, newl[1] - newl[0],\n                                   tok, buf_setreadl))\n                return error_ret(tok);\n        }\n    }\n#ifdef Py_USING_UNICODE\n    if (tok->enc != NULL) {\n        assert(utf8 == NULL);\n        utf8 = translate_into_utf8(str, tok->enc);\n        if (utf8 == NULL)\n            return error_ret(tok);\n        str = PyBytes_AsString(utf8);\n    }\n#endif\n    assert(tok->decoding_buffer == NULL);\n    tok->decoding_buffer = utf8; /* CAUTION */\n    return str;\n}\n\n#endif /* PGEN */\n\n/* Set up tokenizer for string */\n\nstruct tok_state *\nTa27Tokenizer_FromString(const char *str, int exec_input)\n{\n    struct tok_state *tok = tok_new();\n    if (tok == NULL)\n        return NULL;\n    str = (char *)decode_str(str, exec_input, tok);\n    if (str == NULL) {\n        Ta27Tokenizer_Free(tok);\n        return NULL;\n    }\n\n    /* XXX: constify members. */\n    tok->buf = tok->cur = tok->end = tok->inp = (char*)str;\n    return tok;\n}\n\n/* adapted from Python 3.5.1 */\nstruct tok_state *\nTa27Tokenizer_FromUTF8(const char *str, int exec_input)\n{\n    struct tok_state *tok = tok_new();\n    if (tok == NULL)\n        return NULL;\n#ifndef PGEN\n    tok->input = str = translate_newlines(str, exec_input, tok);\n#endif\n    if (str == NULL) {\n        Ta27Tokenizer_Free(tok);\n        return NULL;\n    }\n    tok->decoding_state = 1;\n    tok->read_coding_spec = 1;\n    tok->enc = NULL;\n    tok->str = str;\n\n    /* XXX: constify members. */\n    tok->buf = tok->cur = tok->end = tok->inp = (char*)str;\n    return tok;\n}\n\n\n/* Set up tokenizer for file */\n\nstruct tok_state *\nTa27Tokenizer_FromFile(FILE *fp, char *ps1, char *ps2)\n{\n    struct tok_state *tok = tok_new();\n    if (tok == NULL)\n        return NULL;\n    if ((tok->buf = (char *)PyMem_MALLOC(BUFSIZ)) == NULL) {\n        Ta27Tokenizer_Free(tok);\n        return NULL;\n    }\n    tok->cur = tok->inp = tok->buf;\n    tok->end = tok->buf + BUFSIZ;\n    tok->fp = fp;\n    tok->prompt = ps1;\n    tok->nextprompt = ps2;\n    return tok;\n}\n\n\n/* Free a tok_state structure */\n\nvoid\nTa27Tokenizer_Free(struct tok_state *tok)\n{\n    if (tok->encoding != NULL)\n        PyMem_FREE(tok->encoding);\n#ifndef PGEN\n    Py_XDECREF(tok->decoding_readline);\n    Py_XDECREF(tok->decoding_buffer);\n#endif\n    if (tok->fp != NULL && tok->buf != NULL)\n        PyMem_FREE(tok->buf);\n    if (tok->input)\n        PyMem_FREE((char *)tok->input);\n    PyMem_FREE(tok);\n}\n\n/* Get next char, updating state; error code goes into tok->done */\n/* taken from Python 3.5.1 */\nstatic int\ntok_nextc(struct tok_state *tok)\n{\n    for (;;) {\n        if (tok->cur != tok->inp) {\n            return Py_CHARMASK(*tok->cur++); /* Fast path */\n        }\n        if (tok->done != E_OK)\n            return EOF;\n        if (tok->fp == NULL) {\n            char *end = strchr(tok->inp, '\\n');\n            if (end != NULL)\n                end++;\n            else {\n                end = strchr(tok->inp, '\\0');\n                if (end == tok->inp) {\n                    tok->done = E_EOF;\n                    return EOF;\n                }\n            }\n            if (tok->start == NULL)\n                tok->buf = tok->cur;\n            tok->line_start = tok->cur;\n            tok->lineno++;\n            tok->inp = end;\n            return Py_CHARMASK(*tok->cur++);\n        }\n        if (tok->prompt != NULL) {\n            char *newtok = PyOS_Readline(stdin, stdout, tok->prompt);\n#ifndef PGEN\n            if (newtok != NULL) {\n                char *translated = translate_newlines(newtok, 0, tok);\n                PyMem_FREE(newtok);\n                if (translated == NULL)\n                    return EOF;\n                newtok = translated;\n            }\n            if (tok->encoding && newtok && *newtok) {\n                /* Recode to UTF-8 */\n                Py_ssize_t buflen;\n                const char* buf;\n                PyObject *u = translate_into_utf8(newtok, tok->encoding);\n                PyMem_FREE(newtok);\n                if (!u) {\n                    tok->done = E_DECODE;\n                    return EOF;\n                }\n                buflen = PyBytes_GET_SIZE(u);\n                buf = PyBytes_AS_STRING(u);\n                newtok = PyMem_MALLOC(buflen+1);\n                strcpy(newtok, buf);\n                Py_DECREF(u);\n            }\n#endif\n            if (tok->nextprompt != NULL)\n                tok->prompt = tok->nextprompt;\n            if (newtok == NULL)\n                tok->done = E_INTR;\n            else if (*newtok == '\\0') {\n                PyMem_FREE(newtok);\n                tok->done = E_EOF;\n            }\n            else if (tok->start != NULL) {\n                size_t start = tok->start - tok->buf;\n                size_t oldlen = tok->cur - tok->buf;\n                size_t newlen = oldlen + strlen(newtok);\n                char *buf = tok->buf;\n                buf = (char *)PyMem_REALLOC(buf, newlen+1);\n                tok->lineno++;\n                if (buf == NULL) {\n                    PyMem_FREE(tok->buf);\n                    tok->buf = NULL;\n                    PyMem_FREE(newtok);\n                    tok->done = E_NOMEM;\n                    return EOF;\n                }\n                tok->buf = buf;\n                tok->cur = tok->buf + oldlen;\n                tok->line_start = tok->cur;\n                strcpy(tok->buf + oldlen, newtok);\n                PyMem_FREE(newtok);\n                tok->inp = tok->buf + newlen;\n                tok->end = tok->inp + 1;\n                tok->start = tok->buf + start;\n            }\n            else {\n                tok->lineno++;\n                if (tok->buf != NULL)\n                    PyMem_FREE(tok->buf);\n                tok->buf = newtok;\n                tok->cur = tok->buf;\n                tok->line_start = tok->buf;\n                tok->inp = strchr(tok->buf, '\\0');\n                tok->end = tok->inp + 1;\n            }\n        }\n        else {\n            int done = 0;\n            Py_ssize_t cur = 0;\n            char *pt;\n            if (tok->start == NULL) {\n                if (tok->buf == NULL) {\n                    tok->buf = (char *)\n                        PyMem_MALLOC(BUFSIZ);\n                    if (tok->buf == NULL) {\n                        tok->done = E_NOMEM;\n                        return EOF;\n                    }\n                    tok->end = tok->buf + BUFSIZ;\n                }\n                if (decoding_fgets(tok->buf, (int)(tok->end - tok->buf),\n                          tok) == NULL) {\n                    if (!tok->decoding_erred)\n                        tok->done = E_EOF;\n                    done = 1;\n                }\n                else {\n                    tok->done = E_OK;\n                    tok->inp = strchr(tok->buf, '\\0');\n                    done = tok->inp[-1] == '\\n';\n                }\n            }\n            else {\n                cur = tok->cur - tok->buf;\n                if (decoding_feof(tok)) {\n                    tok->done = E_EOF;\n                    done = 1;\n                }\n                else\n                    tok->done = E_OK;\n            }\n            tok->lineno++;\n            /* Read until '\\n' or EOF */\n            while (!done) {\n                Py_ssize_t curstart = tok->start == NULL ? -1 :\n                          tok->start - tok->buf;\n                Py_ssize_t curvalid = tok->inp - tok->buf;\n                Py_ssize_t newsize = curvalid + BUFSIZ;\n                char *newbuf = tok->buf;\n                newbuf = (char *)PyMem_REALLOC(newbuf,\n                                               newsize);\n                if (newbuf == NULL) {\n                    tok->done = E_NOMEM;\n                    tok->cur = tok->inp;\n                    return EOF;\n                }\n                tok->buf = newbuf;\n                tok->cur = tok->buf + cur;\n                tok->line_start = tok->cur;\n                tok->inp = tok->buf + curvalid;\n                tok->end = tok->buf + newsize;\n                tok->start = curstart < 0 ? NULL :\n                         tok->buf + curstart;\n                if (decoding_fgets(tok->inp,\n                               (int)(tok->end - tok->inp),\n                               tok) == NULL) {\n                    /* Break out early on decoding\n                       errors, as tok->buf will be NULL\n                     */\n                    if (tok->decoding_erred)\n                        return EOF;\n                    /* Last line does not end in \\n,\n                       fake one */\n                    strcpy(tok->inp, \"\\n\");\n                }\n                tok->inp = strchr(tok->inp, '\\0');\n                done = tok->inp[-1] == '\\n';\n            }\n            if (tok->buf != NULL) {\n                tok->cur = tok->buf + cur;\n                tok->line_start = tok->cur;\n                /* replace \"\\r\\n\" with \"\\n\" */\n                /* For Mac leave the \\r, giving a syntax error */\n                pt = tok->inp - 2;\n                if (pt >= tok->buf && *pt == '\\r') {\n                    *pt++ = '\\n';\n                    *pt = '\\0';\n                    tok->inp = pt;\n                }\n            }\n        }\n        if (tok->done != E_OK) {\n            if (tok->prompt != NULL)\n                PySys_WriteStderr(\"\\n\");\n            tok->cur = tok->inp;\n            return EOF;\n        }\n    }\n    /*NOTREACHED*/\n}\n\n\n/* Back-up one character */\n\nstatic void\ntok_backup(register struct tok_state *tok, register int c)\n{\n    if (c != EOF) {\n        if (--tok->cur < tok->buf)\n            Py_FatalError(\"tok_backup: beginning of buffer\");\n        if (*tok->cur != c)\n            *tok->cur = c;\n    }\n}\n\n\n/* Return the token corresponding to a single character */\n\nint\nTa27Token_OneChar(int c)\n{\n    switch (c) {\n    case '(':           return LPAR;\n    case ')':           return RPAR;\n    case '[':           return LSQB;\n    case ']':           return RSQB;\n    case ':':           return COLON;\n    case ',':           return COMMA;\n    case ';':           return SEMI;\n    case '+':           return PLUS;\n    case '-':           return MINUS;\n    case '*':           return STAR;\n    case '/':           return SLASH;\n    case '|':           return VBAR;\n    case '&':           return AMPER;\n    case '<':           return LESS;\n    case '>':           return GREATER;\n    case '=':           return EQUAL;\n    case '.':           return DOT;\n    case '%':           return PERCENT;\n    case '`':           return BACKQUOTE;\n    case '{':           return LBRACE;\n    case '}':           return RBRACE;\n    case '^':           return CIRCUMFLEX;\n    case '~':           return TILDE;\n    case '@':       return AT;\n    default:            return OP;\n    }\n}\n\n\nint\nTa27Token_TwoChars(int c1, int c2)\n{\n    switch (c1) {\n    case '=':\n        switch (c2) {\n        case '=':               return EQEQUAL;\n        }\n        break;\n    case '!':\n        switch (c2) {\n        case '=':               return NOTEQUAL;\n        }\n        break;\n    case '<':\n        switch (c2) {\n        case '>':               return NOTEQUAL;\n        case '=':               return LESSEQUAL;\n        case '<':               return LEFTSHIFT;\n        }\n        break;\n    case '>':\n        switch (c2) {\n        case '=':               return GREATEREQUAL;\n        case '>':               return RIGHTSHIFT;\n        }\n        break;\n    case '+':\n        switch (c2) {\n        case '=':               return PLUSEQUAL;\n        }\n        break;\n    case '-':\n        switch (c2) {\n        case '=':               return MINEQUAL;\n        case '>':               return RARROW;\n        }\n        break;\n    case '*':\n        switch (c2) {\n        case '*':               return DOUBLESTAR;\n        case '=':               return STAREQUAL;\n        }\n        break;\n    case '/':\n        switch (c2) {\n        case '/':               return DOUBLESLASH;\n        case '=':               return SLASHEQUAL;\n        }\n        break;\n    case '|':\n        switch (c2) {\n        case '=':               return VBAREQUAL;\n        }\n        break;\n    case '%':\n        switch (c2) {\n        case '=':               return PERCENTEQUAL;\n        }\n        break;\n    case '&':\n        switch (c2) {\n        case '=':               return AMPEREQUAL;\n        }\n        break;\n    case '^':\n        switch (c2) {\n        case '=':               return CIRCUMFLEXEQUAL;\n        }\n        break;\n    }\n    return OP;\n}\n\nint\nTa27Token_ThreeChars(int c1, int c2, int c3)\n{\n    switch (c1) {\n    case '<':\n        switch (c2) {\n        case '<':\n            switch (c3) {\n            case '=':\n                return LEFTSHIFTEQUAL;\n            }\n            break;\n        }\n        break;\n    case '>':\n        switch (c2) {\n        case '>':\n            switch (c3) {\n            case '=':\n                return RIGHTSHIFTEQUAL;\n            }\n            break;\n        }\n        break;\n    case '*':\n        switch (c2) {\n        case '*':\n            switch (c3) {\n            case '=':\n                return DOUBLESTAREQUAL;\n            }\n            break;\n        }\n        break;\n    case '/':\n        switch (c2) {\n        case '/':\n            switch (c3) {\n            case '=':\n                return DOUBLESLASHEQUAL;\n            }\n            break;\n        }\n        break;\n    }\n    return OP;\n}\n\nstatic int\nindenterror(struct tok_state *tok)\n{\n    if (tok->alterror) {\n        tok->done = E_TABSPACE;\n        tok->cur = tok->inp;\n        return 1;\n    }\n    if (tok->altwarning) {\n        PySys_WriteStderr(\"%s: inconsistent use of tabs and spaces \"\n                          \"in indentation\\n\", tok->filename);\n        tok->altwarning = 0;\n    }\n    return 0;\n}\n\n/* Get next token, after space stripping etc. */\n\nstatic int\ntok_get(register struct tok_state *tok, char **p_start, char **p_end)\n{\n    register int c;\n    int blankline;\n\n    *p_start = *p_end = NULL;\n  nextline:\n    tok->start = NULL;\n    blankline = 0;\n\n    /* Get indentation level */\n    if (tok->atbol) {\n        register int col = 0;\n        register int altcol = 0;\n        tok->atbol = 0;\n        for (;;) {\n            c = tok_nextc(tok);\n            if (c == ' ')\n                col++, altcol++;\n            else if (c == '\\t') {\n                col = (col/tok->tabsize + 1) * tok->tabsize;\n                altcol = (altcol/tok->alttabsize + 1)\n                    * tok->alttabsize;\n            }\n            else if (c == '\\014') /* Control-L (formfeed) */\n                col = altcol = 0; /* For Emacs users */\n            else\n                break;\n        }\n        tok_backup(tok, c);\n        if (c == '#' || c == '\\n') {\n            /* Lines with only whitespace and/or comments\n               shouldn't affect the indentation and are\n               not passed to the parser as NEWLINE tokens,\n               except *totally* empty lines in interactive\n               mode, which signal the end of a command group. */\n            if (col == 0 && c == '\\n' && tok->prompt != NULL)\n                blankline = 0; /* Let it through */\n            else\n                blankline = 1; /* Ignore completely */\n            /* We can't jump back right here since we still\n               may need to skip to the end of a comment */\n        }\n        if (!blankline && tok->level == 0) {\n            if (col == tok->indstack[tok->indent]) {\n                /* No change */\n                if (altcol != tok->altindstack[tok->indent]) {\n                    if (indenterror(tok))\n                        return ERRORTOKEN;\n                }\n            }\n            else if (col > tok->indstack[tok->indent]) {\n                /* Indent -- always one */\n                if (tok->indent+1 >= MAXINDENT) {\n                    tok->done = E_TOODEEP;\n                    tok->cur = tok->inp;\n                    return ERRORTOKEN;\n                }\n                if (altcol <= tok->altindstack[tok->indent]) {\n                    if (indenterror(tok))\n                        return ERRORTOKEN;\n                }\n                tok->pendin++;\n                tok->indstack[++tok->indent] = col;\n                tok->altindstack[tok->indent] = altcol;\n            }\n            else /* col < tok->indstack[tok->indent] */ {\n                /* Dedent -- any number, must be consistent */\n                while (tok->indent > 0 &&\n                    col < tok->indstack[tok->indent]) {\n                    tok->pendin--;\n                    tok->indent--;\n                }\n                if (col != tok->indstack[tok->indent]) {\n                    tok->done = E_DEDENT;\n                    tok->cur = tok->inp;\n                    return ERRORTOKEN;\n                }\n                if (altcol != tok->altindstack[tok->indent]) {\n                    if (indenterror(tok))\n                        return ERRORTOKEN;\n                }\n            }\n        }\n    }\n\n    tok->start = tok->cur;\n\n    /* Return pending indents/dedents */\n    if (tok->pendin != 0) {\n        if (tok->pendin < 0) {\n            tok->pendin++;\n            return DEDENT;\n        }\n        else {\n            tok->pendin--;\n            return INDENT;\n        }\n    }\n\n again:\n    tok->start = NULL;\n    /* Skip spaces */\n    do {\n        c = tok_nextc(tok);\n    } while (c == ' ' || c == '\\t' || c == '\\014');\n\n    /* Set start of current token */\n    tok->start = tok->cur - 1;\n\n    /* Skip comment, while looking for tab-setting magic and type comments */\n    if (c == '#') {\n        static char *tabforms[] = {\n            \"tab-width:\",                       /* Emacs */\n            \":tabstop=\",                        /* vim, full form */\n            \":ts=\",                             /* vim, abbreviated form */\n            \"set tabsize=\",                     /* will vi never die? */\n        /* more templates can be added here to support other editors */\n        };\n        char cbuf[80];\n        char *tp, **cp;\n\n        /* used for type comment checks */\n        const char *prefix, *p, *type_start;\n\n        tp = cbuf;\n        do {\n            *tp++ = c = tok_nextc(tok);\n        } while (c != EOF && c != '\\n' &&\n                 (size_t)(tp - cbuf + 1) < sizeof(cbuf));\n        *tp = '\\0';\n        for (cp = tabforms;\n             cp < tabforms + sizeof(tabforms)/sizeof(tabforms[0]);\n             cp++) {\n            if ((tp = strstr(cbuf, *cp))) {\n                int newsize = atoi(tp + strlen(*cp));\n\n                if (newsize >= 1 && newsize <= 40) {\n                    tok->tabsize = newsize;\n                    if (Py_VerboseFlag)\n                        PySys_WriteStderr(\n                        \"Tab size set to %d\\n\",\n                        newsize);\n                }\n            }\n        }\n        while (c != EOF && c != '\\n')\n            c = tok_nextc(tok);\n            \n        /* check for type comment */\n        \n        p = tok->start;\n        prefix = type_comment_prefix;\n        while (*prefix && p < tok->cur) {\n            if (*prefix == ' ') {\n                while (*p == ' ' || *p == '\\t')\n                    p++;\n            } else if (*prefix == *p) {\n                p++;\n            } else {\n                break;\n            }\n\n            prefix++;\n        }\n\n        /* This is a type comment if we matched all of type_comment_prefix. */\n        if (!*prefix) {\n            int is_type_ignore = 1;\n            const char *ignore_end = p + 6;\n            tok_backup(tok, c);  /* don't eat the newline or EOF */\n\n            type_start = p;\n\n            /* A TYPE_IGNORE is \"type: ignore\" followed by the end of the token\n             * or anything ASCII and non-alphanumeric. */\n            is_type_ignore = (\n                tok->cur >= ignore_end && memcmp(p, \"ignore\", 6) == 0\n                && !(tok->cur > ignore_end\n                     && ((unsigned char)ignore_end[0] >= 128 || Py_ISALNUM(ignore_end[0]))));\n\n            if (is_type_ignore) {\n                *p_start = (char *) ignore_end;\n                *p_end = tok->cur;\n\n                /* If this type ignore is the only thing on the line, consume the newline also. */\n                if (blankline) {\n                    tok_nextc(tok);\n                    tok->atbol = 1;\n                }\n                return TYPE_IGNORE;\n            } else {\n                *p_start = (char *) type_start;  /* after type_comment_prefix */\n                *p_end = tok->cur;\n                return TYPE_COMMENT;\n            }\n        }\n\n    }\n\n    /* Check for EOF and errors now */\n    if (c == EOF) {\n        return tok->done == E_EOF ? ENDMARKER : ERRORTOKEN;\n    }\n\n    /* Identifier (most frequent token!) */\n    if (Py_ISALPHA(c) || c == '_') {\n        /* Process r\"\", u\"\" and ur\"\" */\n        switch (c) {\n        case 'b':\n        case 'B':\n            c = tok_nextc(tok);\n            if (c == 'r' || c == 'R')\n                c = tok_nextc(tok);\n            if (c == '\"' || c == '\\'')\n                goto letter_quote;\n            break;\n        case 'r':\n        case 'R':\n            c = tok_nextc(tok);\n            if (c == '\"' || c == '\\'')\n                goto letter_quote;\n            break;\n        case 'u':\n        case 'U':\n            c = tok_nextc(tok);\n            if (c == 'r' || c == 'R')\n                c = tok_nextc(tok);\n            if (c == '\"' || c == '\\'')\n                goto letter_quote;\n            break;\n        }\n        while (c != EOF && (Py_ISALNUM(c) || c == '_')) {\n            c = tok_nextc(tok);\n        }\n        tok_backup(tok, c);\n        *p_start = tok->start;\n        *p_end = tok->cur;\n        return NAME;\n    }\n\n    /* Newline */\n    if (c == '\\n') {\n        tok->atbol = 1;\n        if (blankline || tok->level > 0)\n            goto nextline;\n        *p_start = tok->start;\n        *p_end = tok->cur - 1; /* Leave '\\n' out of the string */\n        tok->cont_line = 0;\n        return NEWLINE;\n    }\n\n    /* Period or number starting with period? */\n    if (c == '.') {\n        c = tok_nextc(tok);\n        if (isdigit(c)) {\n            goto fraction;\n        }\n        else {\n            tok_backup(tok, c);\n            *p_start = tok->start;\n            *p_end = tok->cur;\n            return DOT;\n        }\n    }\n\n    /* Number */\n    if (isdigit(c)) {\n        if (c == '0') {\n            /* Hex, octal or binary -- maybe. */\n            c = tok_nextc(tok);\n            if (c == '.')\n                goto fraction;\n#ifndef WITHOUT_COMPLEX\n            if (c == 'j' || c == 'J')\n                goto imaginary;\n#endif\n            if (c == 'x' || c == 'X') {\n\n                /* Hex */\n                c = tok_nextc(tok);\n                if (!isxdigit(c)) {\n                    tok->done = E_TOKEN;\n                    tok_backup(tok, c);\n                    return ERRORTOKEN;\n                }\n                do {\n                    c = tok_nextc(tok);\n                } while (isxdigit(c));\n            }\n            else if (c == 'o' || c == 'O') {\n                /* Octal */\n                c = tok_nextc(tok);\n                if (c < '0' || c >= '8') {\n                    tok->done = E_TOKEN;\n                    tok_backup(tok, c);\n                    return ERRORTOKEN;\n                }\n                do {\n                    c = tok_nextc(tok);\n                } while ('0' <= c && c < '8');\n            }\n            else if (c == 'b' || c == 'B') {\n                /* Binary */\n                c = tok_nextc(tok);\n                if (c != '0' && c != '1') {\n                    tok->done = E_TOKEN;\n                    tok_backup(tok, c);\n                    return ERRORTOKEN;\n                }\n                do {\n                    c = tok_nextc(tok);\n                } while (c == '0' || c == '1');\n            }\n            else {\n                int found_decimal = 0;\n                /* Octal; c is first char of it */\n                /* There's no 'isoctdigit' macro, sigh */\n                while ('0' <= c && c < '8') {\n                    c = tok_nextc(tok);\n                }\n                if (isdigit(c)) {\n                    found_decimal = 1;\n                    do {\n                        c = tok_nextc(tok);\n                    } while (isdigit(c));\n                }\n                if (c == '.')\n                    goto fraction;\n                else if (c == 'e' || c == 'E')\n                    goto exponent;\n#ifndef WITHOUT_COMPLEX\n                else if (c == 'j' || c == 'J')\n                    goto imaginary;\n#endif\n                else if (found_decimal) {\n                    tok->done = E_TOKEN;\n                    tok_backup(tok, c);\n                    return ERRORTOKEN;\n                }\n            }\n            if (c == 'l' || c == 'L')\n                c = tok_nextc(tok);\n        }\n        else {\n            /* Decimal */\n            do {\n                c = tok_nextc(tok);\n            } while (isdigit(c));\n            if (c == 'l' || c == 'L')\n                c = tok_nextc(tok);\n            else {\n                /* Accept floating point numbers. */\n                if (c == '.') {\n        fraction:\n                    /* Fraction */\n                    do {\n                        c = tok_nextc(tok);\n                    } while (isdigit(c));\n                }\n                if (c == 'e' || c == 'E') {\n                    int e;\n                  exponent:\n                    e = c;\n                    /* Exponent part */\n                    c = tok_nextc(tok);\n                    if (c == '+' || c == '-') {\n                        c = tok_nextc(tok);\n                        if (!isdigit(c)) {\n                            tok->done = E_TOKEN;\n                            tok_backup(tok, c);\n                            return ERRORTOKEN;\n                        }\n                    } else if (!isdigit(c)) {\n                        tok_backup(tok, c);\n                        tok_backup(tok, e);\n                        *p_start = tok->start;\n                        *p_end = tok->cur;\n                        return NUMBER;\n                    }\n                    do {\n                        c = tok_nextc(tok);\n                    } while (isdigit(c));\n                }\n#ifndef WITHOUT_COMPLEX\n                if (c == 'j' || c == 'J')\n                    /* Imaginary part */\n        imaginary:\n                    c = tok_nextc(tok);\n#endif\n            }\n        }\n        tok_backup(tok, c);\n        *p_start = tok->start;\n        *p_end = tok->cur;\n        return NUMBER;\n    }\n\n  letter_quote:\n    /* String */\n    if (c == '\\'' || c == '\"') {\n        Py_ssize_t quote2 = tok->cur - tok->start + 1;\n        int quote = c;\n        int triple = 0;\n        int tripcount = 0;\n        for (;;) {\n            c = tok_nextc(tok);\n            if (c == '\\n') {\n                if (!triple) {\n                    tok->done = E_EOLS;\n                    tok_backup(tok, c);\n                    return ERRORTOKEN;\n                }\n                tripcount = 0;\n                tok->cont_line = 1; /* multiline string. */\n            }\n            else if (c == EOF) {\n                if (triple)\n                    tok->done = E_EOFS;\n                else\n                    tok->done = E_EOLS;\n                tok->cur = tok->inp;\n                return ERRORTOKEN;\n            }\n            else if (c == quote) {\n                tripcount++;\n                if (tok->cur - tok->start == quote2) {\n                    c = tok_nextc(tok);\n                    if (c == quote) {\n                        triple = 1;\n                        tripcount = 0;\n                        continue;\n                    }\n                    tok_backup(tok, c);\n                }\n                if (!triple || tripcount == 3)\n                    break;\n            }\n            else if (c == '\\\\') {\n                tripcount = 0;\n                c = tok_nextc(tok);\n                if (c == EOF) {\n                    tok->done = E_EOLS;\n                    tok->cur = tok->inp;\n                    return ERRORTOKEN;\n                }\n            }\n            else\n                tripcount = 0;\n        }\n        *p_start = tok->start;\n        *p_end = tok->cur;\n        return STRING;\n    }\n\n    /* Line continuation */\n    if (c == '\\\\') {\n        c = tok_nextc(tok);\n        if (c != '\\n') {\n            tok->done = E_LINECONT;\n            tok->cur = tok->inp;\n            return ERRORTOKEN;\n        }\n        tok->cont_line = 1;\n        goto again; /* Read next line */\n    }\n\n    /* Check for two-character token */\n    {\n        int c2 = tok_nextc(tok);\n        int token = Ta27Token_TwoChars(c, c2);\n#ifndef PGEN\n        if (token == NOTEQUAL && c == '<') {\n            if (PyErr_WarnExplicit(PyExc_DeprecationWarning,\n                                   \"<> not supported in 3.x; use !=\",\n                                   tok->filename, tok->lineno,\n                                   NULL, NULL)) {\n                return ERRORTOKEN;\n            }\n        }\n#endif\n        if (token != OP) {\n            int c3 = tok_nextc(tok);\n            int token3 = Ta27Token_ThreeChars(c, c2, c3);\n            if (token3 != OP) {\n                token = token3;\n            } else {\n                tok_backup(tok, c3);\n            }\n            *p_start = tok->start;\n            *p_end = tok->cur;\n            return token;\n        }\n        tok_backup(tok, c2);\n    }\n\n    /* Keep track of parentheses nesting level */\n    switch (c) {\n    case '(':\n    case '[':\n    case '{':\n        tok->level++;\n        break;\n    case ')':\n    case ']':\n    case '}':\n        tok->level--;\n        break;\n    }\n\n    /* Punctuation character */\n    *p_start = tok->start;\n    *p_end = tok->cur;\n    return Ta27Token_OneChar(c);\n}\n\nint\nTa27Tokenizer_Get(struct tok_state *tok, char **p_start, char **p_end)\n{\n    int result = tok_get(tok, p_start, p_end);\n    if (tok->decoding_erred) {\n        result = ERRORTOKEN;\n        tok->done = E_DECODE;\n    }\n    return result;\n}\n\n/* This function is only called from parsetok. However, it cannot live\n   there, as it must be empty for PGEN, and we can check for PGEN only\n   in this file. */\n\n#if defined(PGEN) || !defined(Py_USING_UNICODE)\nchar*\nTa27Tokenizer_RestoreEncoding(struct tok_state* tok, int len, int* offset)\n{\n    return NULL;\n}\n#else\n#ifdef Py_USING_UNICODE\nstatic PyObject *\ndec_utf8(const char *enc, const char *text, size_t len) {\n    PyObject *ret = NULL;\n    PyObject *unicode_text = PyUnicode_DecodeUTF8(text, len, \"replace\");\n    if (unicode_text) {\n        ret = PyUnicode_AsEncodedString(unicode_text, enc, \"replace\");\n        Py_DECREF(unicode_text);\n    }\n    if (!ret) {\n        PyErr_Clear();\n    }\n    return ret;\n}\nchar *\nTa27Tokenizer_RestoreEncoding(struct tok_state* tok, int len, int *offset)\n{\n    char *text = NULL;\n    if (tok->encoding) {\n        /* convert source to original encondig */\n        PyObject *lineobj = dec_utf8(tok->encoding, tok->buf, len);\n        if (lineobj != NULL) {\n            int linelen = PyBytes_Size(lineobj);\n            const char *line = PyBytes_AsString(lineobj);\n            text = PyObject_MALLOC(linelen + 1);\n            if (text != NULL && line != NULL) {\n                if (linelen)\n                    strncpy(text, line, linelen);\n                text[linelen] = '\\0';\n            }\n            Py_DECREF(lineobj);\n\n            /* adjust error offset */\n            if (*offset > 1) {\n                PyObject *offsetobj = dec_utf8(tok->encoding,\n                                               tok->buf, *offset-1);\n                if (offsetobj) {\n                    *offset = PyBytes_Size(offsetobj) + 1;\n                    Py_DECREF(offsetobj);\n                }\n            }\n\n        }\n    }\n    return text;\n\n}\n#endif /* defined(Py_USING_UNICODE) */\n#endif\n\n\n#ifdef Py_DEBUG\n\nvoid\ntok_dump(int type, char *start, char *end)\n{\n    printf(\"%s\", _Ta27Parser_TokenNames[type]);\n    if (type == NAME || type == NUMBER || type == STRING || type == OP)\n        printf(\"(%.*s)\", (int)(end - start), start);\n}\n\n#endif\n"
  },
  {
    "path": "ast27/Parser/tokenizer.h",
    "content": "#ifndef Ta27_TOKENIZER_H\n#define Ta27_TOKENIZER_H\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n#include \"object.h\"\n\n/* Tokenizer interface */\n\n#include \"../Include/token.h\"\n\n#define MAXINDENT 100   /* Max indentation level */\n\n/* Tokenizer state */\nstruct tok_state {\n    /* Input state; buf <= cur <= inp <= end */\n    /* NB an entire line is held in the buffer */\n    char *buf;          /* Input buffer, or NULL; malloc'ed if fp != NULL */\n    char *cur;          /* Next character in buffer */\n    char *inp;          /* End of data in buffer */\n    char *end;          /* End of input buffer if buf != NULL */\n    char *start;        /* Start of current token if not NULL */\n    int done;           /* E_OK normally, E_EOF at EOF, otherwise error code */\n    /* NB If done != E_OK, cur must be == inp!!! */\n    FILE *fp;           /* Rest of input; NULL if tokenizing a string */\n    int tabsize;        /* Tab spacing */\n    int indent;         /* Current indentation index */\n    int indstack[MAXINDENT];            /* Stack of indents */\n    int atbol;          /* Nonzero if at begin of new line */\n    int pendin;         /* Pending indents (if > 0) or dedents (if < 0) */\n    char *prompt, *nextprompt;          /* For interactive prompting */\n    int lineno;         /* Current line number */\n    int level;          /* () [] {} Parentheses nesting level */\n            /* Used to allow free continuations inside them */\n    /* Stuff for checking on different tab sizes */\n    const char *filename;       /* For error messages */\n    int altwarning;     /* Issue warning if alternate tabs don't match */\n    int alterror;       /* Issue error if alternate tabs don't match */\n    int alttabsize;     /* Alternate tab spacing */\n    int altindstack[MAXINDENT];         /* Stack of alternate indents */\n    /* Stuff for PEP 0263 */\n    int decoding_state;         /* -1:decoding, 0:init, 1:raw */\n    int decoding_erred;         /* whether erred in decoding  */\n    int read_coding_spec;       /* whether 'coding:...' has been read  */\n    char *encoding;\n    int cont_line;          /* whether we are in a continuation line. */\n    const char* line_start;     /* pointer to start of current line */\n#ifndef PGEN\n    PyObject *decoding_readline; /* codecs.open(...).readline */\n    PyObject *decoding_buffer;\n#endif\n    const char* enc;\n    const char* str;\n    const char* input; /* Tokenizer's newline translated copy of the string. */\n};\n\nextern struct tok_state *Ta27Tokenizer_FromString(const char *, int);\nextern struct tok_state *Ta27Tokenizer_FromUTF8(const char *, int);\nextern struct tok_state *Ta27Tokenizer_FromFile(FILE *, char *, char *);\nextern void Ta27Tokenizer_Free(struct tok_state *);\nextern int Ta27Tokenizer_Get(struct tok_state *, char **, char **);\n#if defined(PGEN) || defined(Py_USING_UNICODE)\nextern char * Ta27Tokenizer_RestoreEncoding(struct tok_state* tok,\n                                          int len, int *offset);\n#endif\n\n#ifdef __cplusplus\n}\n#endif\n#endif /* !Ta27_TOKENIZER_H */\n"
  },
  {
    "path": "ast27/Python/Python-ast.c",
    "content": "/* File automatically generated by Parser/asdl_c.py. */\n\n\n/*\n   __version__ 82160.\n\n   This module must be committed separately after each AST grammar change;\n   The __version__ number is set to the revision number of the commit\n   containing the grammar change.\n*/\n\n#include \"Python.h\"\n#include \"../Include/Python-ast.h\"\n\nstatic PyTypeObject AST_type;\nstatic PyTypeObject *mod_type;\nstatic PyObject* ast2obj_mod(void*);\nstatic PyTypeObject *Module_type;\nstatic char *Module_fields[]={\n        \"body\",\n        \"type_ignores\",\n};\nstatic PyTypeObject *Interactive_type;\nstatic char *Interactive_fields[]={\n        \"body\",\n};\nstatic PyTypeObject *Expression_type;\nstatic char *Expression_fields[]={\n        \"body\",\n};\nstatic PyTypeObject *FunctionType_type;\nstatic char *FunctionType_fields[]={\n        \"argtypes\",\n        \"returns\",\n};\nstatic PyTypeObject *Suite_type;\nstatic char *Suite_fields[]={\n        \"body\",\n};\nstatic PyTypeObject *stmt_type;\nstatic char *stmt_attributes[] = {\n        \"lineno\",\n        \"col_offset\",\n};\nstatic PyObject* ast2obj_stmt(void*);\nstatic PyTypeObject *FunctionDef_type;\nstatic char *FunctionDef_fields[]={\n        \"name\",\n        \"args\",\n        \"body\",\n        \"decorator_list\",\n        \"type_comment\",\n};\nstatic PyTypeObject *ClassDef_type;\nstatic char *ClassDef_fields[]={\n        \"name\",\n        \"bases\",\n        \"body\",\n        \"decorator_list\",\n};\nstatic PyTypeObject *Return_type;\nstatic char *Return_fields[]={\n        \"value\",\n};\nstatic PyTypeObject *Delete_type;\nstatic char *Delete_fields[]={\n        \"targets\",\n};\nstatic PyTypeObject *Assign_type;\nstatic char *Assign_fields[]={\n        \"targets\",\n        \"value\",\n        \"type_comment\",\n};\nstatic PyTypeObject *AugAssign_type;\nstatic char *AugAssign_fields[]={\n        \"target\",\n        \"op\",\n        \"value\",\n};\nstatic PyTypeObject *Print_type;\nstatic char *Print_fields[]={\n        \"dest\",\n        \"values\",\n        \"nl\",\n};\nstatic PyTypeObject *For_type;\nstatic char *For_fields[]={\n        \"target\",\n        \"iter\",\n        \"body\",\n        \"orelse\",\n        \"type_comment\",\n};\nstatic PyTypeObject *While_type;\nstatic char *While_fields[]={\n        \"test\",\n        \"body\",\n        \"orelse\",\n};\nstatic PyTypeObject *If_type;\nstatic char *If_fields[]={\n        \"test\",\n        \"body\",\n        \"orelse\",\n};\nstatic PyTypeObject *With_type;\nstatic char *With_fields[]={\n        \"context_expr\",\n        \"optional_vars\",\n        \"body\",\n        \"type_comment\",\n};\nstatic PyTypeObject *Raise_type;\nstatic char *Raise_fields[]={\n        \"type\",\n        \"inst\",\n        \"tback\",\n};\nstatic PyTypeObject *TryExcept_type;\nstatic char *TryExcept_fields[]={\n        \"body\",\n        \"handlers\",\n        \"orelse\",\n};\nstatic PyTypeObject *TryFinally_type;\nstatic char *TryFinally_fields[]={\n        \"body\",\n        \"finalbody\",\n};\nstatic PyTypeObject *Assert_type;\nstatic char *Assert_fields[]={\n        \"test\",\n        \"msg\",\n};\nstatic PyTypeObject *Import_type;\nstatic char *Import_fields[]={\n        \"names\",\n};\nstatic PyTypeObject *ImportFrom_type;\nstatic char *ImportFrom_fields[]={\n        \"module\",\n        \"names\",\n        \"level\",\n};\nstatic PyTypeObject *Exec_type;\nstatic char *Exec_fields[]={\n        \"body\",\n        \"globals\",\n        \"locals\",\n};\nstatic PyTypeObject *Global_type;\nstatic char *Global_fields[]={\n        \"names\",\n};\nstatic PyTypeObject *Expr_type;\nstatic char *Expr_fields[]={\n        \"value\",\n};\nstatic PyTypeObject *Pass_type;\nstatic PyTypeObject *Break_type;\nstatic PyTypeObject *Continue_type;\nstatic PyTypeObject *expr_type;\nstatic char *expr_attributes[] = {\n        \"lineno\",\n        \"col_offset\",\n};\nstatic PyObject* ast2obj_expr(void*);\nstatic PyTypeObject *BoolOp_type;\nstatic char *BoolOp_fields[]={\n        \"op\",\n        \"values\",\n};\nstatic PyTypeObject *BinOp_type;\nstatic char *BinOp_fields[]={\n        \"left\",\n        \"op\",\n        \"right\",\n};\nstatic PyTypeObject *UnaryOp_type;\nstatic char *UnaryOp_fields[]={\n        \"op\",\n        \"operand\",\n};\nstatic PyTypeObject *Lambda_type;\nstatic char *Lambda_fields[]={\n        \"args\",\n        \"body\",\n};\nstatic PyTypeObject *IfExp_type;\nstatic char *IfExp_fields[]={\n        \"test\",\n        \"body\",\n        \"orelse\",\n};\nstatic PyTypeObject *Dict_type;\nstatic char *Dict_fields[]={\n        \"keys\",\n        \"values\",\n};\nstatic PyTypeObject *Set_type;\nstatic char *Set_fields[]={\n        \"elts\",\n};\nstatic PyTypeObject *ListComp_type;\nstatic char *ListComp_fields[]={\n        \"elt\",\n        \"generators\",\n};\nstatic PyTypeObject *SetComp_type;\nstatic char *SetComp_fields[]={\n        \"elt\",\n        \"generators\",\n};\nstatic PyTypeObject *DictComp_type;\nstatic char *DictComp_fields[]={\n        \"key\",\n        \"value\",\n        \"generators\",\n};\nstatic PyTypeObject *GeneratorExp_type;\nstatic char *GeneratorExp_fields[]={\n        \"elt\",\n        \"generators\",\n};\nstatic PyTypeObject *Yield_type;\nstatic char *Yield_fields[]={\n        \"value\",\n};\nstatic PyTypeObject *Compare_type;\nstatic char *Compare_fields[]={\n        \"left\",\n        \"ops\",\n        \"comparators\",\n};\nstatic PyTypeObject *Call_type;\nstatic char *Call_fields[]={\n        \"func\",\n        \"args\",\n        \"keywords\",\n        \"starargs\",\n        \"kwargs\",\n};\nstatic PyTypeObject *Repr_type;\nstatic char *Repr_fields[]={\n        \"value\",\n};\nstatic PyTypeObject *Num_type;\nstatic char *Num_fields[]={\n        \"n\",\n};\nstatic PyTypeObject *Str_type;\nstatic char *Str_fields[]={\n        \"s\",\n        \"kind\",\n};\nstatic PyTypeObject *Attribute_type;\nstatic char *Attribute_fields[]={\n        \"value\",\n        \"attr\",\n        \"ctx\",\n};\nstatic PyTypeObject *Subscript_type;\nstatic char *Subscript_fields[]={\n        \"value\",\n        \"slice\",\n        \"ctx\",\n};\nstatic PyTypeObject *Name_type;\nstatic char *Name_fields[]={\n        \"id\",\n        \"ctx\",\n};\nstatic PyTypeObject *List_type;\nstatic char *List_fields[]={\n        \"elts\",\n        \"ctx\",\n};\nstatic PyTypeObject *Tuple_type;\nstatic char *Tuple_fields[]={\n        \"elts\",\n        \"ctx\",\n};\nstatic PyTypeObject *expr_context_type;\nstatic PyObject *Load_singleton, *Store_singleton, *Del_singleton, *AugLoad_singleton,\n*AugStore_singleton, *Param_singleton;\nstatic PyObject* ast2obj_expr_context(expr_context_ty);\nstatic PyTypeObject *Load_type;\nstatic PyTypeObject *Store_type;\nstatic PyTypeObject *Del_type;\nstatic PyTypeObject *AugLoad_type;\nstatic PyTypeObject *AugStore_type;\nstatic PyTypeObject *Param_type;\nstatic PyTypeObject *slice_type;\nstatic PyObject* ast2obj_slice(void*);\nstatic PyTypeObject *Ellipsis_type;\nstatic PyTypeObject *Slice_type;\nstatic char *Slice_fields[]={\n        \"lower\",\n        \"upper\",\n        \"step\",\n};\nstatic PyTypeObject *ExtSlice_type;\nstatic char *ExtSlice_fields[]={\n        \"dims\",\n};\nstatic PyTypeObject *Index_type;\nstatic char *Index_fields[]={\n        \"value\",\n};\nstatic PyTypeObject *boolop_type;\nstatic PyObject *And_singleton, *Or_singleton;\nstatic PyObject* ast2obj_boolop(boolop_ty);\nstatic PyTypeObject *And_type;\nstatic PyTypeObject *Or_type;\nstatic PyTypeObject *operator_type;\nstatic PyObject *Add_singleton, *Sub_singleton, *Mult_singleton, *Div_singleton, *Mod_singleton,\n*Pow_singleton, *LShift_singleton, *RShift_singleton, *BitOr_singleton, *BitXor_singleton,\n*BitAnd_singleton, *FloorDiv_singleton;\nstatic PyObject* ast2obj_operator(operator_ty);\nstatic PyTypeObject *Add_type;\nstatic PyTypeObject *Sub_type;\nstatic PyTypeObject *Mult_type;\nstatic PyTypeObject *Div_type;\nstatic PyTypeObject *Mod_type;\nstatic PyTypeObject *Pow_type;\nstatic PyTypeObject *LShift_type;\nstatic PyTypeObject *RShift_type;\nstatic PyTypeObject *BitOr_type;\nstatic PyTypeObject *BitXor_type;\nstatic PyTypeObject *BitAnd_type;\nstatic PyTypeObject *FloorDiv_type;\nstatic PyTypeObject *unaryop_type;\nstatic PyObject *Invert_singleton, *Not_singleton, *UAdd_singleton, *USub_singleton;\nstatic PyObject* ast2obj_unaryop(unaryop_ty);\nstatic PyTypeObject *Invert_type;\nstatic PyTypeObject *Not_type;\nstatic PyTypeObject *UAdd_type;\nstatic PyTypeObject *USub_type;\nstatic PyTypeObject *cmpop_type;\nstatic PyObject *Eq_singleton, *NotEq_singleton, *Lt_singleton, *LtE_singleton, *Gt_singleton,\n*GtE_singleton, *Is_singleton, *IsNot_singleton, *In_singleton, *NotIn_singleton;\nstatic PyObject* ast2obj_cmpop(cmpop_ty);\nstatic PyTypeObject *Eq_type;\nstatic PyTypeObject *NotEq_type;\nstatic PyTypeObject *Lt_type;\nstatic PyTypeObject *LtE_type;\nstatic PyTypeObject *Gt_type;\nstatic PyTypeObject *GtE_type;\nstatic PyTypeObject *Is_type;\nstatic PyTypeObject *IsNot_type;\nstatic PyTypeObject *In_type;\nstatic PyTypeObject *NotIn_type;\nstatic PyTypeObject *comprehension_type;\nstatic PyObject* ast2obj_comprehension(void*);\nstatic char *comprehension_fields[]={\n        \"target\",\n        \"iter\",\n        \"ifs\",\n};\nstatic PyTypeObject *excepthandler_type;\nstatic char *excepthandler_attributes[] = {\n        \"lineno\",\n        \"col_offset\",\n};\nstatic PyObject* ast2obj_excepthandler(void*);\nstatic PyTypeObject *ExceptHandler_type;\nstatic char *ExceptHandler_fields[]={\n        \"type\",\n        \"name\",\n        \"body\",\n};\nstatic PyTypeObject *arguments_type;\nstatic PyObject* ast2obj_arguments(void*);\nstatic char *arguments_fields[]={\n        \"args\",\n        \"vararg\",\n        \"kwarg\",\n        \"defaults\",\n        \"type_comments\",\n};\nstatic PyTypeObject *keyword_type;\nstatic PyObject* ast2obj_keyword(void*);\nstatic char *keyword_fields[]={\n        \"arg\",\n        \"value\",\n};\nstatic PyTypeObject *alias_type;\nstatic PyObject* ast2obj_alias(void*);\nstatic char *alias_fields[]={\n        \"name\",\n        \"asname\",\n};\nstatic PyTypeObject *type_ignore_type;\nstatic PyObject* ast2obj_type_ignore(void*);\nstatic PyTypeObject *TypeIgnore_type;\nstatic char *TypeIgnore_fields[]={\n        \"lineno\",\n        \"tag\",\n};\n\n\nstatic int\nast_type_init(PyObject *self, PyObject *args, PyObject *kw)\n{\n    Py_ssize_t i, numfields = 0;\n    int res = -1;\n    PyObject *key, *value, *fields;\n    fields = PyObject_GetAttrString((PyObject*)Py_TYPE(self), \"_fields\");\n    if (!fields)\n        PyErr_Clear();\n    if (fields) {\n        numfields = PySequence_Size(fields);\n        if (numfields == -1)\n            goto cleanup;\n    }\n    res = 0; /* if no error occurs, this stays 0 to the end */\n    if (PyTuple_GET_SIZE(args) > 0) {\n        if (numfields != PyTuple_GET_SIZE(args)) {\n            PyErr_Format(PyExc_TypeError, \"%.400s constructor takes %s\"\n                         \"%zd positional argument%s\",\n                         Py_TYPE(self)->tp_name,\n                         numfields == 0 ? \"\" : \"either 0 or \",\n                         numfields, numfields == 1 ? \"\" : \"s\");\n            res = -1;\n            goto cleanup;\n        }\n        for (i = 0; i < PyTuple_GET_SIZE(args); i++) {\n            /* cannot be reached when fields is NULL */\n            PyObject *name = PySequence_GetItem(fields, i);\n            if (!name) {\n                res = -1;\n                goto cleanup;\n            }\n            res = PyObject_SetAttr(self, name, PyTuple_GET_ITEM(args, i));\n            Py_DECREF(name);\n            if (res < 0)\n                goto cleanup;\n        }\n    }\n    if (kw) {\n        i = 0;  /* needed by PyDict_Next */\n        while (PyDict_Next(kw, &i, &key, &value)) {\n            res = PyObject_SetAttr(self, key, value);\n            if (res < 0)\n                goto cleanup;\n        }\n    }\n  cleanup:\n    Py_XDECREF(fields);\n    return res;\n}\n\n/* Pickling support */\nstatic PyObject *\nast_type_reduce(PyObject *self, PyObject *unused)\n{\n    PyObject *res;\n    PyObject *dict = PyObject_GetAttrString(self, \"__dict__\");\n    if (dict == NULL) {\n        if (PyErr_ExceptionMatches(PyExc_AttributeError))\n            PyErr_Clear();\n        else\n            return NULL;\n    }\n    if (dict) {\n        res = Py_BuildValue(\"O()O\", Py_TYPE(self), dict);\n        Py_DECREF(dict);\n        return res;\n    }\n    return Py_BuildValue(\"O()\", Py_TYPE(self));\n}\n\nstatic PyMethodDef ast_type_methods[] = {\n    {\"__reduce__\", ast_type_reduce, METH_NOARGS, NULL},\n    {NULL}\n};\n\nstatic PyTypeObject AST_type = {\n    PyVarObject_HEAD_INIT(NULL, 0)\n    \"typed_ast._ast27.AST\",\n    sizeof(PyObject),\n    0,\n    0,                       /* tp_dealloc */\n    0,                       /* tp_print */\n    0,                       /* tp_getattr */\n    0,                       /* tp_setattr */\n    0,                       /* tp_compare */\n    0,                       /* tp_repr */\n    0,                       /* tp_as_number */\n    0,                       /* tp_as_sequence */\n    0,                       /* tp_as_mapping */\n    0,                       /* tp_hash */\n    0,                       /* tp_call */\n    0,                       /* tp_str */\n    PyObject_GenericGetAttr, /* tp_getattro */\n    PyObject_GenericSetAttr, /* tp_setattro */\n    0,                       /* tp_as_buffer */\n    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */\n    0,                       /* tp_doc */\n    0,                       /* tp_traverse */\n    0,                       /* tp_clear */\n    0,                       /* tp_richcompare */\n    0,                       /* tp_weaklistoffset */\n    0,                       /* tp_iter */\n    0,                       /* tp_iternext */\n    ast_type_methods,        /* tp_methods */\n    0,                       /* tp_members */\n    0,                       /* tp_getset */\n    0,                       /* tp_base */\n    0,                       /* tp_dict */\n    0,                       /* tp_descr_get */\n    0,                       /* tp_descr_set */\n    0,                       /* tp_dictoffset */\n    (initproc)ast_type_init, /* tp_init */\n    PyType_GenericAlloc,     /* tp_alloc */\n    PyType_GenericNew,       /* tp_new */\n    PyObject_Del,            /* tp_free */\n};\n\n\nstatic PyTypeObject* make_type(char *type, PyTypeObject* base, char**fields, int num_fields)\n{\n    PyObject *fnames, *result;\n    int i;\n    fnames = PyTuple_New(num_fields);\n    if (!fnames) return NULL;\n    for (i = 0; i < num_fields; i++) {\n        PyObject *field = PyUnicode_FromString(fields[i]);\n        if (!field) {\n            Py_DECREF(fnames);\n            return NULL;\n        }\n        PyTuple_SET_ITEM(fnames, i, field);\n    }\n    result = PyObject_CallFunction((PyObject*)&PyType_Type, \"s(O){sOss}\",\n                    type, base, \"_fields\", fnames, \"__module__\", \"typed_ast._ast27\");\n    Py_DECREF(fnames);\n    return (PyTypeObject*)result;\n}\n\nstatic int add_attributes(PyTypeObject* type, char**attrs, int num_fields)\n{\n    int i, result;\n    PyObject *s, *l = PyTuple_New(num_fields);\n    if (!l)\n        return 0;\n    for (i = 0; i < num_fields; i++) {\n        s = PyUnicode_FromString(attrs[i]);\n        if (!s) {\n            Py_DECREF(l);\n            return 0;\n        }\n        PyTuple_SET_ITEM(l, i, s);\n    }\n    result = PyObject_SetAttrString((PyObject*)type, \"_attributes\", l) >= 0;\n    Py_DECREF(l);\n    return result;\n}\n\n/* Conversion AST -> Python */\n\nstatic PyObject* ast2obj_list(asdl_seq *seq, PyObject* (*func)(void*))\n{\n    int i, n = asdl_seq_LEN(seq);\n    PyObject *result = PyList_New(n);\n    PyObject *value;\n    if (!result)\n        return NULL;\n    for (i = 0; i < n; i++) {\n        value = func(asdl_seq_GET(seq, i));\n        if (!value) {\n            Py_DECREF(result);\n            return NULL;\n        }\n        PyList_SET_ITEM(result, i, value);\n    }\n    return result;\n}\n\nstatic PyObject* ast2obj_object(void *o)\n{\n    if (!o)\n        o = Py_None;\n    Py_INCREF((PyObject*)o);\n    return (PyObject*)o;\n}\n#define ast2obj_identifier ast2obj_object\n#define ast2obj_string ast2obj_object\nstatic PyObject* ast2obj_bool(bool b)\n{\n    return PyBool_FromLong(b);\n}\n\nstatic PyObject* ast2obj_int(long b)\n{\n    return PyLong_FromLong(b);\n}\n\n/* Conversion Python -> AST */\n\nstatic int obj2ast_object(PyObject* obj, PyObject** out, PyArena* arena)\n{\n    if (obj == Py_None)\n        obj = NULL;\n    if (obj)\n        PyArena_AddPyObject(arena, obj);\n    Py_XINCREF(obj);\n    *out = obj;\n    return 0;\n}\n\nstatic int obj2ast_identifier(PyObject* obj, PyObject** out, PyArena* arena)\n{\n    if (!PyUnicode_CheckExact(obj) && obj != Py_None) {\n        PyErr_Format(PyExc_TypeError,\n                    \"AST identifier must be of type str\");\n        return 1;\n    }\n    return obj2ast_object(obj, out, arena);\n}\n\nstatic int obj2ast_string(PyObject* obj, PyObject** out, PyArena* arena)\n{\n    if (!PyUnicode_CheckExact(obj) && !PyUnicode_CheckExact(obj)) {\n        PyErr_SetString(PyExc_TypeError,\n                       \"AST string must be of type str or unicode\");\n        return 1;\n    }\n    return obj2ast_object(obj, out, arena);\n}\n\nstatic int obj2ast_int(PyObject* obj, int* out, PyArena* arena)\n{\n    int i;\n    if (!PyLong_Check(obj) && !PyLong_Check(obj)) {\n        PyObject *s = PyObject_Repr(obj);\n        if (s == NULL) return 1;\n        PyErr_Format(PyExc_ValueError, \"invalid integer value: %.400s\",\n                     _PyUnicode_AsString(s));\n        Py_DECREF(s);\n        return 1;\n    }\n\n    i = (int)PyLong_AsLong(obj);\n    if (i == -1 && PyErr_Occurred())\n        return 1;\n    *out = i;\n    return 0;\n}\n\nstatic int obj2ast_bool(PyObject* obj, bool* out, PyArena* arena)\n{\n    if (!PyBool_Check(obj)) {\n        PyObject *s = PyObject_Repr(obj);\n        if (s == NULL) return 1;\n        PyErr_Format(PyExc_ValueError, \"invalid boolean value: %.400s\",\n                     _PyUnicode_AsString(s));\n        Py_DECREF(s);\n        return 1;\n    }\n\n    *out = (obj == Py_True);\n    return 0;\n}\n\nstatic int add_ast_fields(void)\n{\n    PyObject *empty_tuple, *d;\n    if (PyType_Ready(&AST_type) < 0)\n        return -1;\n    d = AST_type.tp_dict;\n    empty_tuple = PyTuple_New(0);\n    if (!empty_tuple ||\n        PyDict_SetItemString(d, \"_fields\", empty_tuple) < 0 ||\n        PyDict_SetItemString(d, \"_attributes\", empty_tuple) < 0) {\n        Py_XDECREF(empty_tuple);\n        return -1;\n    }\n    Py_DECREF(empty_tuple);\n    return 0;\n}\n\n\nstatic int init_types(void)\n{\n        static int initialized;\n        if (initialized) return 1;\n        if (add_ast_fields() < 0) return 0;\n        mod_type = make_type(\"mod\", &AST_type, NULL, 0);\n        if (!mod_type) return 0;\n        if (!add_attributes(mod_type, NULL, 0)) return 0;\n        Module_type = make_type(\"Module\", mod_type, Module_fields, 2);\n        if (!Module_type) return 0;\n        Interactive_type = make_type(\"Interactive\", mod_type, Interactive_fields, 1);\n        if (!Interactive_type) return 0;\n        Expression_type = make_type(\"Expression\", mod_type, Expression_fields, 1);\n        if (!Expression_type) return 0;\n        FunctionType_type = make_type(\"FunctionType\", mod_type, FunctionType_fields, 2);\n        if (!FunctionType_type) return 0;\n        Suite_type = make_type(\"Suite\", mod_type, Suite_fields, 1);\n        if (!Suite_type) return 0;\n        stmt_type = make_type(\"stmt\", &AST_type, NULL, 0);\n        if (!stmt_type) return 0;\n        if (!add_attributes(stmt_type, stmt_attributes, 2)) return 0;\n        FunctionDef_type = make_type(\"FunctionDef\", stmt_type, FunctionDef_fields, 5);\n        if (!FunctionDef_type) return 0;\n        ClassDef_type = make_type(\"ClassDef\", stmt_type, ClassDef_fields, 4);\n        if (!ClassDef_type) return 0;\n        Return_type = make_type(\"Return\", stmt_type, Return_fields, 1);\n        if (!Return_type) return 0;\n        Delete_type = make_type(\"Delete\", stmt_type, Delete_fields, 1);\n        if (!Delete_type) return 0;\n        Assign_type = make_type(\"Assign\", stmt_type, Assign_fields, 3);\n        if (!Assign_type) return 0;\n        AugAssign_type = make_type(\"AugAssign\", stmt_type, AugAssign_fields, 3);\n        if (!AugAssign_type) return 0;\n        Print_type = make_type(\"Print\", stmt_type, Print_fields, 3);\n        if (!Print_type) return 0;\n        For_type = make_type(\"For\", stmt_type, For_fields, 5);\n        if (!For_type) return 0;\n        While_type = make_type(\"While\", stmt_type, While_fields, 3);\n        if (!While_type) return 0;\n        If_type = make_type(\"If\", stmt_type, If_fields, 3);\n        if (!If_type) return 0;\n        With_type = make_type(\"With\", stmt_type, With_fields, 4);\n        if (!With_type) return 0;\n        Raise_type = make_type(\"Raise\", stmt_type, Raise_fields, 3);\n        if (!Raise_type) return 0;\n        TryExcept_type = make_type(\"TryExcept\", stmt_type, TryExcept_fields, 3);\n        if (!TryExcept_type) return 0;\n        TryFinally_type = make_type(\"TryFinally\", stmt_type, TryFinally_fields, 2);\n        if (!TryFinally_type) return 0;\n        Assert_type = make_type(\"Assert\", stmt_type, Assert_fields, 2);\n        if (!Assert_type) return 0;\n        Import_type = make_type(\"Import\", stmt_type, Import_fields, 1);\n        if (!Import_type) return 0;\n        ImportFrom_type = make_type(\"ImportFrom\", stmt_type, ImportFrom_fields, 3);\n        if (!ImportFrom_type) return 0;\n        Exec_type = make_type(\"Exec\", stmt_type, Exec_fields, 3);\n        if (!Exec_type) return 0;\n        Global_type = make_type(\"Global\", stmt_type, Global_fields, 1);\n        if (!Global_type) return 0;\n        Expr_type = make_type(\"Expr\", stmt_type, Expr_fields, 1);\n        if (!Expr_type) return 0;\n        Pass_type = make_type(\"Pass\", stmt_type, NULL, 0);\n        if (!Pass_type) return 0;\n        Break_type = make_type(\"Break\", stmt_type, NULL, 0);\n        if (!Break_type) return 0;\n        Continue_type = make_type(\"Continue\", stmt_type, NULL, 0);\n        if (!Continue_type) return 0;\n        expr_type = make_type(\"expr\", &AST_type, NULL, 0);\n        if (!expr_type) return 0;\n        if (!add_attributes(expr_type, expr_attributes, 2)) return 0;\n        BoolOp_type = make_type(\"BoolOp\", expr_type, BoolOp_fields, 2);\n        if (!BoolOp_type) return 0;\n        BinOp_type = make_type(\"BinOp\", expr_type, BinOp_fields, 3);\n        if (!BinOp_type) return 0;\n        UnaryOp_type = make_type(\"UnaryOp\", expr_type, UnaryOp_fields, 2);\n        if (!UnaryOp_type) return 0;\n        Lambda_type = make_type(\"Lambda\", expr_type, Lambda_fields, 2);\n        if (!Lambda_type) return 0;\n        IfExp_type = make_type(\"IfExp\", expr_type, IfExp_fields, 3);\n        if (!IfExp_type) return 0;\n        Dict_type = make_type(\"Dict\", expr_type, Dict_fields, 2);\n        if (!Dict_type) return 0;\n        Set_type = make_type(\"Set\", expr_type, Set_fields, 1);\n        if (!Set_type) return 0;\n        ListComp_type = make_type(\"ListComp\", expr_type, ListComp_fields, 2);\n        if (!ListComp_type) return 0;\n        SetComp_type = make_type(\"SetComp\", expr_type, SetComp_fields, 2);\n        if (!SetComp_type) return 0;\n        DictComp_type = make_type(\"DictComp\", expr_type, DictComp_fields, 3);\n        if (!DictComp_type) return 0;\n        GeneratorExp_type = make_type(\"GeneratorExp\", expr_type, GeneratorExp_fields, 2);\n        if (!GeneratorExp_type) return 0;\n        Yield_type = make_type(\"Yield\", expr_type, Yield_fields, 1);\n        if (!Yield_type) return 0;\n        Compare_type = make_type(\"Compare\", expr_type, Compare_fields, 3);\n        if (!Compare_type) return 0;\n        Call_type = make_type(\"Call\", expr_type, Call_fields, 5);\n        if (!Call_type) return 0;\n        Repr_type = make_type(\"Repr\", expr_type, Repr_fields, 1);\n        if (!Repr_type) return 0;\n        Num_type = make_type(\"Num\", expr_type, Num_fields, 1);\n        if (!Num_type) return 0;\n        Str_type = make_type(\"Str\", expr_type, Str_fields, 2);\n        if (!Str_type) return 0;\n        Attribute_type = make_type(\"Attribute\", expr_type, Attribute_fields, 3);\n        if (!Attribute_type) return 0;\n        Subscript_type = make_type(\"Subscript\", expr_type, Subscript_fields, 3);\n        if (!Subscript_type) return 0;\n        Name_type = make_type(\"Name\", expr_type, Name_fields, 2);\n        if (!Name_type) return 0;\n        List_type = make_type(\"List\", expr_type, List_fields, 2);\n        if (!List_type) return 0;\n        Tuple_type = make_type(\"Tuple\", expr_type, Tuple_fields, 2);\n        if (!Tuple_type) return 0;\n        expr_context_type = make_type(\"expr_context\", &AST_type, NULL, 0);\n        if (!expr_context_type) return 0;\n        if (!add_attributes(expr_context_type, NULL, 0)) return 0;\n        Load_type = make_type(\"Load\", expr_context_type, NULL, 0);\n        if (!Load_type) return 0;\n        Load_singleton = PyType_GenericNew(Load_type, NULL, NULL);\n        if (!Load_singleton) return 0;\n        Store_type = make_type(\"Store\", expr_context_type, NULL, 0);\n        if (!Store_type) return 0;\n        Store_singleton = PyType_GenericNew(Store_type, NULL, NULL);\n        if (!Store_singleton) return 0;\n        Del_type = make_type(\"Del\", expr_context_type, NULL, 0);\n        if (!Del_type) return 0;\n        Del_singleton = PyType_GenericNew(Del_type, NULL, NULL);\n        if (!Del_singleton) return 0;\n        AugLoad_type = make_type(\"AugLoad\", expr_context_type, NULL, 0);\n        if (!AugLoad_type) return 0;\n        AugLoad_singleton = PyType_GenericNew(AugLoad_type, NULL, NULL);\n        if (!AugLoad_singleton) return 0;\n        AugStore_type = make_type(\"AugStore\", expr_context_type, NULL, 0);\n        if (!AugStore_type) return 0;\n        AugStore_singleton = PyType_GenericNew(AugStore_type, NULL, NULL);\n        if (!AugStore_singleton) return 0;\n        Param_type = make_type(\"Param\", expr_context_type, NULL, 0);\n        if (!Param_type) return 0;\n        Param_singleton = PyType_GenericNew(Param_type, NULL, NULL);\n        if (!Param_singleton) return 0;\n        slice_type = make_type(\"slice\", &AST_type, NULL, 0);\n        if (!slice_type) return 0;\n        if (!add_attributes(slice_type, NULL, 0)) return 0;\n        Ellipsis_type = make_type(\"Ellipsis\", slice_type, NULL, 0);\n        if (!Ellipsis_type) return 0;\n        Slice_type = make_type(\"Slice\", slice_type, Slice_fields, 3);\n        if (!Slice_type) return 0;\n        ExtSlice_type = make_type(\"ExtSlice\", slice_type, ExtSlice_fields, 1);\n        if (!ExtSlice_type) return 0;\n        Index_type = make_type(\"Index\", slice_type, Index_fields, 1);\n        if (!Index_type) return 0;\n        boolop_type = make_type(\"boolop\", &AST_type, NULL, 0);\n        if (!boolop_type) return 0;\n        if (!add_attributes(boolop_type, NULL, 0)) return 0;\n        And_type = make_type(\"And\", boolop_type, NULL, 0);\n        if (!And_type) return 0;\n        And_singleton = PyType_GenericNew(And_type, NULL, NULL);\n        if (!And_singleton) return 0;\n        Or_type = make_type(\"Or\", boolop_type, NULL, 0);\n        if (!Or_type) return 0;\n        Or_singleton = PyType_GenericNew(Or_type, NULL, NULL);\n        if (!Or_singleton) return 0;\n        operator_type = make_type(\"operator\", &AST_type, NULL, 0);\n        if (!operator_type) return 0;\n        if (!add_attributes(operator_type, NULL, 0)) return 0;\n        Add_type = make_type(\"Add\", operator_type, NULL, 0);\n        if (!Add_type) return 0;\n        Add_singleton = PyType_GenericNew(Add_type, NULL, NULL);\n        if (!Add_singleton) return 0;\n        Sub_type = make_type(\"Sub\", operator_type, NULL, 0);\n        if (!Sub_type) return 0;\n        Sub_singleton = PyType_GenericNew(Sub_type, NULL, NULL);\n        if (!Sub_singleton) return 0;\n        Mult_type = make_type(\"Mult\", operator_type, NULL, 0);\n        if (!Mult_type) return 0;\n        Mult_singleton = PyType_GenericNew(Mult_type, NULL, NULL);\n        if (!Mult_singleton) return 0;\n        Div_type = make_type(\"Div\", operator_type, NULL, 0);\n        if (!Div_type) return 0;\n        Div_singleton = PyType_GenericNew(Div_type, NULL, NULL);\n        if (!Div_singleton) return 0;\n        Mod_type = make_type(\"Mod\", operator_type, NULL, 0);\n        if (!Mod_type) return 0;\n        Mod_singleton = PyType_GenericNew(Mod_type, NULL, NULL);\n        if (!Mod_singleton) return 0;\n        Pow_type = make_type(\"Pow\", operator_type, NULL, 0);\n        if (!Pow_type) return 0;\n        Pow_singleton = PyType_GenericNew(Pow_type, NULL, NULL);\n        if (!Pow_singleton) return 0;\n        LShift_type = make_type(\"LShift\", operator_type, NULL, 0);\n        if (!LShift_type) return 0;\n        LShift_singleton = PyType_GenericNew(LShift_type, NULL, NULL);\n        if (!LShift_singleton) return 0;\n        RShift_type = make_type(\"RShift\", operator_type, NULL, 0);\n        if (!RShift_type) return 0;\n        RShift_singleton = PyType_GenericNew(RShift_type, NULL, NULL);\n        if (!RShift_singleton) return 0;\n        BitOr_type = make_type(\"BitOr\", operator_type, NULL, 0);\n        if (!BitOr_type) return 0;\n        BitOr_singleton = PyType_GenericNew(BitOr_type, NULL, NULL);\n        if (!BitOr_singleton) return 0;\n        BitXor_type = make_type(\"BitXor\", operator_type, NULL, 0);\n        if (!BitXor_type) return 0;\n        BitXor_singleton = PyType_GenericNew(BitXor_type, NULL, NULL);\n        if (!BitXor_singleton) return 0;\n        BitAnd_type = make_type(\"BitAnd\", operator_type, NULL, 0);\n        if (!BitAnd_type) return 0;\n        BitAnd_singleton = PyType_GenericNew(BitAnd_type, NULL, NULL);\n        if (!BitAnd_singleton) return 0;\n        FloorDiv_type = make_type(\"FloorDiv\", operator_type, NULL, 0);\n        if (!FloorDiv_type) return 0;\n        FloorDiv_singleton = PyType_GenericNew(FloorDiv_type, NULL, NULL);\n        if (!FloorDiv_singleton) return 0;\n        unaryop_type = make_type(\"unaryop\", &AST_type, NULL, 0);\n        if (!unaryop_type) return 0;\n        if (!add_attributes(unaryop_type, NULL, 0)) return 0;\n        Invert_type = make_type(\"Invert\", unaryop_type, NULL, 0);\n        if (!Invert_type) return 0;\n        Invert_singleton = PyType_GenericNew(Invert_type, NULL, NULL);\n        if (!Invert_singleton) return 0;\n        Not_type = make_type(\"Not\", unaryop_type, NULL, 0);\n        if (!Not_type) return 0;\n        Not_singleton = PyType_GenericNew(Not_type, NULL, NULL);\n        if (!Not_singleton) return 0;\n        UAdd_type = make_type(\"UAdd\", unaryop_type, NULL, 0);\n        if (!UAdd_type) return 0;\n        UAdd_singleton = PyType_GenericNew(UAdd_type, NULL, NULL);\n        if (!UAdd_singleton) return 0;\n        USub_type = make_type(\"USub\", unaryop_type, NULL, 0);\n        if (!USub_type) return 0;\n        USub_singleton = PyType_GenericNew(USub_type, NULL, NULL);\n        if (!USub_singleton) return 0;\n        cmpop_type = make_type(\"cmpop\", &AST_type, NULL, 0);\n        if (!cmpop_type) return 0;\n        if (!add_attributes(cmpop_type, NULL, 0)) return 0;\n        Eq_type = make_type(\"Eq\", cmpop_type, NULL, 0);\n        if (!Eq_type) return 0;\n        Eq_singleton = PyType_GenericNew(Eq_type, NULL, NULL);\n        if (!Eq_singleton) return 0;\n        NotEq_type = make_type(\"NotEq\", cmpop_type, NULL, 0);\n        if (!NotEq_type) return 0;\n        NotEq_singleton = PyType_GenericNew(NotEq_type, NULL, NULL);\n        if (!NotEq_singleton) return 0;\n        Lt_type = make_type(\"Lt\", cmpop_type, NULL, 0);\n        if (!Lt_type) return 0;\n        Lt_singleton = PyType_GenericNew(Lt_type, NULL, NULL);\n        if (!Lt_singleton) return 0;\n        LtE_type = make_type(\"LtE\", cmpop_type, NULL, 0);\n        if (!LtE_type) return 0;\n        LtE_singleton = PyType_GenericNew(LtE_type, NULL, NULL);\n        if (!LtE_singleton) return 0;\n        Gt_type = make_type(\"Gt\", cmpop_type, NULL, 0);\n        if (!Gt_type) return 0;\n        Gt_singleton = PyType_GenericNew(Gt_type, NULL, NULL);\n        if (!Gt_singleton) return 0;\n        GtE_type = make_type(\"GtE\", cmpop_type, NULL, 0);\n        if (!GtE_type) return 0;\n        GtE_singleton = PyType_GenericNew(GtE_type, NULL, NULL);\n        if (!GtE_singleton) return 0;\n        Is_type = make_type(\"Is\", cmpop_type, NULL, 0);\n        if (!Is_type) return 0;\n        Is_singleton = PyType_GenericNew(Is_type, NULL, NULL);\n        if (!Is_singleton) return 0;\n        IsNot_type = make_type(\"IsNot\", cmpop_type, NULL, 0);\n        if (!IsNot_type) return 0;\n        IsNot_singleton = PyType_GenericNew(IsNot_type, NULL, NULL);\n        if (!IsNot_singleton) return 0;\n        In_type = make_type(\"In\", cmpop_type, NULL, 0);\n        if (!In_type) return 0;\n        In_singleton = PyType_GenericNew(In_type, NULL, NULL);\n        if (!In_singleton) return 0;\n        NotIn_type = make_type(\"NotIn\", cmpop_type, NULL, 0);\n        if (!NotIn_type) return 0;\n        NotIn_singleton = PyType_GenericNew(NotIn_type, NULL, NULL);\n        if (!NotIn_singleton) return 0;\n        comprehension_type = make_type(\"comprehension\", &AST_type, comprehension_fields, 3);\n        if (!comprehension_type) return 0;\n        excepthandler_type = make_type(\"excepthandler\", &AST_type, NULL, 0);\n        if (!excepthandler_type) return 0;\n        if (!add_attributes(excepthandler_type, excepthandler_attributes, 2)) return 0;\n        ExceptHandler_type = make_type(\"ExceptHandler\", excepthandler_type, ExceptHandler_fields,\n                                       3);\n        if (!ExceptHandler_type) return 0;\n        arguments_type = make_type(\"arguments\", &AST_type, arguments_fields, 5);\n        if (!arguments_type) return 0;\n        keyword_type = make_type(\"keyword\", &AST_type, keyword_fields, 2);\n        if (!keyword_type) return 0;\n        alias_type = make_type(\"alias\", &AST_type, alias_fields, 2);\n        if (!alias_type) return 0;\n        type_ignore_type = make_type(\"type_ignore\", &AST_type, NULL, 0);\n        if (!type_ignore_type) return 0;\n        if (!add_attributes(type_ignore_type, NULL, 0)) return 0;\n        TypeIgnore_type = make_type(\"TypeIgnore\", type_ignore_type, TypeIgnore_fields, 2);\n        if (!TypeIgnore_type) return 0;\n        initialized = 1;\n        return 1;\n}\n\nstatic int obj2ast_mod(PyObject* obj, mod_ty* out, PyArena* arena);\nstatic int obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena);\nstatic int obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena);\nstatic int obj2ast_expr_context(PyObject* obj, expr_context_ty* out, PyArena* arena);\nstatic int obj2ast_slice(PyObject* obj, slice_ty* out, PyArena* arena);\nstatic int obj2ast_boolop(PyObject* obj, boolop_ty* out, PyArena* arena);\nstatic int obj2ast_operator(PyObject* obj, operator_ty* out, PyArena* arena);\nstatic int obj2ast_unaryop(PyObject* obj, unaryop_ty* out, PyArena* arena);\nstatic int obj2ast_cmpop(PyObject* obj, cmpop_ty* out, PyArena* arena);\nstatic int obj2ast_comprehension(PyObject* obj, comprehension_ty* out, PyArena* arena);\nstatic int obj2ast_excepthandler(PyObject* obj, excepthandler_ty* out, PyArena* arena);\nstatic int obj2ast_arguments(PyObject* obj, arguments_ty* out, PyArena* arena);\nstatic int obj2ast_keyword(PyObject* obj, keyword_ty* out, PyArena* arena);\nstatic int obj2ast_alias(PyObject* obj, alias_ty* out, PyArena* arena);\nstatic int obj2ast_type_ignore(PyObject* obj, type_ignore_ty* out, PyArena* arena);\n\nmod_ty\nModule(asdl_seq * body, asdl_seq * type_ignores, PyArena *arena)\n{\n        mod_ty p;\n        p = (mod_ty)PyArena_Malloc(arena, sizeof(*p));\n        if (!p)\n                return NULL;\n        p->kind = Module_kind;\n        p->v.Module.body = body;\n        p->v.Module.type_ignores = type_ignores;\n        return p;\n}\n\nmod_ty\nInteractive(asdl_seq * body, PyArena *arena)\n{\n        mod_ty p;\n        p = (mod_ty)PyArena_Malloc(arena, sizeof(*p));\n        if (!p)\n                return NULL;\n        p->kind = Interactive_kind;\n        p->v.Interactive.body = body;\n        return p;\n}\n\nmod_ty\nExpression(expr_ty body, PyArena *arena)\n{\n        mod_ty p;\n        if (!body) {\n                PyErr_SetString(PyExc_ValueError,\n                                \"field body is required for Expression\");\n                return NULL;\n        }\n        p = (mod_ty)PyArena_Malloc(arena, sizeof(*p));\n        if (!p)\n                return NULL;\n        p->kind = Expression_kind;\n        p->v.Expression.body = body;\n        return p;\n}\n\nmod_ty\nFunctionType(asdl_seq * argtypes, expr_ty returns, PyArena *arena)\n{\n        mod_ty p;\n        if (!returns) {\n                PyErr_SetString(PyExc_ValueError,\n                                \"field returns is required for FunctionType\");\n                return NULL;\n        }\n        p = (mod_ty)PyArena_Malloc(arena, sizeof(*p));\n        if (!p)\n                return NULL;\n        p->kind = FunctionType_kind;\n        p->v.FunctionType.argtypes = argtypes;\n        p->v.FunctionType.returns = returns;\n        return p;\n}\n\nmod_ty\nSuite(asdl_seq * body, PyArena *arena)\n{\n        mod_ty p;\n        p = (mod_ty)PyArena_Malloc(arena, sizeof(*p));\n        if (!p)\n                return NULL;\n        p->kind = Suite_kind;\n        p->v.Suite.body = body;\n        return p;\n}\n\nstmt_ty\nFunctionDef(identifier name, arguments_ty args, asdl_seq * body, asdl_seq * decorator_list, string\n            type_comment, int lineno, int col_offset, PyArena *arena)\n{\n        stmt_ty p;\n        if (!name) {\n                PyErr_SetString(PyExc_ValueError,\n                                \"field name is required for FunctionDef\");\n                return NULL;\n        }\n        if (!args) {\n                PyErr_SetString(PyExc_ValueError,\n                                \"field args is required for FunctionDef\");\n                return NULL;\n        }\n        p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));\n        if (!p)\n                return NULL;\n        p->kind = FunctionDef_kind;\n        p->v.FunctionDef.name = name;\n        p->v.FunctionDef.args = args;\n        p->v.FunctionDef.body = body;\n        p->v.FunctionDef.decorator_list = decorator_list;\n        p->v.FunctionDef.type_comment = type_comment;\n        p->lineno = lineno;\n        p->col_offset = col_offset;\n        return p;\n}\n\nstmt_ty\nClassDef(identifier name, asdl_seq * bases, asdl_seq * body, asdl_seq * decorator_list, int lineno,\n         int col_offset, PyArena *arena)\n{\n        stmt_ty p;\n        if (!name) {\n                PyErr_SetString(PyExc_ValueError,\n                                \"field name is required for ClassDef\");\n                return NULL;\n        }\n        p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));\n        if (!p)\n                return NULL;\n        p->kind = ClassDef_kind;\n        p->v.ClassDef.name = name;\n        p->v.ClassDef.bases = bases;\n        p->v.ClassDef.body = body;\n        p->v.ClassDef.decorator_list = decorator_list;\n        p->lineno = lineno;\n        p->col_offset = col_offset;\n        return p;\n}\n\nstmt_ty\nReturn(expr_ty value, int lineno, int col_offset, PyArena *arena)\n{\n        stmt_ty p;\n        p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));\n        if (!p)\n                return NULL;\n        p->kind = Return_kind;\n        p->v.Return.value = value;\n        p->lineno = lineno;\n        p->col_offset = col_offset;\n        return p;\n}\n\nstmt_ty\nDelete(asdl_seq * targets, int lineno, int col_offset, PyArena *arena)\n{\n        stmt_ty p;\n        p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));\n        if (!p)\n                return NULL;\n        p->kind = Delete_kind;\n        p->v.Delete.targets = targets;\n        p->lineno = lineno;\n        p->col_offset = col_offset;\n        return p;\n}\n\nstmt_ty\nAssign(asdl_seq * targets, expr_ty value, string type_comment, int lineno, int col_offset, PyArena\n       *arena)\n{\n        stmt_ty p;\n        if (!value) {\n                PyErr_SetString(PyExc_ValueError,\n                                \"field value is required for Assign\");\n                return NULL;\n        }\n        p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));\n        if (!p)\n                return NULL;\n        p->kind = Assign_kind;\n        p->v.Assign.targets = targets;\n        p->v.Assign.value = value;\n        p->v.Assign.type_comment = type_comment;\n        p->lineno = lineno;\n        p->col_offset = col_offset;\n        return p;\n}\n\nstmt_ty\nAugAssign(expr_ty target, operator_ty op, expr_ty value, int lineno, int col_offset, PyArena *arena)\n{\n        stmt_ty p;\n        if (!target) {\n                PyErr_SetString(PyExc_ValueError,\n                                \"field target is required for AugAssign\");\n                return NULL;\n        }\n        if (!op) {\n                PyErr_SetString(PyExc_ValueError,\n                                \"field op is required for AugAssign\");\n                return NULL;\n        }\n        if (!value) {\n                PyErr_SetString(PyExc_ValueError,\n                                \"field value is required for AugAssign\");\n                return NULL;\n        }\n        p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));\n        if (!p)\n                return NULL;\n        p->kind = AugAssign_kind;\n        p->v.AugAssign.target = target;\n        p->v.AugAssign.op = op;\n        p->v.AugAssign.value = value;\n        p->lineno = lineno;\n        p->col_offset = col_offset;\n        return p;\n}\n\nstmt_ty\nPrint(expr_ty dest, asdl_seq * values, bool nl, int lineno, int col_offset, PyArena *arena)\n{\n        stmt_ty p;\n        p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));\n        if (!p)\n                return NULL;\n        p->kind = Print_kind;\n        p->v.Print.dest = dest;\n        p->v.Print.values = values;\n        p->v.Print.nl = nl;\n        p->lineno = lineno;\n        p->col_offset = col_offset;\n        return p;\n}\n\nstmt_ty\nFor(expr_ty target, expr_ty iter, asdl_seq * body, asdl_seq * orelse, string type_comment, int\n    lineno, int col_offset, PyArena *arena)\n{\n        stmt_ty p;\n        if (!target) {\n                PyErr_SetString(PyExc_ValueError,\n                                \"field target is required for For\");\n                return NULL;\n        }\n        if (!iter) {\n                PyErr_SetString(PyExc_ValueError,\n                                \"field iter is required for For\");\n                return NULL;\n        }\n        p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));\n        if (!p)\n                return NULL;\n        p->kind = For_kind;\n        p->v.For.target = target;\n        p->v.For.iter = iter;\n        p->v.For.body = body;\n        p->v.For.orelse = orelse;\n        p->v.For.type_comment = type_comment;\n        p->lineno = lineno;\n        p->col_offset = col_offset;\n        return p;\n}\n\nstmt_ty\nWhile(expr_ty test, asdl_seq * body, asdl_seq * orelse, int lineno, int col_offset, PyArena *arena)\n{\n        stmt_ty p;\n        if (!test) {\n                PyErr_SetString(PyExc_ValueError,\n                                \"field test is required for While\");\n                return NULL;\n        }\n        p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));\n        if (!p)\n                return NULL;\n        p->kind = While_kind;\n        p->v.While.test = test;\n        p->v.While.body = body;\n        p->v.While.orelse = orelse;\n        p->lineno = lineno;\n        p->col_offset = col_offset;\n        return p;\n}\n\nstmt_ty\nIf(expr_ty test, asdl_seq * body, asdl_seq * orelse, int lineno, int col_offset, PyArena *arena)\n{\n        stmt_ty p;\n        if (!test) {\n                PyErr_SetString(PyExc_ValueError,\n                                \"field test is required for If\");\n                return NULL;\n        }\n        p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));\n        if (!p)\n                return NULL;\n        p->kind = If_kind;\n        p->v.If.test = test;\n        p->v.If.body = body;\n        p->v.If.orelse = orelse;\n        p->lineno = lineno;\n        p->col_offset = col_offset;\n        return p;\n}\n\nstmt_ty\nWith(expr_ty context_expr, expr_ty optional_vars, asdl_seq * body, string type_comment, int lineno,\n     int col_offset, PyArena *arena)\n{\n        stmt_ty p;\n        if (!context_expr) {\n                PyErr_SetString(PyExc_ValueError,\n                                \"field context_expr is required for With\");\n                return NULL;\n        }\n        p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));\n        if (!p)\n                return NULL;\n        p->kind = With_kind;\n        p->v.With.context_expr = context_expr;\n        p->v.With.optional_vars = optional_vars;\n        p->v.With.body = body;\n        p->v.With.type_comment = type_comment;\n        p->lineno = lineno;\n        p->col_offset = col_offset;\n        return p;\n}\n\nstmt_ty\nRaise(expr_ty type, expr_ty inst, expr_ty tback, int lineno, int col_offset, PyArena *arena)\n{\n        stmt_ty p;\n        p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));\n        if (!p)\n                return NULL;\n        p->kind = Raise_kind;\n        p->v.Raise.type = type;\n        p->v.Raise.inst = inst;\n        p->v.Raise.tback = tback;\n        p->lineno = lineno;\n        p->col_offset = col_offset;\n        return p;\n}\n\nstmt_ty\nTryExcept(asdl_seq * body, asdl_seq * handlers, asdl_seq * orelse, int lineno, int col_offset,\n          PyArena *arena)\n{\n        stmt_ty p;\n        p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));\n        if (!p)\n                return NULL;\n        p->kind = TryExcept_kind;\n        p->v.TryExcept.body = body;\n        p->v.TryExcept.handlers = handlers;\n        p->v.TryExcept.orelse = orelse;\n        p->lineno = lineno;\n        p->col_offset = col_offset;\n        return p;\n}\n\nstmt_ty\nTryFinally(asdl_seq * body, asdl_seq * finalbody, int lineno, int col_offset, PyArena *arena)\n{\n        stmt_ty p;\n        p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));\n        if (!p)\n                return NULL;\n        p->kind = TryFinally_kind;\n        p->v.TryFinally.body = body;\n        p->v.TryFinally.finalbody = finalbody;\n        p->lineno = lineno;\n        p->col_offset = col_offset;\n        return p;\n}\n\nstmt_ty\nAssert(expr_ty test, expr_ty msg, int lineno, int col_offset, PyArena *arena)\n{\n        stmt_ty p;\n        if (!test) {\n                PyErr_SetString(PyExc_ValueError,\n                                \"field test is required for Assert\");\n                return NULL;\n        }\n        p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));\n        if (!p)\n                return NULL;\n        p->kind = Assert_kind;\n        p->v.Assert.test = test;\n        p->v.Assert.msg = msg;\n        p->lineno = lineno;\n        p->col_offset = col_offset;\n        return p;\n}\n\nstmt_ty\nImport(asdl_seq * names, int lineno, int col_offset, PyArena *arena)\n{\n        stmt_ty p;\n        p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));\n        if (!p)\n                return NULL;\n        p->kind = Import_kind;\n        p->v.Import.names = names;\n        p->lineno = lineno;\n        p->col_offset = col_offset;\n        return p;\n}\n\nstmt_ty\nImportFrom(identifier module, asdl_seq * names, int level, int lineno, int col_offset, PyArena\n           *arena)\n{\n        stmt_ty p;\n        p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));\n        if (!p)\n                return NULL;\n        p->kind = ImportFrom_kind;\n        p->v.ImportFrom.module = module;\n        p->v.ImportFrom.names = names;\n        p->v.ImportFrom.level = level;\n        p->lineno = lineno;\n        p->col_offset = col_offset;\n        return p;\n}\n\nstmt_ty\nExec(expr_ty body, expr_ty globals, expr_ty locals, int lineno, int col_offset, PyArena *arena)\n{\n        stmt_ty p;\n        if (!body) {\n                PyErr_SetString(PyExc_ValueError,\n                                \"field body is required for Exec\");\n                return NULL;\n        }\n        p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));\n        if (!p)\n                return NULL;\n        p->kind = Exec_kind;\n        p->v.Exec.body = body;\n        p->v.Exec.globals = globals;\n        p->v.Exec.locals = locals;\n        p->lineno = lineno;\n        p->col_offset = col_offset;\n        return p;\n}\n\nstmt_ty\nGlobal(asdl_seq * names, int lineno, int col_offset, PyArena *arena)\n{\n        stmt_ty p;\n        p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));\n        if (!p)\n                return NULL;\n        p->kind = Global_kind;\n        p->v.Global.names = names;\n        p->lineno = lineno;\n        p->col_offset = col_offset;\n        return p;\n}\n\nstmt_ty\nExpr(expr_ty value, int lineno, int col_offset, PyArena *arena)\n{\n        stmt_ty p;\n        if (!value) {\n                PyErr_SetString(PyExc_ValueError,\n                                \"field value is required for Expr\");\n                return NULL;\n        }\n        p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));\n        if (!p)\n                return NULL;\n        p->kind = Expr_kind;\n        p->v.Expr.value = value;\n        p->lineno = lineno;\n        p->col_offset = col_offset;\n        return p;\n}\n\nstmt_ty\nPass(int lineno, int col_offset, PyArena *arena)\n{\n        stmt_ty p;\n        p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));\n        if (!p)\n                return NULL;\n        p->kind = Pass_kind;\n        p->lineno = lineno;\n        p->col_offset = col_offset;\n        return p;\n}\n\nstmt_ty\nBreak(int lineno, int col_offset, PyArena *arena)\n{\n        stmt_ty p;\n        p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));\n        if (!p)\n                return NULL;\n        p->kind = Break_kind;\n        p->lineno = lineno;\n        p->col_offset = col_offset;\n        return p;\n}\n\nstmt_ty\nContinue(int lineno, int col_offset, PyArena *arena)\n{\n        stmt_ty p;\n        p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));\n        if (!p)\n                return NULL;\n        p->kind = Continue_kind;\n        p->lineno = lineno;\n        p->col_offset = col_offset;\n        return p;\n}\n\nexpr_ty\nBoolOp(boolop_ty op, asdl_seq * values, int lineno, int col_offset, PyArena *arena)\n{\n        expr_ty p;\n        if (!op) {\n                PyErr_SetString(PyExc_ValueError,\n                                \"field op is required for BoolOp\");\n                return NULL;\n        }\n        p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));\n        if (!p)\n                return NULL;\n        p->kind = BoolOp_kind;\n        p->v.BoolOp.op = op;\n        p->v.BoolOp.values = values;\n        p->lineno = lineno;\n        p->col_offset = col_offset;\n        return p;\n}\n\nexpr_ty\nBinOp(expr_ty left, operator_ty op, expr_ty right, int lineno, int col_offset, PyArena *arena)\n{\n        expr_ty p;\n        if (!left) {\n                PyErr_SetString(PyExc_ValueError,\n                                \"field left is required for BinOp\");\n                return NULL;\n        }\n        if (!op) {\n                PyErr_SetString(PyExc_ValueError,\n                                \"field op is required for BinOp\");\n                return NULL;\n        }\n        if (!right) {\n                PyErr_SetString(PyExc_ValueError,\n                                \"field right is required for BinOp\");\n                return NULL;\n        }\n        p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));\n        if (!p)\n                return NULL;\n        p->kind = BinOp_kind;\n        p->v.BinOp.left = left;\n        p->v.BinOp.op = op;\n        p->v.BinOp.right = right;\n        p->lineno = lineno;\n        p->col_offset = col_offset;\n        return p;\n}\n\nexpr_ty\nUnaryOp(unaryop_ty op, expr_ty operand, int lineno, int col_offset, PyArena *arena)\n{\n        expr_ty p;\n        if (!op) {\n                PyErr_SetString(PyExc_ValueError,\n                                \"field op is required for UnaryOp\");\n                return NULL;\n        }\n        if (!operand) {\n                PyErr_SetString(PyExc_ValueError,\n                                \"field operand is required for UnaryOp\");\n                return NULL;\n        }\n        p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));\n        if (!p)\n                return NULL;\n        p->kind = UnaryOp_kind;\n        p->v.UnaryOp.op = op;\n        p->v.UnaryOp.operand = operand;\n        p->lineno = lineno;\n        p->col_offset = col_offset;\n        return p;\n}\n\nexpr_ty\nLambda(arguments_ty args, expr_ty body, int lineno, int col_offset, PyArena *arena)\n{\n        expr_ty p;\n        if (!args) {\n                PyErr_SetString(PyExc_ValueError,\n                                \"field args is required for Lambda\");\n                return NULL;\n        }\n        if (!body) {\n                PyErr_SetString(PyExc_ValueError,\n                                \"field body is required for Lambda\");\n                return NULL;\n        }\n        p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));\n        if (!p)\n                return NULL;\n        p->kind = Lambda_kind;\n        p->v.Lambda.args = args;\n        p->v.Lambda.body = body;\n        p->lineno = lineno;\n        p->col_offset = col_offset;\n        return p;\n}\n\nexpr_ty\nIfExp(expr_ty test, expr_ty body, expr_ty orelse, int lineno, int col_offset, PyArena *arena)\n{\n        expr_ty p;\n        if (!test) {\n                PyErr_SetString(PyExc_ValueError,\n                                \"field test is required for IfExp\");\n                return NULL;\n        }\n        if (!body) {\n                PyErr_SetString(PyExc_ValueError,\n                                \"field body is required for IfExp\");\n                return NULL;\n        }\n        if (!orelse) {\n                PyErr_SetString(PyExc_ValueError,\n                                \"field orelse is required for IfExp\");\n                return NULL;\n        }\n        p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));\n        if (!p)\n                return NULL;\n        p->kind = IfExp_kind;\n        p->v.IfExp.test = test;\n        p->v.IfExp.body = body;\n        p->v.IfExp.orelse = orelse;\n        p->lineno = lineno;\n        p->col_offset = col_offset;\n        return p;\n}\n\nexpr_ty\nDict(asdl_seq * keys, asdl_seq * values, int lineno, int col_offset, PyArena *arena)\n{\n        expr_ty p;\n        p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));\n        if (!p)\n                return NULL;\n        p->kind = Dict_kind;\n        p->v.Dict.keys = keys;\n        p->v.Dict.values = values;\n        p->lineno = lineno;\n        p->col_offset = col_offset;\n        return p;\n}\n\nexpr_ty\nSet(asdl_seq * elts, int lineno, int col_offset, PyArena *arena)\n{\n        expr_ty p;\n        p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));\n        if (!p)\n                return NULL;\n        p->kind = Set_kind;\n        p->v.Set.elts = elts;\n        p->lineno = lineno;\n        p->col_offset = col_offset;\n        return p;\n}\n\nexpr_ty\nListComp(expr_ty elt, asdl_seq * generators, int lineno, int col_offset, PyArena *arena)\n{\n        expr_ty p;\n        if (!elt) {\n                PyErr_SetString(PyExc_ValueError,\n                                \"field elt is required for ListComp\");\n                return NULL;\n        }\n        p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));\n        if (!p)\n                return NULL;\n        p->kind = ListComp_kind;\n        p->v.ListComp.elt = elt;\n        p->v.ListComp.generators = generators;\n        p->lineno = lineno;\n        p->col_offset = col_offset;\n        return p;\n}\n\nexpr_ty\nSetComp(expr_ty elt, asdl_seq * generators, int lineno, int col_offset, PyArena *arena)\n{\n        expr_ty p;\n        if (!elt) {\n                PyErr_SetString(PyExc_ValueError,\n                                \"field elt is required for SetComp\");\n                return NULL;\n        }\n        p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));\n        if (!p)\n                return NULL;\n        p->kind = SetComp_kind;\n        p->v.SetComp.elt = elt;\n        p->v.SetComp.generators = generators;\n        p->lineno = lineno;\n        p->col_offset = col_offset;\n        return p;\n}\n\nexpr_ty\nDictComp(expr_ty key, expr_ty value, asdl_seq * generators, int lineno, int col_offset, PyArena\n         *arena)\n{\n        expr_ty p;\n        if (!key) {\n                PyErr_SetString(PyExc_ValueError,\n                                \"field key is required for DictComp\");\n                return NULL;\n        }\n        if (!value) {\n                PyErr_SetString(PyExc_ValueError,\n                                \"field value is required for DictComp\");\n                return NULL;\n        }\n        p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));\n        if (!p)\n                return NULL;\n        p->kind = DictComp_kind;\n        p->v.DictComp.key = key;\n        p->v.DictComp.value = value;\n        p->v.DictComp.generators = generators;\n        p->lineno = lineno;\n        p->col_offset = col_offset;\n        return p;\n}\n\nexpr_ty\nGeneratorExp(expr_ty elt, asdl_seq * generators, int lineno, int col_offset, PyArena *arena)\n{\n        expr_ty p;\n        if (!elt) {\n                PyErr_SetString(PyExc_ValueError,\n                                \"field elt is required for GeneratorExp\");\n                return NULL;\n        }\n        p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));\n        if (!p)\n                return NULL;\n        p->kind = GeneratorExp_kind;\n        p->v.GeneratorExp.elt = elt;\n        p->v.GeneratorExp.generators = generators;\n        p->lineno = lineno;\n        p->col_offset = col_offset;\n        return p;\n}\n\nexpr_ty\nYield(expr_ty value, int lineno, int col_offset, PyArena *arena)\n{\n        expr_ty p;\n        p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));\n        if (!p)\n                return NULL;\n        p->kind = Yield_kind;\n        p->v.Yield.value = value;\n        p->lineno = lineno;\n        p->col_offset = col_offset;\n        return p;\n}\n\nexpr_ty\nCompare(expr_ty left, asdl_int_seq * ops, asdl_seq * comparators, int lineno, int col_offset,\n        PyArena *arena)\n{\n        expr_ty p;\n        if (!left) {\n                PyErr_SetString(PyExc_ValueError,\n                                \"field left is required for Compare\");\n                return NULL;\n        }\n        p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));\n        if (!p)\n                return NULL;\n        p->kind = Compare_kind;\n        p->v.Compare.left = left;\n        p->v.Compare.ops = ops;\n        p->v.Compare.comparators = comparators;\n        p->lineno = lineno;\n        p->col_offset = col_offset;\n        return p;\n}\n\nexpr_ty\nCall(expr_ty func, asdl_seq * args, asdl_seq * keywords, expr_ty starargs, expr_ty kwargs, int\n     lineno, int col_offset, PyArena *arena)\n{\n        expr_ty p;\n        if (!func) {\n                PyErr_SetString(PyExc_ValueError,\n                                \"field func is required for Call\");\n                return NULL;\n        }\n        p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));\n        if (!p)\n                return NULL;\n        p->kind = Call_kind;\n        p->v.Call.func = func;\n        p->v.Call.args = args;\n        p->v.Call.keywords = keywords;\n        p->v.Call.starargs = starargs;\n        p->v.Call.kwargs = kwargs;\n        p->lineno = lineno;\n        p->col_offset = col_offset;\n        return p;\n}\n\nexpr_ty\nRepr(expr_ty value, int lineno, int col_offset, PyArena *arena)\n{\n        expr_ty p;\n        if (!value) {\n                PyErr_SetString(PyExc_ValueError,\n                                \"field value is required for Repr\");\n                return NULL;\n        }\n        p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));\n        if (!p)\n                return NULL;\n        p->kind = Repr_kind;\n        p->v.Repr.value = value;\n        p->lineno = lineno;\n        p->col_offset = col_offset;\n        return p;\n}\n\nexpr_ty\nNum(object n, int lineno, int col_offset, PyArena *arena)\n{\n        expr_ty p;\n        if (!n) {\n                PyErr_SetString(PyExc_ValueError,\n                                \"field n is required for Num\");\n                return NULL;\n        }\n        p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));\n        if (!p)\n                return NULL;\n        p->kind = Num_kind;\n        p->v.Num.n = n;\n        p->lineno = lineno;\n        p->col_offset = col_offset;\n        return p;\n}\n\nexpr_ty\nStr(string s, string kind, int lineno, int col_offset, PyArena *arena)\n{\n        expr_ty p;\n        if (!s) {\n                PyErr_SetString(PyExc_ValueError,\n                                \"field s is required for Str\");\n                return NULL;\n        }\n        if (!kind) {\n                PyErr_SetString(PyExc_ValueError,\n                                \"field kind is required for Str\");\n                return NULL;\n        }\n        p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));\n        if (!p)\n                return NULL;\n        p->kind = Str_kind;\n        p->v.Str.s = s;\n        p->v.Str.kind = kind;\n        p->lineno = lineno;\n        p->col_offset = col_offset;\n        return p;\n}\n\nexpr_ty\nAttribute(expr_ty value, identifier attr, expr_context_ty ctx, int lineno, int col_offset, PyArena\n          *arena)\n{\n        expr_ty p;\n        if (!value) {\n                PyErr_SetString(PyExc_ValueError,\n                                \"field value is required for Attribute\");\n                return NULL;\n        }\n        if (!attr) {\n                PyErr_SetString(PyExc_ValueError,\n                                \"field attr is required for Attribute\");\n                return NULL;\n        }\n        if (!ctx) {\n                PyErr_SetString(PyExc_ValueError,\n                                \"field ctx is required for Attribute\");\n                return NULL;\n        }\n        p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));\n        if (!p)\n                return NULL;\n        p->kind = Attribute_kind;\n        p->v.Attribute.value = value;\n        p->v.Attribute.attr = attr;\n        p->v.Attribute.ctx = ctx;\n        p->lineno = lineno;\n        p->col_offset = col_offset;\n        return p;\n}\n\nexpr_ty\nSubscript(expr_ty value, slice_ty slice, expr_context_ty ctx, int lineno, int col_offset, PyArena\n          *arena)\n{\n        expr_ty p;\n        if (!value) {\n                PyErr_SetString(PyExc_ValueError,\n                                \"field value is required for Subscript\");\n                return NULL;\n        }\n        if (!slice) {\n                PyErr_SetString(PyExc_ValueError,\n                                \"field slice is required for Subscript\");\n                return NULL;\n        }\n        if (!ctx) {\n                PyErr_SetString(PyExc_ValueError,\n                                \"field ctx is required for Subscript\");\n                return NULL;\n        }\n        p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));\n        if (!p)\n                return NULL;\n        p->kind = Subscript_kind;\n        p->v.Subscript.value = value;\n        p->v.Subscript.slice = slice;\n        p->v.Subscript.ctx = ctx;\n        p->lineno = lineno;\n        p->col_offset = col_offset;\n        return p;\n}\n\nexpr_ty\nName(identifier id, expr_context_ty ctx, int lineno, int col_offset, PyArena *arena)\n{\n        expr_ty p;\n        if (!id) {\n                PyErr_SetString(PyExc_ValueError,\n                                \"field id is required for Name\");\n                return NULL;\n        }\n        if (!ctx) {\n                PyErr_SetString(PyExc_ValueError,\n                                \"field ctx is required for Name\");\n                return NULL;\n        }\n        p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));\n        if (!p)\n                return NULL;\n        p->kind = Name_kind;\n        p->v.Name.id = id;\n        p->v.Name.ctx = ctx;\n        p->lineno = lineno;\n        p->col_offset = col_offset;\n        return p;\n}\n\nexpr_ty\nList(asdl_seq * elts, expr_context_ty ctx, int lineno, int col_offset, PyArena *arena)\n{\n        expr_ty p;\n        if (!ctx) {\n                PyErr_SetString(PyExc_ValueError,\n                                \"field ctx is required for List\");\n                return NULL;\n        }\n        p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));\n        if (!p)\n                return NULL;\n        p->kind = List_kind;\n        p->v.List.elts = elts;\n        p->v.List.ctx = ctx;\n        p->lineno = lineno;\n        p->col_offset = col_offset;\n        return p;\n}\n\nexpr_ty\nTuple(asdl_seq * elts, expr_context_ty ctx, int lineno, int col_offset, PyArena *arena)\n{\n        expr_ty p;\n        if (!ctx) {\n                PyErr_SetString(PyExc_ValueError,\n                                \"field ctx is required for Tuple\");\n                return NULL;\n        }\n        p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));\n        if (!p)\n                return NULL;\n        p->kind = Tuple_kind;\n        p->v.Tuple.elts = elts;\n        p->v.Tuple.ctx = ctx;\n        p->lineno = lineno;\n        p->col_offset = col_offset;\n        return p;\n}\n\nslice_ty\nEllipsis(PyArena *arena)\n{\n        slice_ty p;\n        p = (slice_ty)PyArena_Malloc(arena, sizeof(*p));\n        if (!p)\n                return NULL;\n        p->kind = Ellipsis_kind;\n        return p;\n}\n\nslice_ty\nSlice(expr_ty lower, expr_ty upper, expr_ty step, PyArena *arena)\n{\n        slice_ty p;\n        p = (slice_ty)PyArena_Malloc(arena, sizeof(*p));\n        if (!p)\n                return NULL;\n        p->kind = Slice_kind;\n        p->v.Slice.lower = lower;\n        p->v.Slice.upper = upper;\n        p->v.Slice.step = step;\n        return p;\n}\n\nslice_ty\nExtSlice(asdl_seq * dims, PyArena *arena)\n{\n        slice_ty p;\n        p = (slice_ty)PyArena_Malloc(arena, sizeof(*p));\n        if (!p)\n                return NULL;\n        p->kind = ExtSlice_kind;\n        p->v.ExtSlice.dims = dims;\n        return p;\n}\n\nslice_ty\nIndex(expr_ty value, PyArena *arena)\n{\n        slice_ty p;\n        if (!value) {\n                PyErr_SetString(PyExc_ValueError,\n                                \"field value is required for Index\");\n                return NULL;\n        }\n        p = (slice_ty)PyArena_Malloc(arena, sizeof(*p));\n        if (!p)\n                return NULL;\n        p->kind = Index_kind;\n        p->v.Index.value = value;\n        return p;\n}\n\ncomprehension_ty\ncomprehension(expr_ty target, expr_ty iter, asdl_seq * ifs, PyArena *arena)\n{\n        comprehension_ty p;\n        if (!target) {\n                PyErr_SetString(PyExc_ValueError,\n                                \"field target is required for comprehension\");\n                return NULL;\n        }\n        if (!iter) {\n                PyErr_SetString(PyExc_ValueError,\n                                \"field iter is required for comprehension\");\n                return NULL;\n        }\n        p = (comprehension_ty)PyArena_Malloc(arena, sizeof(*p));\n        if (!p)\n                return NULL;\n        p->target = target;\n        p->iter = iter;\n        p->ifs = ifs;\n        return p;\n}\n\nexcepthandler_ty\nExceptHandler(expr_ty type, expr_ty name, asdl_seq * body, int lineno, int col_offset, PyArena\n              *arena)\n{\n        excepthandler_ty p;\n        p = (excepthandler_ty)PyArena_Malloc(arena, sizeof(*p));\n        if (!p)\n                return NULL;\n        p->kind = ExceptHandler_kind;\n        p->v.ExceptHandler.type = type;\n        p->v.ExceptHandler.name = name;\n        p->v.ExceptHandler.body = body;\n        p->lineno = lineno;\n        p->col_offset = col_offset;\n        return p;\n}\n\narguments_ty\narguments(asdl_seq * args, identifier vararg, identifier kwarg, asdl_seq * defaults, asdl_seq *\n          type_comments, PyArena *arena)\n{\n        arguments_ty p;\n        p = (arguments_ty)PyArena_Malloc(arena, sizeof(*p));\n        if (!p)\n                return NULL;\n        p->args = args;\n        p->vararg = vararg;\n        p->kwarg = kwarg;\n        p->defaults = defaults;\n        p->type_comments = type_comments;\n        return p;\n}\n\nkeyword_ty\nkeyword(identifier arg, expr_ty value, PyArena *arena)\n{\n        keyword_ty p;\n        if (!arg) {\n                PyErr_SetString(PyExc_ValueError,\n                                \"field arg is required for keyword\");\n                return NULL;\n        }\n        if (!value) {\n                PyErr_SetString(PyExc_ValueError,\n                                \"field value is required for keyword\");\n                return NULL;\n        }\n        p = (keyword_ty)PyArena_Malloc(arena, sizeof(*p));\n        if (!p)\n                return NULL;\n        p->arg = arg;\n        p->value = value;\n        return p;\n}\n\nalias_ty\nalias(identifier name, identifier asname, PyArena *arena)\n{\n        alias_ty p;\n        if (!name) {\n                PyErr_SetString(PyExc_ValueError,\n                                \"field name is required for alias\");\n                return NULL;\n        }\n        p = (alias_ty)PyArena_Malloc(arena, sizeof(*p));\n        if (!p)\n                return NULL;\n        p->name = name;\n        p->asname = asname;\n        return p;\n}\n\ntype_ignore_ty\nTypeIgnore(int lineno, string tag, PyArena *arena)\n{\n        type_ignore_ty p;\n        if (!tag) {\n                PyErr_SetString(PyExc_ValueError,\n                                \"field tag is required for TypeIgnore\");\n                return NULL;\n        }\n        p = (type_ignore_ty)PyArena_Malloc(arena, sizeof(*p));\n        if (!p)\n                return NULL;\n        p->kind = TypeIgnore_kind;\n        p->v.TypeIgnore.lineno = lineno;\n        p->v.TypeIgnore.tag = tag;\n        return p;\n}\n\n\nPyObject*\nast2obj_mod(void* _o)\n{\n        mod_ty o = (mod_ty)_o;\n        PyObject *result = NULL, *value = NULL;\n        if (!o) {\n                Py_INCREF(Py_None);\n                return Py_None;\n        }\n\n        switch (o->kind) {\n        case Module_kind:\n                result = PyType_GenericNew(Module_type, NULL, NULL);\n                if (!result) goto failed;\n                value = ast2obj_list(o->v.Module.body, ast2obj_stmt);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"body\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                value = ast2obj_list(o->v.Module.type_ignores, ast2obj_type_ignore);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"type_ignores\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                break;\n        case Interactive_kind:\n                result = PyType_GenericNew(Interactive_type, NULL, NULL);\n                if (!result) goto failed;\n                value = ast2obj_list(o->v.Interactive.body, ast2obj_stmt);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"body\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                break;\n        case Expression_kind:\n                result = PyType_GenericNew(Expression_type, NULL, NULL);\n                if (!result) goto failed;\n                value = ast2obj_expr(o->v.Expression.body);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"body\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                break;\n        case FunctionType_kind:\n                result = PyType_GenericNew(FunctionType_type, NULL, NULL);\n                if (!result) goto failed;\n                value = ast2obj_list(o->v.FunctionType.argtypes, ast2obj_expr);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"argtypes\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                value = ast2obj_expr(o->v.FunctionType.returns);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"returns\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                break;\n        case Suite_kind:\n                result = PyType_GenericNew(Suite_type, NULL, NULL);\n                if (!result) goto failed;\n                value = ast2obj_list(o->v.Suite.body, ast2obj_stmt);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"body\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                break;\n        }\n        return result;\nfailed:\n        Py_XDECREF(value);\n        Py_XDECREF(result);\n        return NULL;\n}\n\nPyObject*\nast2obj_stmt(void* _o)\n{\n        stmt_ty o = (stmt_ty)_o;\n        PyObject *result = NULL, *value = NULL;\n        if (!o) {\n                Py_INCREF(Py_None);\n                return Py_None;\n        }\n\n        switch (o->kind) {\n        case FunctionDef_kind:\n                result = PyType_GenericNew(FunctionDef_type, NULL, NULL);\n                if (!result) goto failed;\n                value = ast2obj_identifier(o->v.FunctionDef.name);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"name\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                value = ast2obj_arguments(o->v.FunctionDef.args);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"args\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                value = ast2obj_list(o->v.FunctionDef.body, ast2obj_stmt);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"body\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                value = ast2obj_list(o->v.FunctionDef.decorator_list, ast2obj_expr);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"decorator_list\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                value = ast2obj_string(o->v.FunctionDef.type_comment);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"type_comment\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                break;\n        case ClassDef_kind:\n                result = PyType_GenericNew(ClassDef_type, NULL, NULL);\n                if (!result) goto failed;\n                value = ast2obj_identifier(o->v.ClassDef.name);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"name\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                value = ast2obj_list(o->v.ClassDef.bases, ast2obj_expr);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"bases\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                value = ast2obj_list(o->v.ClassDef.body, ast2obj_stmt);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"body\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                value = ast2obj_list(o->v.ClassDef.decorator_list, ast2obj_expr);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"decorator_list\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                break;\n        case Return_kind:\n                result = PyType_GenericNew(Return_type, NULL, NULL);\n                if (!result) goto failed;\n                value = ast2obj_expr(o->v.Return.value);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"value\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                break;\n        case Delete_kind:\n                result = PyType_GenericNew(Delete_type, NULL, NULL);\n                if (!result) goto failed;\n                value = ast2obj_list(o->v.Delete.targets, ast2obj_expr);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"targets\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                break;\n        case Assign_kind:\n                result = PyType_GenericNew(Assign_type, NULL, NULL);\n                if (!result) goto failed;\n                value = ast2obj_list(o->v.Assign.targets, ast2obj_expr);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"targets\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                value = ast2obj_expr(o->v.Assign.value);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"value\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                value = ast2obj_string(o->v.Assign.type_comment);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"type_comment\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                break;\n        case AugAssign_kind:\n                result = PyType_GenericNew(AugAssign_type, NULL, NULL);\n                if (!result) goto failed;\n                value = ast2obj_expr(o->v.AugAssign.target);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"target\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                value = ast2obj_operator(o->v.AugAssign.op);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"op\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                value = ast2obj_expr(o->v.AugAssign.value);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"value\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                break;\n        case Print_kind:\n                result = PyType_GenericNew(Print_type, NULL, NULL);\n                if (!result) goto failed;\n                value = ast2obj_expr(o->v.Print.dest);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"dest\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                value = ast2obj_list(o->v.Print.values, ast2obj_expr);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"values\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                value = ast2obj_bool(o->v.Print.nl);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"nl\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                break;\n        case For_kind:\n                result = PyType_GenericNew(For_type, NULL, NULL);\n                if (!result) goto failed;\n                value = ast2obj_expr(o->v.For.target);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"target\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                value = ast2obj_expr(o->v.For.iter);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"iter\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                value = ast2obj_list(o->v.For.body, ast2obj_stmt);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"body\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                value = ast2obj_list(o->v.For.orelse, ast2obj_stmt);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"orelse\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                value = ast2obj_string(o->v.For.type_comment);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"type_comment\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                break;\n        case While_kind:\n                result = PyType_GenericNew(While_type, NULL, NULL);\n                if (!result) goto failed;\n                value = ast2obj_expr(o->v.While.test);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"test\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                value = ast2obj_list(o->v.While.body, ast2obj_stmt);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"body\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                value = ast2obj_list(o->v.While.orelse, ast2obj_stmt);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"orelse\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                break;\n        case If_kind:\n                result = PyType_GenericNew(If_type, NULL, NULL);\n                if (!result) goto failed;\n                value = ast2obj_expr(o->v.If.test);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"test\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                value = ast2obj_list(o->v.If.body, ast2obj_stmt);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"body\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                value = ast2obj_list(o->v.If.orelse, ast2obj_stmt);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"orelse\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                break;\n        case With_kind:\n                result = PyType_GenericNew(With_type, NULL, NULL);\n                if (!result) goto failed;\n                value = ast2obj_expr(o->v.With.context_expr);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"context_expr\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                value = ast2obj_expr(o->v.With.optional_vars);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"optional_vars\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                value = ast2obj_list(o->v.With.body, ast2obj_stmt);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"body\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                value = ast2obj_string(o->v.With.type_comment);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"type_comment\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                break;\n        case Raise_kind:\n                result = PyType_GenericNew(Raise_type, NULL, NULL);\n                if (!result) goto failed;\n                value = ast2obj_expr(o->v.Raise.type);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"type\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                value = ast2obj_expr(o->v.Raise.inst);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"inst\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                value = ast2obj_expr(o->v.Raise.tback);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"tback\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                break;\n        case TryExcept_kind:\n                result = PyType_GenericNew(TryExcept_type, NULL, NULL);\n                if (!result) goto failed;\n                value = ast2obj_list(o->v.TryExcept.body, ast2obj_stmt);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"body\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                value = ast2obj_list(o->v.TryExcept.handlers, ast2obj_excepthandler);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"handlers\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                value = ast2obj_list(o->v.TryExcept.orelse, ast2obj_stmt);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"orelse\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                break;\n        case TryFinally_kind:\n                result = PyType_GenericNew(TryFinally_type, NULL, NULL);\n                if (!result) goto failed;\n                value = ast2obj_list(o->v.TryFinally.body, ast2obj_stmt);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"body\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                value = ast2obj_list(o->v.TryFinally.finalbody, ast2obj_stmt);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"finalbody\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                break;\n        case Assert_kind:\n                result = PyType_GenericNew(Assert_type, NULL, NULL);\n                if (!result) goto failed;\n                value = ast2obj_expr(o->v.Assert.test);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"test\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                value = ast2obj_expr(o->v.Assert.msg);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"msg\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                break;\n        case Import_kind:\n                result = PyType_GenericNew(Import_type, NULL, NULL);\n                if (!result) goto failed;\n                value = ast2obj_list(o->v.Import.names, ast2obj_alias);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"names\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                break;\n        case ImportFrom_kind:\n                result = PyType_GenericNew(ImportFrom_type, NULL, NULL);\n                if (!result) goto failed;\n                value = ast2obj_identifier(o->v.ImportFrom.module);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"module\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                value = ast2obj_list(o->v.ImportFrom.names, ast2obj_alias);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"names\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                value = ast2obj_int(o->v.ImportFrom.level);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"level\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                break;\n        case Exec_kind:\n                result = PyType_GenericNew(Exec_type, NULL, NULL);\n                if (!result) goto failed;\n                value = ast2obj_expr(o->v.Exec.body);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"body\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                value = ast2obj_expr(o->v.Exec.globals);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"globals\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                value = ast2obj_expr(o->v.Exec.locals);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"locals\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                break;\n        case Global_kind:\n                result = PyType_GenericNew(Global_type, NULL, NULL);\n                if (!result) goto failed;\n                value = ast2obj_list(o->v.Global.names, ast2obj_identifier);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"names\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                break;\n        case Expr_kind:\n                result = PyType_GenericNew(Expr_type, NULL, NULL);\n                if (!result) goto failed;\n                value = ast2obj_expr(o->v.Expr.value);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"value\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                break;\n        case Pass_kind:\n                result = PyType_GenericNew(Pass_type, NULL, NULL);\n                if (!result) goto failed;\n                break;\n        case Break_kind:\n                result = PyType_GenericNew(Break_type, NULL, NULL);\n                if (!result) goto failed;\n                break;\n        case Continue_kind:\n                result = PyType_GenericNew(Continue_type, NULL, NULL);\n                if (!result) goto failed;\n                break;\n        }\n        value = ast2obj_int(o->lineno);\n        if (!value) goto failed;\n        if (PyObject_SetAttrString(result, \"lineno\", value) < 0)\n                goto failed;\n        Py_DECREF(value);\n        value = ast2obj_int(o->col_offset);\n        if (!value) goto failed;\n        if (PyObject_SetAttrString(result, \"col_offset\", value) < 0)\n                goto failed;\n        Py_DECREF(value);\n        return result;\nfailed:\n        Py_XDECREF(value);\n        Py_XDECREF(result);\n        return NULL;\n}\n\nPyObject*\nast2obj_expr(void* _o)\n{\n        expr_ty o = (expr_ty)_o;\n        PyObject *result = NULL, *value = NULL;\n        if (!o) {\n                Py_INCREF(Py_None);\n                return Py_None;\n        }\n\n        switch (o->kind) {\n        case BoolOp_kind:\n                result = PyType_GenericNew(BoolOp_type, NULL, NULL);\n                if (!result) goto failed;\n                value = ast2obj_boolop(o->v.BoolOp.op);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"op\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                value = ast2obj_list(o->v.BoolOp.values, ast2obj_expr);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"values\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                break;\n        case BinOp_kind:\n                result = PyType_GenericNew(BinOp_type, NULL, NULL);\n                if (!result) goto failed;\n                value = ast2obj_expr(o->v.BinOp.left);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"left\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                value = ast2obj_operator(o->v.BinOp.op);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"op\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                value = ast2obj_expr(o->v.BinOp.right);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"right\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                break;\n        case UnaryOp_kind:\n                result = PyType_GenericNew(UnaryOp_type, NULL, NULL);\n                if (!result) goto failed;\n                value = ast2obj_unaryop(o->v.UnaryOp.op);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"op\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                value = ast2obj_expr(o->v.UnaryOp.operand);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"operand\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                break;\n        case Lambda_kind:\n                result = PyType_GenericNew(Lambda_type, NULL, NULL);\n                if (!result) goto failed;\n                value = ast2obj_arguments(o->v.Lambda.args);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"args\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                value = ast2obj_expr(o->v.Lambda.body);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"body\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                break;\n        case IfExp_kind:\n                result = PyType_GenericNew(IfExp_type, NULL, NULL);\n                if (!result) goto failed;\n                value = ast2obj_expr(o->v.IfExp.test);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"test\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                value = ast2obj_expr(o->v.IfExp.body);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"body\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                value = ast2obj_expr(o->v.IfExp.orelse);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"orelse\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                break;\n        case Dict_kind:\n                result = PyType_GenericNew(Dict_type, NULL, NULL);\n                if (!result) goto failed;\n                value = ast2obj_list(o->v.Dict.keys, ast2obj_expr);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"keys\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                value = ast2obj_list(o->v.Dict.values, ast2obj_expr);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"values\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                break;\n        case Set_kind:\n                result = PyType_GenericNew(Set_type, NULL, NULL);\n                if (!result) goto failed;\n                value = ast2obj_list(o->v.Set.elts, ast2obj_expr);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"elts\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                break;\n        case ListComp_kind:\n                result = PyType_GenericNew(ListComp_type, NULL, NULL);\n                if (!result) goto failed;\n                value = ast2obj_expr(o->v.ListComp.elt);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"elt\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                value = ast2obj_list(o->v.ListComp.generators, ast2obj_comprehension);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"generators\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                break;\n        case SetComp_kind:\n                result = PyType_GenericNew(SetComp_type, NULL, NULL);\n                if (!result) goto failed;\n                value = ast2obj_expr(o->v.SetComp.elt);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"elt\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                value = ast2obj_list(o->v.SetComp.generators, ast2obj_comprehension);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"generators\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                break;\n        case DictComp_kind:\n                result = PyType_GenericNew(DictComp_type, NULL, NULL);\n                if (!result) goto failed;\n                value = ast2obj_expr(o->v.DictComp.key);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"key\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                value = ast2obj_expr(o->v.DictComp.value);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"value\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                value = ast2obj_list(o->v.DictComp.generators, ast2obj_comprehension);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"generators\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                break;\n        case GeneratorExp_kind:\n                result = PyType_GenericNew(GeneratorExp_type, NULL, NULL);\n                if (!result) goto failed;\n                value = ast2obj_expr(o->v.GeneratorExp.elt);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"elt\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                value = ast2obj_list(o->v.GeneratorExp.generators, ast2obj_comprehension);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"generators\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                break;\n        case Yield_kind:\n                result = PyType_GenericNew(Yield_type, NULL, NULL);\n                if (!result) goto failed;\n                value = ast2obj_expr(o->v.Yield.value);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"value\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                break;\n        case Compare_kind:\n                result = PyType_GenericNew(Compare_type, NULL, NULL);\n                if (!result) goto failed;\n                value = ast2obj_expr(o->v.Compare.left);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"left\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                {\n                        int i, n = asdl_seq_LEN(o->v.Compare.ops);\n                        value = PyList_New(n);\n                        if (!value) goto failed;\n                        for(i = 0; i < n; i++)\n                                PyList_SET_ITEM(value, i, ast2obj_cmpop((cmpop_ty)asdl_seq_GET(o->v.Compare.ops, i)));\n                }\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"ops\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                value = ast2obj_list(o->v.Compare.comparators, ast2obj_expr);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"comparators\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                break;\n        case Call_kind:\n                result = PyType_GenericNew(Call_type, NULL, NULL);\n                if (!result) goto failed;\n                value = ast2obj_expr(o->v.Call.func);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"func\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                value = ast2obj_list(o->v.Call.args, ast2obj_expr);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"args\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                value = ast2obj_list(o->v.Call.keywords, ast2obj_keyword);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"keywords\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                value = ast2obj_expr(o->v.Call.starargs);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"starargs\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                value = ast2obj_expr(o->v.Call.kwargs);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"kwargs\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                break;\n        case Repr_kind:\n                result = PyType_GenericNew(Repr_type, NULL, NULL);\n                if (!result) goto failed;\n                value = ast2obj_expr(o->v.Repr.value);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"value\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                break;\n        case Num_kind:\n                result = PyType_GenericNew(Num_type, NULL, NULL);\n                if (!result) goto failed;\n                value = ast2obj_object(o->v.Num.n);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"n\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                break;\n        case Str_kind:\n                result = PyType_GenericNew(Str_type, NULL, NULL);\n                if (!result) goto failed;\n                value = ast2obj_string(o->v.Str.s);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"s\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                value = ast2obj_string(o->v.Str.kind);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"kind\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                break;\n        case Attribute_kind:\n                result = PyType_GenericNew(Attribute_type, NULL, NULL);\n                if (!result) goto failed;\n                value = ast2obj_expr(o->v.Attribute.value);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"value\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                value = ast2obj_identifier(o->v.Attribute.attr);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"attr\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                value = ast2obj_expr_context(o->v.Attribute.ctx);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"ctx\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                break;\n        case Subscript_kind:\n                result = PyType_GenericNew(Subscript_type, NULL, NULL);\n                if (!result) goto failed;\n                value = ast2obj_expr(o->v.Subscript.value);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"value\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                value = ast2obj_slice(o->v.Subscript.slice);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"slice\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                value = ast2obj_expr_context(o->v.Subscript.ctx);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"ctx\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                break;\n        case Name_kind:\n                result = PyType_GenericNew(Name_type, NULL, NULL);\n                if (!result) goto failed;\n                value = ast2obj_identifier(o->v.Name.id);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"id\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                value = ast2obj_expr_context(o->v.Name.ctx);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"ctx\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                break;\n        case List_kind:\n                result = PyType_GenericNew(List_type, NULL, NULL);\n                if (!result) goto failed;\n                value = ast2obj_list(o->v.List.elts, ast2obj_expr);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"elts\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                value = ast2obj_expr_context(o->v.List.ctx);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"ctx\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                break;\n        case Tuple_kind:\n                result = PyType_GenericNew(Tuple_type, NULL, NULL);\n                if (!result) goto failed;\n                value = ast2obj_list(o->v.Tuple.elts, ast2obj_expr);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"elts\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                value = ast2obj_expr_context(o->v.Tuple.ctx);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"ctx\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                break;\n        }\n        value = ast2obj_int(o->lineno);\n        if (!value) goto failed;\n        if (PyObject_SetAttrString(result, \"lineno\", value) < 0)\n                goto failed;\n        Py_DECREF(value);\n        value = ast2obj_int(o->col_offset);\n        if (!value) goto failed;\n        if (PyObject_SetAttrString(result, \"col_offset\", value) < 0)\n                goto failed;\n        Py_DECREF(value);\n        return result;\nfailed:\n        Py_XDECREF(value);\n        Py_XDECREF(result);\n        return NULL;\n}\n\nPyObject* ast2obj_expr_context(expr_context_ty o)\n{\n        switch(o) {\n                case Load:\n                        Py_INCREF(Load_singleton);\n                        return Load_singleton;\n                case Store:\n                        Py_INCREF(Store_singleton);\n                        return Store_singleton;\n                case Del:\n                        Py_INCREF(Del_singleton);\n                        return Del_singleton;\n                case AugLoad:\n                        Py_INCREF(AugLoad_singleton);\n                        return AugLoad_singleton;\n                case AugStore:\n                        Py_INCREF(AugStore_singleton);\n                        return AugStore_singleton;\n                case Param:\n                        Py_INCREF(Param_singleton);\n                        return Param_singleton;\n                default:\n                        /* should never happen, but just in case ... */\n                        PyErr_Format(PyExc_SystemError, \"unknown expr_context found\");\n                        return NULL;\n        }\n}\nPyObject*\nast2obj_slice(void* _o)\n{\n        slice_ty o = (slice_ty)_o;\n        PyObject *result = NULL, *value = NULL;\n        if (!o) {\n                Py_INCREF(Py_None);\n                return Py_None;\n        }\n\n        switch (o->kind) {\n        case Ellipsis_kind:\n                result = PyType_GenericNew(Ellipsis_type, NULL, NULL);\n                if (!result) goto failed;\n                break;\n        case Slice_kind:\n                result = PyType_GenericNew(Slice_type, NULL, NULL);\n                if (!result) goto failed;\n                value = ast2obj_expr(o->v.Slice.lower);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"lower\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                value = ast2obj_expr(o->v.Slice.upper);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"upper\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                value = ast2obj_expr(o->v.Slice.step);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"step\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                break;\n        case ExtSlice_kind:\n                result = PyType_GenericNew(ExtSlice_type, NULL, NULL);\n                if (!result) goto failed;\n                value = ast2obj_list(o->v.ExtSlice.dims, ast2obj_slice);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"dims\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                break;\n        case Index_kind:\n                result = PyType_GenericNew(Index_type, NULL, NULL);\n                if (!result) goto failed;\n                value = ast2obj_expr(o->v.Index.value);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"value\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                break;\n        }\n        return result;\nfailed:\n        Py_XDECREF(value);\n        Py_XDECREF(result);\n        return NULL;\n}\n\nPyObject* ast2obj_boolop(boolop_ty o)\n{\n        switch(o) {\n                case And:\n                        Py_INCREF(And_singleton);\n                        return And_singleton;\n                case Or:\n                        Py_INCREF(Or_singleton);\n                        return Or_singleton;\n                default:\n                        /* should never happen, but just in case ... */\n                        PyErr_Format(PyExc_SystemError, \"unknown boolop found\");\n                        return NULL;\n        }\n}\nPyObject* ast2obj_operator(operator_ty o)\n{\n        switch(o) {\n                case Add:\n                        Py_INCREF(Add_singleton);\n                        return Add_singleton;\n                case Sub:\n                        Py_INCREF(Sub_singleton);\n                        return Sub_singleton;\n                case Mult:\n                        Py_INCREF(Mult_singleton);\n                        return Mult_singleton;\n                case Div:\n                        Py_INCREF(Div_singleton);\n                        return Div_singleton;\n                case Mod:\n                        Py_INCREF(Mod_singleton);\n                        return Mod_singleton;\n                case Pow:\n                        Py_INCREF(Pow_singleton);\n                        return Pow_singleton;\n                case LShift:\n                        Py_INCREF(LShift_singleton);\n                        return LShift_singleton;\n                case RShift:\n                        Py_INCREF(RShift_singleton);\n                        return RShift_singleton;\n                case BitOr:\n                        Py_INCREF(BitOr_singleton);\n                        return BitOr_singleton;\n                case BitXor:\n                        Py_INCREF(BitXor_singleton);\n                        return BitXor_singleton;\n                case BitAnd:\n                        Py_INCREF(BitAnd_singleton);\n                        return BitAnd_singleton;\n                case FloorDiv:\n                        Py_INCREF(FloorDiv_singleton);\n                        return FloorDiv_singleton;\n                default:\n                        /* should never happen, but just in case ... */\n                        PyErr_Format(PyExc_SystemError, \"unknown operator found\");\n                        return NULL;\n        }\n}\nPyObject* ast2obj_unaryop(unaryop_ty o)\n{\n        switch(o) {\n                case Invert:\n                        Py_INCREF(Invert_singleton);\n                        return Invert_singleton;\n                case Not:\n                        Py_INCREF(Not_singleton);\n                        return Not_singleton;\n                case UAdd:\n                        Py_INCREF(UAdd_singleton);\n                        return UAdd_singleton;\n                case USub:\n                        Py_INCREF(USub_singleton);\n                        return USub_singleton;\n                default:\n                        /* should never happen, but just in case ... */\n                        PyErr_Format(PyExc_SystemError, \"unknown unaryop found\");\n                        return NULL;\n        }\n}\nPyObject* ast2obj_cmpop(cmpop_ty o)\n{\n        switch(o) {\n                case Eq:\n                        Py_INCREF(Eq_singleton);\n                        return Eq_singleton;\n                case NotEq:\n                        Py_INCREF(NotEq_singleton);\n                        return NotEq_singleton;\n                case Lt:\n                        Py_INCREF(Lt_singleton);\n                        return Lt_singleton;\n                case LtE:\n                        Py_INCREF(LtE_singleton);\n                        return LtE_singleton;\n                case Gt:\n                        Py_INCREF(Gt_singleton);\n                        return Gt_singleton;\n                case GtE:\n                        Py_INCREF(GtE_singleton);\n                        return GtE_singleton;\n                case Is:\n                        Py_INCREF(Is_singleton);\n                        return Is_singleton;\n                case IsNot:\n                        Py_INCREF(IsNot_singleton);\n                        return IsNot_singleton;\n                case In:\n                        Py_INCREF(In_singleton);\n                        return In_singleton;\n                case NotIn:\n                        Py_INCREF(NotIn_singleton);\n                        return NotIn_singleton;\n                default:\n                        /* should never happen, but just in case ... */\n                        PyErr_Format(PyExc_SystemError, \"unknown cmpop found\");\n                        return NULL;\n        }\n}\nPyObject*\nast2obj_comprehension(void* _o)\n{\n        comprehension_ty o = (comprehension_ty)_o;\n        PyObject *result = NULL, *value = NULL;\n        if (!o) {\n                Py_INCREF(Py_None);\n                return Py_None;\n        }\n\n        result = PyType_GenericNew(comprehension_type, NULL, NULL);\n        if (!result) return NULL;\n        value = ast2obj_expr(o->target);\n        if (!value) goto failed;\n        if (PyObject_SetAttrString(result, \"target\", value) == -1)\n                goto failed;\n        Py_DECREF(value);\n        value = ast2obj_expr(o->iter);\n        if (!value) goto failed;\n        if (PyObject_SetAttrString(result, \"iter\", value) == -1)\n                goto failed;\n        Py_DECREF(value);\n        value = ast2obj_list(o->ifs, ast2obj_expr);\n        if (!value) goto failed;\n        if (PyObject_SetAttrString(result, \"ifs\", value) == -1)\n                goto failed;\n        Py_DECREF(value);\n        return result;\nfailed:\n        Py_XDECREF(value);\n        Py_XDECREF(result);\n        return NULL;\n}\n\nPyObject*\nast2obj_excepthandler(void* _o)\n{\n        excepthandler_ty o = (excepthandler_ty)_o;\n        PyObject *result = NULL, *value = NULL;\n        if (!o) {\n                Py_INCREF(Py_None);\n                return Py_None;\n        }\n\n        switch (o->kind) {\n        case ExceptHandler_kind:\n                result = PyType_GenericNew(ExceptHandler_type, NULL, NULL);\n                if (!result) goto failed;\n                value = ast2obj_expr(o->v.ExceptHandler.type);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"type\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                value = ast2obj_expr(o->v.ExceptHandler.name);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"name\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                value = ast2obj_list(o->v.ExceptHandler.body, ast2obj_stmt);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"body\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                break;\n        }\n        value = ast2obj_int(o->lineno);\n        if (!value) goto failed;\n        if (PyObject_SetAttrString(result, \"lineno\", value) < 0)\n                goto failed;\n        Py_DECREF(value);\n        value = ast2obj_int(o->col_offset);\n        if (!value) goto failed;\n        if (PyObject_SetAttrString(result, \"col_offset\", value) < 0)\n                goto failed;\n        Py_DECREF(value);\n        return result;\nfailed:\n        Py_XDECREF(value);\n        Py_XDECREF(result);\n        return NULL;\n}\n\nPyObject*\nast2obj_arguments(void* _o)\n{\n        arguments_ty o = (arguments_ty)_o;\n        PyObject *result = NULL, *value = NULL;\n        if (!o) {\n                Py_INCREF(Py_None);\n                return Py_None;\n        }\n\n        result = PyType_GenericNew(arguments_type, NULL, NULL);\n        if (!result) return NULL;\n        value = ast2obj_list(o->args, ast2obj_expr);\n        if (!value) goto failed;\n        if (PyObject_SetAttrString(result, \"args\", value) == -1)\n                goto failed;\n        Py_DECREF(value);\n        value = ast2obj_identifier(o->vararg);\n        if (!value) goto failed;\n        if (PyObject_SetAttrString(result, \"vararg\", value) == -1)\n                goto failed;\n        Py_DECREF(value);\n        value = ast2obj_identifier(o->kwarg);\n        if (!value) goto failed;\n        if (PyObject_SetAttrString(result, \"kwarg\", value) == -1)\n                goto failed;\n        Py_DECREF(value);\n        value = ast2obj_list(o->defaults, ast2obj_expr);\n        if (!value) goto failed;\n        if (PyObject_SetAttrString(result, \"defaults\", value) == -1)\n                goto failed;\n        Py_DECREF(value);\n        value = ast2obj_list(o->type_comments, ast2obj_string);\n        if (!value) goto failed;\n        if (PyObject_SetAttrString(result, \"type_comments\", value) == -1)\n                goto failed;\n        Py_DECREF(value);\n        return result;\nfailed:\n        Py_XDECREF(value);\n        Py_XDECREF(result);\n        return NULL;\n}\n\nPyObject*\nast2obj_keyword(void* _o)\n{\n        keyword_ty o = (keyword_ty)_o;\n        PyObject *result = NULL, *value = NULL;\n        if (!o) {\n                Py_INCREF(Py_None);\n                return Py_None;\n        }\n\n        result = PyType_GenericNew(keyword_type, NULL, NULL);\n        if (!result) return NULL;\n        value = ast2obj_identifier(o->arg);\n        if (!value) goto failed;\n        if (PyObject_SetAttrString(result, \"arg\", value) == -1)\n                goto failed;\n        Py_DECREF(value);\n        value = ast2obj_expr(o->value);\n        if (!value) goto failed;\n        if (PyObject_SetAttrString(result, \"value\", value) == -1)\n                goto failed;\n        Py_DECREF(value);\n        return result;\nfailed:\n        Py_XDECREF(value);\n        Py_XDECREF(result);\n        return NULL;\n}\n\nPyObject*\nast2obj_alias(void* _o)\n{\n        alias_ty o = (alias_ty)_o;\n        PyObject *result = NULL, *value = NULL;\n        if (!o) {\n                Py_INCREF(Py_None);\n                return Py_None;\n        }\n\n        result = PyType_GenericNew(alias_type, NULL, NULL);\n        if (!result) return NULL;\n        value = ast2obj_identifier(o->name);\n        if (!value) goto failed;\n        if (PyObject_SetAttrString(result, \"name\", value) == -1)\n                goto failed;\n        Py_DECREF(value);\n        value = ast2obj_identifier(o->asname);\n        if (!value) goto failed;\n        if (PyObject_SetAttrString(result, \"asname\", value) == -1)\n                goto failed;\n        Py_DECREF(value);\n        return result;\nfailed:\n        Py_XDECREF(value);\n        Py_XDECREF(result);\n        return NULL;\n}\n\nPyObject*\nast2obj_type_ignore(void* _o)\n{\n        type_ignore_ty o = (type_ignore_ty)_o;\n        PyObject *result = NULL, *value = NULL;\n        if (!o) {\n                Py_INCREF(Py_None);\n                return Py_None;\n        }\n\n        switch (o->kind) {\n        case TypeIgnore_kind:\n                result = PyType_GenericNew(TypeIgnore_type, NULL, NULL);\n                if (!result) goto failed;\n                value = ast2obj_int(o->v.TypeIgnore.lineno);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"lineno\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                value = ast2obj_string(o->v.TypeIgnore.tag);\n                if (!value) goto failed;\n                if (PyObject_SetAttrString(result, \"tag\", value) == -1)\n                        goto failed;\n                Py_DECREF(value);\n                break;\n        }\n        return result;\nfailed:\n        Py_XDECREF(value);\n        Py_XDECREF(result);\n        return NULL;\n}\n\n\nint\nobj2ast_mod(PyObject* obj, mod_ty* out, PyArena* arena)\n{\n        PyObject* tmp = NULL;\n        int isinstance;\n\n\n        if (obj == Py_None) {\n                *out = NULL;\n                return 0;\n        }\n        isinstance = PyObject_IsInstance(obj, (PyObject*)Module_type);\n        if (isinstance == -1) {\n                return 1;\n        }\n        if (isinstance) {\n                asdl_seq* body;\n                asdl_seq* type_ignores;\n\n                if (PyObject_HasAttrString(obj, \"body\")) {\n                        int res;\n                        Py_ssize_t len;\n                        Py_ssize_t i;\n                        tmp = PyObject_GetAttrString(obj, \"body\");\n                        if (tmp == NULL) goto failed;\n                        if (!PyList_Check(tmp)) {\n                                PyErr_Format(PyExc_TypeError, \"Module field \\\"body\\\" must be a list, not a %.200s\", tmp->ob_type->tp_name);\n                                goto failed;\n                        }\n                        len = PyList_GET_SIZE(tmp);\n                        body = asdl_seq_new(len, arena);\n                        if (body == NULL) goto failed;\n                        for (i = 0; i < len; i++) {\n                                stmt_ty value;\n                                res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena);\n                                if (res != 0) goto failed;\n                                asdl_seq_SET(body, i, value);\n                        }\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        PyErr_SetString(PyExc_TypeError, \"required field \\\"body\\\" missing from Module\");\n                        return 1;\n                }\n                if (PyObject_HasAttrString(obj, \"type_ignores\")) {\n                        int res;\n                        Py_ssize_t len;\n                        Py_ssize_t i;\n                        tmp = PyObject_GetAttrString(obj, \"type_ignores\");\n                        if (tmp == NULL) goto failed;\n                        if (!PyList_Check(tmp)) {\n                                PyErr_Format(PyExc_TypeError, \"Module field \\\"type_ignores\\\" must be a list, not a %.200s\", tmp->ob_type->tp_name);\n                                goto failed;\n                        }\n                        len = PyList_GET_SIZE(tmp);\n                        type_ignores = asdl_seq_new(len, arena);\n                        if (type_ignores == NULL) goto failed;\n                        for (i = 0; i < len; i++) {\n                                type_ignore_ty value;\n                                res = obj2ast_type_ignore(PyList_GET_ITEM(tmp, i), &value, arena);\n                                if (res != 0) goto failed;\n                                asdl_seq_SET(type_ignores, i, value);\n                        }\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        PyErr_SetString(PyExc_TypeError, \"required field \\\"type_ignores\\\" missing from Module\");\n                        return 1;\n                }\n                *out = Module(body, type_ignores, arena);\n                if (*out == NULL) goto failed;\n                return 0;\n        }\n        isinstance = PyObject_IsInstance(obj, (PyObject*)Interactive_type);\n        if (isinstance == -1) {\n                return 1;\n        }\n        if (isinstance) {\n                asdl_seq* body;\n\n                if (PyObject_HasAttrString(obj, \"body\")) {\n                        int res;\n                        Py_ssize_t len;\n                        Py_ssize_t i;\n                        tmp = PyObject_GetAttrString(obj, \"body\");\n                        if (tmp == NULL) goto failed;\n                        if (!PyList_Check(tmp)) {\n                                PyErr_Format(PyExc_TypeError, \"Interactive field \\\"body\\\" must be a list, not a %.200s\", tmp->ob_type->tp_name);\n                                goto failed;\n                        }\n                        len = PyList_GET_SIZE(tmp);\n                        body = asdl_seq_new(len, arena);\n                        if (body == NULL) goto failed;\n                        for (i = 0; i < len; i++) {\n                                stmt_ty value;\n                                res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena);\n                                if (res != 0) goto failed;\n                                asdl_seq_SET(body, i, value);\n                        }\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        PyErr_SetString(PyExc_TypeError, \"required field \\\"body\\\" missing from Interactive\");\n                        return 1;\n                }\n                *out = Interactive(body, arena);\n                if (*out == NULL) goto failed;\n                return 0;\n        }\n        isinstance = PyObject_IsInstance(obj, (PyObject*)Expression_type);\n        if (isinstance == -1) {\n                return 1;\n        }\n        if (isinstance) {\n                expr_ty body;\n\n                if (PyObject_HasAttrString(obj, \"body\")) {\n                        int res;\n                        tmp = PyObject_GetAttrString(obj, \"body\");\n                        if (tmp == NULL) goto failed;\n                        res = obj2ast_expr(tmp, &body, arena);\n                        if (res != 0) goto failed;\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        PyErr_SetString(PyExc_TypeError, \"required field \\\"body\\\" missing from Expression\");\n                        return 1;\n                }\n                *out = Expression(body, arena);\n                if (*out == NULL) goto failed;\n                return 0;\n        }\n        isinstance = PyObject_IsInstance(obj, (PyObject*)FunctionType_type);\n        if (isinstance == -1) {\n                return 1;\n        }\n        if (isinstance) {\n                asdl_seq* argtypes;\n                expr_ty returns;\n\n                if (PyObject_HasAttrString(obj, \"argtypes\")) {\n                        int res;\n                        Py_ssize_t len;\n                        Py_ssize_t i;\n                        tmp = PyObject_GetAttrString(obj, \"argtypes\");\n                        if (tmp == NULL) goto failed;\n                        if (!PyList_Check(tmp)) {\n                                PyErr_Format(PyExc_TypeError, \"FunctionType field \\\"argtypes\\\" must be a list, not a %.200s\", tmp->ob_type->tp_name);\n                                goto failed;\n                        }\n                        len = PyList_GET_SIZE(tmp);\n                        argtypes = asdl_seq_new(len, arena);\n                        if (argtypes == NULL) goto failed;\n                        for (i = 0; i < len; i++) {\n                                expr_ty value;\n                                res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena);\n                                if (res != 0) goto failed;\n                                asdl_seq_SET(argtypes, i, value);\n                        }\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        PyErr_SetString(PyExc_TypeError, \"required field \\\"argtypes\\\" missing from FunctionType\");\n                        return 1;\n                }\n                if (PyObject_HasAttrString(obj, \"returns\")) {\n                        int res;\n                        tmp = PyObject_GetAttrString(obj, \"returns\");\n                        if (tmp == NULL) goto failed;\n                        res = obj2ast_expr(tmp, &returns, arena);\n                        if (res != 0) goto failed;\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        PyErr_SetString(PyExc_TypeError, \"required field \\\"returns\\\" missing from FunctionType\");\n                        return 1;\n                }\n                *out = FunctionType(argtypes, returns, arena);\n                if (*out == NULL) goto failed;\n                return 0;\n        }\n        isinstance = PyObject_IsInstance(obj, (PyObject*)Suite_type);\n        if (isinstance == -1) {\n                return 1;\n        }\n        if (isinstance) {\n                asdl_seq* body;\n\n                if (PyObject_HasAttrString(obj, \"body\")) {\n                        int res;\n                        Py_ssize_t len;\n                        Py_ssize_t i;\n                        tmp = PyObject_GetAttrString(obj, \"body\");\n                        if (tmp == NULL) goto failed;\n                        if (!PyList_Check(tmp)) {\n                                PyErr_Format(PyExc_TypeError, \"Suite field \\\"body\\\" must be a list, not a %.200s\", tmp->ob_type->tp_name);\n                                goto failed;\n                        }\n                        len = PyList_GET_SIZE(tmp);\n                        body = asdl_seq_new(len, arena);\n                        if (body == NULL) goto failed;\n                        for (i = 0; i < len; i++) {\n                                stmt_ty value;\n                                res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena);\n                                if (res != 0) goto failed;\n                                asdl_seq_SET(body, i, value);\n                        }\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        PyErr_SetString(PyExc_TypeError, \"required field \\\"body\\\" missing from Suite\");\n                        return 1;\n                }\n                *out = Suite(body, arena);\n                if (*out == NULL) goto failed;\n                return 0;\n        }\n\n        tmp = PyObject_Repr(obj);\n        if (tmp == NULL) goto failed;\n        PyErr_Format(PyExc_TypeError, \"expected some sort of mod, but got %.400s\", _PyUnicode_AsString(tmp));\nfailed:\n        Py_XDECREF(tmp);\n        return 1;\n}\n\nint\nobj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)\n{\n        PyObject* tmp = NULL;\n        int isinstance;\n\n        int lineno;\n        int col_offset;\n\n        if (obj == Py_None) {\n                *out = NULL;\n                return 0;\n        }\n        if (PyObject_HasAttrString(obj, \"lineno\")) {\n                int res;\n                tmp = PyObject_GetAttrString(obj, \"lineno\");\n                if (tmp == NULL) goto failed;\n                res = obj2ast_int(tmp, &lineno, arena);\n                if (res != 0) goto failed;\n                Py_XDECREF(tmp);\n                tmp = NULL;\n        } else {\n                PyErr_SetString(PyExc_TypeError, \"required field \\\"lineno\\\" missing from stmt\");\n                return 1;\n        }\n        if (PyObject_HasAttrString(obj, \"col_offset\")) {\n                int res;\n                tmp = PyObject_GetAttrString(obj, \"col_offset\");\n                if (tmp == NULL) goto failed;\n                res = obj2ast_int(tmp, &col_offset, arena);\n                if (res != 0) goto failed;\n                Py_XDECREF(tmp);\n                tmp = NULL;\n        } else {\n                PyErr_SetString(PyExc_TypeError, \"required field \\\"col_offset\\\" missing from stmt\");\n                return 1;\n        }\n        isinstance = PyObject_IsInstance(obj, (PyObject*)FunctionDef_type);\n        if (isinstance == -1) {\n                return 1;\n        }\n        if (isinstance) {\n                identifier name;\n                arguments_ty args;\n                asdl_seq* body;\n                asdl_seq* decorator_list;\n                string type_comment;\n\n                if (PyObject_HasAttrString(obj, \"name\")) {\n                        int res;\n                        tmp = PyObject_GetAttrString(obj, \"name\");\n                        if (tmp == NULL) goto failed;\n                        res = obj2ast_identifier(tmp, &name, arena);\n                        if (res != 0) goto failed;\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        PyErr_SetString(PyExc_TypeError, \"required field \\\"name\\\" missing from FunctionDef\");\n                        return 1;\n                }\n                if (PyObject_HasAttrString(obj, \"args\")) {\n                        int res;\n                        tmp = PyObject_GetAttrString(obj, \"args\");\n                        if (tmp == NULL) goto failed;\n                        res = obj2ast_arguments(tmp, &args, arena);\n                        if (res != 0) goto failed;\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        PyErr_SetString(PyExc_TypeError, \"required field \\\"args\\\" missing from FunctionDef\");\n                        return 1;\n                }\n                if (PyObject_HasAttrString(obj, \"body\")) {\n                        int res;\n                        Py_ssize_t len;\n                        Py_ssize_t i;\n                        tmp = PyObject_GetAttrString(obj, \"body\");\n                        if (tmp == NULL) goto failed;\n                        if (!PyList_Check(tmp)) {\n                                PyErr_Format(PyExc_TypeError, \"FunctionDef field \\\"body\\\" must be a list, not a %.200s\", tmp->ob_type->tp_name);\n                                goto failed;\n                        }\n                        len = PyList_GET_SIZE(tmp);\n                        body = asdl_seq_new(len, arena);\n                        if (body == NULL) goto failed;\n                        for (i = 0; i < len; i++) {\n                                stmt_ty value;\n                                res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena);\n                                if (res != 0) goto failed;\n                                asdl_seq_SET(body, i, value);\n                        }\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        PyErr_SetString(PyExc_TypeError, \"required field \\\"body\\\" missing from FunctionDef\");\n                        return 1;\n                }\n                if (PyObject_HasAttrString(obj, \"decorator_list\")) {\n                        int res;\n                        Py_ssize_t len;\n                        Py_ssize_t i;\n                        tmp = PyObject_GetAttrString(obj, \"decorator_list\");\n                        if (tmp == NULL) goto failed;\n                        if (!PyList_Check(tmp)) {\n                                PyErr_Format(PyExc_TypeError, \"FunctionDef field \\\"decorator_list\\\" must be a list, not a %.200s\", tmp->ob_type->tp_name);\n                                goto failed;\n                        }\n                        len = PyList_GET_SIZE(tmp);\n                        decorator_list = asdl_seq_new(len, arena);\n                        if (decorator_list == NULL) goto failed;\n                        for (i = 0; i < len; i++) {\n                                expr_ty value;\n                                res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena);\n                                if (res != 0) goto failed;\n                                asdl_seq_SET(decorator_list, i, value);\n                        }\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        PyErr_SetString(PyExc_TypeError, \"required field \\\"decorator_list\\\" missing from FunctionDef\");\n                        return 1;\n                }\n                if (PyObject_HasAttrString(obj, \"type_comment\")) {\n                        int res;\n                        tmp = PyObject_GetAttrString(obj, \"type_comment\");\n                        if (tmp == NULL) goto failed;\n                        res = obj2ast_string(tmp, &type_comment, arena);\n                        if (res != 0) goto failed;\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        type_comment = NULL;\n                }\n                *out = FunctionDef(name, args, body, decorator_list, type_comment, lineno,\n                                   col_offset, arena);\n                if (*out == NULL) goto failed;\n                return 0;\n        }\n        isinstance = PyObject_IsInstance(obj, (PyObject*)ClassDef_type);\n        if (isinstance == -1) {\n                return 1;\n        }\n        if (isinstance) {\n                identifier name;\n                asdl_seq* bases;\n                asdl_seq* body;\n                asdl_seq* decorator_list;\n\n                if (PyObject_HasAttrString(obj, \"name\")) {\n                        int res;\n                        tmp = PyObject_GetAttrString(obj, \"name\");\n                        if (tmp == NULL) goto failed;\n                        res = obj2ast_identifier(tmp, &name, arena);\n                        if (res != 0) goto failed;\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        PyErr_SetString(PyExc_TypeError, \"required field \\\"name\\\" missing from ClassDef\");\n                        return 1;\n                }\n                if (PyObject_HasAttrString(obj, \"bases\")) {\n                        int res;\n                        Py_ssize_t len;\n                        Py_ssize_t i;\n                        tmp = PyObject_GetAttrString(obj, \"bases\");\n                        if (tmp == NULL) goto failed;\n                        if (!PyList_Check(tmp)) {\n                                PyErr_Format(PyExc_TypeError, \"ClassDef field \\\"bases\\\" must be a list, not a %.200s\", tmp->ob_type->tp_name);\n                                goto failed;\n                        }\n                        len = PyList_GET_SIZE(tmp);\n                        bases = asdl_seq_new(len, arena);\n                        if (bases == NULL) goto failed;\n                        for (i = 0; i < len; i++) {\n                                expr_ty value;\n                                res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena);\n                                if (res != 0) goto failed;\n                                asdl_seq_SET(bases, i, value);\n                        }\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        PyErr_SetString(PyExc_TypeError, \"required field \\\"bases\\\" missing from ClassDef\");\n                        return 1;\n                }\n                if (PyObject_HasAttrString(obj, \"body\")) {\n                        int res;\n                        Py_ssize_t len;\n                        Py_ssize_t i;\n                        tmp = PyObject_GetAttrString(obj, \"body\");\n                        if (tmp == NULL) goto failed;\n                        if (!PyList_Check(tmp)) {\n                                PyErr_Format(PyExc_TypeError, \"ClassDef field \\\"body\\\" must be a list, not a %.200s\", tmp->ob_type->tp_name);\n                                goto failed;\n                        }\n                        len = PyList_GET_SIZE(tmp);\n                        body = asdl_seq_new(len, arena);\n                        if (body == NULL) goto failed;\n                        for (i = 0; i < len; i++) {\n                                stmt_ty value;\n                                res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena);\n                                if (res != 0) goto failed;\n                                asdl_seq_SET(body, i, value);\n                        }\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        PyErr_SetString(PyExc_TypeError, \"required field \\\"body\\\" missing from ClassDef\");\n                        return 1;\n                }\n                if (PyObject_HasAttrString(obj, \"decorator_list\")) {\n                        int res;\n                        Py_ssize_t len;\n                        Py_ssize_t i;\n                        tmp = PyObject_GetAttrString(obj, \"decorator_list\");\n                        if (tmp == NULL) goto failed;\n                        if (!PyList_Check(tmp)) {\n                                PyErr_Format(PyExc_TypeError, \"ClassDef field \\\"decorator_list\\\" must be a list, not a %.200s\", tmp->ob_type->tp_name);\n                                goto failed;\n                        }\n                        len = PyList_GET_SIZE(tmp);\n                        decorator_list = asdl_seq_new(len, arena);\n                        if (decorator_list == NULL) goto failed;\n                        for (i = 0; i < len; i++) {\n                                expr_ty value;\n                                res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena);\n                                if (res != 0) goto failed;\n                                asdl_seq_SET(decorator_list, i, value);\n                        }\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        PyErr_SetString(PyExc_TypeError, \"required field \\\"decorator_list\\\" missing from ClassDef\");\n                        return 1;\n                }\n                *out = ClassDef(name, bases, body, decorator_list, lineno, col_offset, arena);\n                if (*out == NULL) goto failed;\n                return 0;\n        }\n        isinstance = PyObject_IsInstance(obj, (PyObject*)Return_type);\n        if (isinstance == -1) {\n                return 1;\n        }\n        if (isinstance) {\n                expr_ty value;\n\n                if (PyObject_HasAttrString(obj, \"value\")) {\n                        int res;\n                        tmp = PyObject_GetAttrString(obj, \"value\");\n                        if (tmp == NULL) goto failed;\n                        res = obj2ast_expr(tmp, &value, arena);\n                        if (res != 0) goto failed;\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        value = NULL;\n                }\n                *out = Return(value, lineno, col_offset, arena);\n                if (*out == NULL) goto failed;\n                return 0;\n        }\n        isinstance = PyObject_IsInstance(obj, (PyObject*)Delete_type);\n        if (isinstance == -1) {\n                return 1;\n        }\n        if (isinstance) {\n                asdl_seq* targets;\n\n                if (PyObject_HasAttrString(obj, \"targets\")) {\n                        int res;\n                        Py_ssize_t len;\n                        Py_ssize_t i;\n                        tmp = PyObject_GetAttrString(obj, \"targets\");\n                        if (tmp == NULL) goto failed;\n                        if (!PyList_Check(tmp)) {\n                                PyErr_Format(PyExc_TypeError, \"Delete field \\\"targets\\\" must be a list, not a %.200s\", tmp->ob_type->tp_name);\n                                goto failed;\n                        }\n                        len = PyList_GET_SIZE(tmp);\n                        targets = asdl_seq_new(len, arena);\n                        if (targets == NULL) goto failed;\n                        for (i = 0; i < len; i++) {\n                                expr_ty value;\n                                res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena);\n                                if (res != 0) goto failed;\n                                asdl_seq_SET(targets, i, value);\n                        }\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        PyErr_SetString(PyExc_TypeError, \"required field \\\"targets\\\" missing from Delete\");\n                        return 1;\n                }\n                *out = Delete(targets, lineno, col_offset, arena);\n                if (*out == NULL) goto failed;\n                return 0;\n        }\n        isinstance = PyObject_IsInstance(obj, (PyObject*)Assign_type);\n        if (isinstance == -1) {\n                return 1;\n        }\n        if (isinstance) {\n                asdl_seq* targets;\n                expr_ty value;\n                string type_comment;\n\n                if (PyObject_HasAttrString(obj, \"targets\")) {\n                        int res;\n                        Py_ssize_t len;\n                        Py_ssize_t i;\n                        tmp = PyObject_GetAttrString(obj, \"targets\");\n                        if (tmp == NULL) goto failed;\n                        if (!PyList_Check(tmp)) {\n                                PyErr_Format(PyExc_TypeError, \"Assign field \\\"targets\\\" must be a list, not a %.200s\", tmp->ob_type->tp_name);\n                                goto failed;\n                        }\n                        len = PyList_GET_SIZE(tmp);\n                        targets = asdl_seq_new(len, arena);\n                        if (targets == NULL) goto failed;\n                        for (i = 0; i < len; i++) {\n                                expr_ty value;\n                                res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena);\n                                if (res != 0) goto failed;\n                                asdl_seq_SET(targets, i, value);\n                        }\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        PyErr_SetString(PyExc_TypeError, \"required field \\\"targets\\\" missing from Assign\");\n                        return 1;\n                }\n                if (PyObject_HasAttrString(obj, \"value\")) {\n                        int res;\n                        tmp = PyObject_GetAttrString(obj, \"value\");\n                        if (tmp == NULL) goto failed;\n                        res = obj2ast_expr(tmp, &value, arena);\n                        if (res != 0) goto failed;\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        PyErr_SetString(PyExc_TypeError, \"required field \\\"value\\\" missing from Assign\");\n                        return 1;\n                }\n                if (PyObject_HasAttrString(obj, \"type_comment\")) {\n                        int res;\n                        tmp = PyObject_GetAttrString(obj, \"type_comment\");\n                        if (tmp == NULL) goto failed;\n                        res = obj2ast_string(tmp, &type_comment, arena);\n                        if (res != 0) goto failed;\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        type_comment = NULL;\n                }\n                *out = Assign(targets, value, type_comment, lineno, col_offset, arena);\n                if (*out == NULL) goto failed;\n                return 0;\n        }\n        isinstance = PyObject_IsInstance(obj, (PyObject*)AugAssign_type);\n        if (isinstance == -1) {\n                return 1;\n        }\n        if (isinstance) {\n                expr_ty target;\n                operator_ty op;\n                expr_ty value;\n\n                if (PyObject_HasAttrString(obj, \"target\")) {\n                        int res;\n                        tmp = PyObject_GetAttrString(obj, \"target\");\n                        if (tmp == NULL) goto failed;\n                        res = obj2ast_expr(tmp, &target, arena);\n                        if (res != 0) goto failed;\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        PyErr_SetString(PyExc_TypeError, \"required field \\\"target\\\" missing from AugAssign\");\n                        return 1;\n                }\n                if (PyObject_HasAttrString(obj, \"op\")) {\n                        int res;\n                        tmp = PyObject_GetAttrString(obj, \"op\");\n                        if (tmp == NULL) goto failed;\n                        res = obj2ast_operator(tmp, &op, arena);\n                        if (res != 0) goto failed;\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        PyErr_SetString(PyExc_TypeError, \"required field \\\"op\\\" missing from AugAssign\");\n                        return 1;\n                }\n                if (PyObject_HasAttrString(obj, \"value\")) {\n                        int res;\n                        tmp = PyObject_GetAttrString(obj, \"value\");\n                        if (tmp == NULL) goto failed;\n                        res = obj2ast_expr(tmp, &value, arena);\n                        if (res != 0) goto failed;\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        PyErr_SetString(PyExc_TypeError, \"required field \\\"value\\\" missing from AugAssign\");\n                        return 1;\n                }\n                *out = AugAssign(target, op, value, lineno, col_offset, arena);\n                if (*out == NULL) goto failed;\n                return 0;\n        }\n        isinstance = PyObject_IsInstance(obj, (PyObject*)Print_type);\n        if (isinstance == -1) {\n                return 1;\n        }\n        if (isinstance) {\n                expr_ty dest;\n                asdl_seq* values;\n                bool nl;\n\n                if (PyObject_HasAttrString(obj, \"dest\")) {\n                        int res;\n                        tmp = PyObject_GetAttrString(obj, \"dest\");\n                        if (tmp == NULL) goto failed;\n                        res = obj2ast_expr(tmp, &dest, arena);\n                        if (res != 0) goto failed;\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        dest = NULL;\n                }\n                if (PyObject_HasAttrString(obj, \"values\")) {\n                        int res;\n                        Py_ssize_t len;\n                        Py_ssize_t i;\n                        tmp = PyObject_GetAttrString(obj, \"values\");\n                        if (tmp == NULL) goto failed;\n                        if (!PyList_Check(tmp)) {\n                                PyErr_Format(PyExc_TypeError, \"Print field \\\"values\\\" must be a list, not a %.200s\", tmp->ob_type->tp_name);\n                                goto failed;\n                        }\n                        len = PyList_GET_SIZE(tmp);\n                        values = asdl_seq_new(len, arena);\n                        if (values == NULL) goto failed;\n                        for (i = 0; i < len; i++) {\n                                expr_ty value;\n                                res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena);\n                                if (res != 0) goto failed;\n                                asdl_seq_SET(values, i, value);\n                        }\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        PyErr_SetString(PyExc_TypeError, \"required field \\\"values\\\" missing from Print\");\n                        return 1;\n                }\n                if (PyObject_HasAttrString(obj, \"nl\")) {\n                        int res;\n                        tmp = PyObject_GetAttrString(obj, \"nl\");\n                        if (tmp == NULL) goto failed;\n                        res = obj2ast_bool(tmp, &nl, arena);\n                        if (res != 0) goto failed;\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        PyErr_SetString(PyExc_TypeError, \"required field \\\"nl\\\" missing from Print\");\n                        return 1;\n                }\n                *out = Print(dest, values, nl, lineno, col_offset, arena);\n                if (*out == NULL) goto failed;\n                return 0;\n        }\n        isinstance = PyObject_IsInstance(obj, (PyObject*)For_type);\n        if (isinstance == -1) {\n                return 1;\n        }\n        if (isinstance) {\n                expr_ty target;\n                expr_ty iter;\n                asdl_seq* body;\n                asdl_seq* orelse;\n                string type_comment;\n\n                if (PyObject_HasAttrString(obj, \"target\")) {\n                        int res;\n                        tmp = PyObject_GetAttrString(obj, \"target\");\n                        if (tmp == NULL) goto failed;\n                        res = obj2ast_expr(tmp, &target, arena);\n                        if (res != 0) goto failed;\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        PyErr_SetString(PyExc_TypeError, \"required field \\\"target\\\" missing from For\");\n                        return 1;\n                }\n                if (PyObject_HasAttrString(obj, \"iter\")) {\n                        int res;\n                        tmp = PyObject_GetAttrString(obj, \"iter\");\n                        if (tmp == NULL) goto failed;\n                        res = obj2ast_expr(tmp, &iter, arena);\n                        if (res != 0) goto failed;\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        PyErr_SetString(PyExc_TypeError, \"required field \\\"iter\\\" missing from For\");\n                        return 1;\n                }\n                if (PyObject_HasAttrString(obj, \"body\")) {\n                        int res;\n                        Py_ssize_t len;\n                        Py_ssize_t i;\n                        tmp = PyObject_GetAttrString(obj, \"body\");\n                        if (tmp == NULL) goto failed;\n                        if (!PyList_Check(tmp)) {\n                                PyErr_Format(PyExc_TypeError, \"For field \\\"body\\\" must be a list, not a %.200s\", tmp->ob_type->tp_name);\n                                goto failed;\n                        }\n                        len = PyList_GET_SIZE(tmp);\n                        body = asdl_seq_new(len, arena);\n                        if (body == NULL) goto failed;\n                        for (i = 0; i < len; i++) {\n                                stmt_ty value;\n                                res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena);\n                                if (res != 0) goto failed;\n                                asdl_seq_SET(body, i, value);\n                        }\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        PyErr_SetString(PyExc_TypeError, \"required field \\\"body\\\" missing from For\");\n                        return 1;\n                }\n                if (PyObject_HasAttrString(obj, \"orelse\")) {\n                        int res;\n                        Py_ssize_t len;\n                        Py_ssize_t i;\n                        tmp = PyObject_GetAttrString(obj, \"orelse\");\n                        if (tmp == NULL) goto failed;\n                        if (!PyList_Check(tmp)) {\n                                PyErr_Format(PyExc_TypeError, \"For field \\\"orelse\\\" must be a list, not a %.200s\", tmp->ob_type->tp_name);\n                                goto failed;\n                        }\n                        len = PyList_GET_SIZE(tmp);\n                        orelse = asdl_seq_new(len, arena);\n                        if (orelse == NULL) goto failed;\n                        for (i = 0; i < len; i++) {\n                                stmt_ty value;\n                                res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena);\n                                if (res != 0) goto failed;\n                                asdl_seq_SET(orelse, i, value);\n                        }\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        PyErr_SetString(PyExc_TypeError, \"required field \\\"orelse\\\" missing from For\");\n                        return 1;\n                }\n                if (PyObject_HasAttrString(obj, \"type_comment\")) {\n                        int res;\n                        tmp = PyObject_GetAttrString(obj, \"type_comment\");\n                        if (tmp == NULL) goto failed;\n                        res = obj2ast_string(tmp, &type_comment, arena);\n                        if (res != 0) goto failed;\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        type_comment = NULL;\n                }\n                *out = For(target, iter, body, orelse, type_comment, lineno, col_offset, arena);\n                if (*out == NULL) goto failed;\n                return 0;\n        }\n        isinstance = PyObject_IsInstance(obj, (PyObject*)While_type);\n        if (isinstance == -1) {\n                return 1;\n        }\n        if (isinstance) {\n                expr_ty test;\n                asdl_seq* body;\n                asdl_seq* orelse;\n\n                if (PyObject_HasAttrString(obj, \"test\")) {\n                        int res;\n                        tmp = PyObject_GetAttrString(obj, \"test\");\n                        if (tmp == NULL) goto failed;\n                        res = obj2ast_expr(tmp, &test, arena);\n                        if (res != 0) goto failed;\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        PyErr_SetString(PyExc_TypeError, \"required field \\\"test\\\" missing from While\");\n                        return 1;\n                }\n                if (PyObject_HasAttrString(obj, \"body\")) {\n                        int res;\n                        Py_ssize_t len;\n                        Py_ssize_t i;\n                        tmp = PyObject_GetAttrString(obj, \"body\");\n                        if (tmp == NULL) goto failed;\n                        if (!PyList_Check(tmp)) {\n                                PyErr_Format(PyExc_TypeError, \"While field \\\"body\\\" must be a list, not a %.200s\", tmp->ob_type->tp_name);\n                                goto failed;\n                        }\n                        len = PyList_GET_SIZE(tmp);\n                        body = asdl_seq_new(len, arena);\n                        if (body == NULL) goto failed;\n                        for (i = 0; i < len; i++) {\n                                stmt_ty value;\n                                res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena);\n                                if (res != 0) goto failed;\n                                asdl_seq_SET(body, i, value);\n                        }\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        PyErr_SetString(PyExc_TypeError, \"required field \\\"body\\\" missing from While\");\n                        return 1;\n                }\n                if (PyObject_HasAttrString(obj, \"orelse\")) {\n                        int res;\n                        Py_ssize_t len;\n                        Py_ssize_t i;\n                        tmp = PyObject_GetAttrString(obj, \"orelse\");\n                        if (tmp == NULL) goto failed;\n                        if (!PyList_Check(tmp)) {\n                                PyErr_Format(PyExc_TypeError, \"While field \\\"orelse\\\" must be a list, not a %.200s\", tmp->ob_type->tp_name);\n                                goto failed;\n                        }\n                        len = PyList_GET_SIZE(tmp);\n                        orelse = asdl_seq_new(len, arena);\n                        if (orelse == NULL) goto failed;\n                        for (i = 0; i < len; i++) {\n                                stmt_ty value;\n                                res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena);\n                                if (res != 0) goto failed;\n                                asdl_seq_SET(orelse, i, value);\n                        }\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        PyErr_SetString(PyExc_TypeError, \"required field \\\"orelse\\\" missing from While\");\n                        return 1;\n                }\n                *out = While(test, body, orelse, lineno, col_offset, arena);\n                if (*out == NULL) goto failed;\n                return 0;\n        }\n        isinstance = PyObject_IsInstance(obj, (PyObject*)If_type);\n        if (isinstance == -1) {\n                return 1;\n        }\n        if (isinstance) {\n                expr_ty test;\n                asdl_seq* body;\n                asdl_seq* orelse;\n\n                if (PyObject_HasAttrString(obj, \"test\")) {\n                        int res;\n                        tmp = PyObject_GetAttrString(obj, \"test\");\n                        if (tmp == NULL) goto failed;\n                        res = obj2ast_expr(tmp, &test, arena);\n                        if (res != 0) goto failed;\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        PyErr_SetString(PyExc_TypeError, \"required field \\\"test\\\" missing from If\");\n                        return 1;\n                }\n                if (PyObject_HasAttrString(obj, \"body\")) {\n                        int res;\n                        Py_ssize_t len;\n                        Py_ssize_t i;\n                        tmp = PyObject_GetAttrString(obj, \"body\");\n                        if (tmp == NULL) goto failed;\n                        if (!PyList_Check(tmp)) {\n                                PyErr_Format(PyExc_TypeError, \"If field \\\"body\\\" must be a list, not a %.200s\", tmp->ob_type->tp_name);\n                                goto failed;\n                        }\n                        len = PyList_GET_SIZE(tmp);\n                        body = asdl_seq_new(len, arena);\n                        if (body == NULL) goto failed;\n                        for (i = 0; i < len; i++) {\n                                stmt_ty value;\n                                res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena);\n                                if (res != 0) goto failed;\n                                asdl_seq_SET(body, i, value);\n                        }\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        PyErr_SetString(PyExc_TypeError, \"required field \\\"body\\\" missing from If\");\n                        return 1;\n                }\n                if (PyObject_HasAttrString(obj, \"orelse\")) {\n                        int res;\n                        Py_ssize_t len;\n                        Py_ssize_t i;\n                        tmp = PyObject_GetAttrString(obj, \"orelse\");\n                        if (tmp == NULL) goto failed;\n                        if (!PyList_Check(tmp)) {\n                                PyErr_Format(PyExc_TypeError, \"If field \\\"orelse\\\" must be a list, not a %.200s\", tmp->ob_type->tp_name);\n                                goto failed;\n                        }\n                        len = PyList_GET_SIZE(tmp);\n                        orelse = asdl_seq_new(len, arena);\n                        if (orelse == NULL) goto failed;\n                        for (i = 0; i < len; i++) {\n                                stmt_ty value;\n                                res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena);\n                                if (res != 0) goto failed;\n                                asdl_seq_SET(orelse, i, value);\n                        }\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        PyErr_SetString(PyExc_TypeError, \"required field \\\"orelse\\\" missing from If\");\n                        return 1;\n                }\n                *out = If(test, body, orelse, lineno, col_offset, arena);\n                if (*out == NULL) goto failed;\n                return 0;\n        }\n        isinstance = PyObject_IsInstance(obj, (PyObject*)With_type);\n        if (isinstance == -1) {\n                return 1;\n        }\n        if (isinstance) {\n                expr_ty context_expr;\n                expr_ty optional_vars;\n                asdl_seq* body;\n                string type_comment;\n\n                if (PyObject_HasAttrString(obj, \"context_expr\")) {\n                        int res;\n                        tmp = PyObject_GetAttrString(obj, \"context_expr\");\n                        if (tmp == NULL) goto failed;\n                        res = obj2ast_expr(tmp, &context_expr, arena);\n                        if (res != 0) goto failed;\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        PyErr_SetString(PyExc_TypeError, \"required field \\\"context_expr\\\" missing from With\");\n                        return 1;\n                }\n                if (PyObject_HasAttrString(obj, \"optional_vars\")) {\n                        int res;\n                        tmp = PyObject_GetAttrString(obj, \"optional_vars\");\n                        if (tmp == NULL) goto failed;\n                        res = obj2ast_expr(tmp, &optional_vars, arena);\n                        if (res != 0) goto failed;\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        optional_vars = NULL;\n                }\n                if (PyObject_HasAttrString(obj, \"body\")) {\n                        int res;\n                        Py_ssize_t len;\n                        Py_ssize_t i;\n                        tmp = PyObject_GetAttrString(obj, \"body\");\n                        if (tmp == NULL) goto failed;\n                        if (!PyList_Check(tmp)) {\n                                PyErr_Format(PyExc_TypeError, \"With field \\\"body\\\" must be a list, not a %.200s\", tmp->ob_type->tp_name);\n                                goto failed;\n                        }\n                        len = PyList_GET_SIZE(tmp);\n                        body = asdl_seq_new(len, arena);\n                        if (body == NULL) goto failed;\n                        for (i = 0; i < len; i++) {\n                                stmt_ty value;\n                                res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena);\n                                if (res != 0) goto failed;\n                                asdl_seq_SET(body, i, value);\n                        }\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        PyErr_SetString(PyExc_TypeError, \"required field \\\"body\\\" missing from With\");\n                        return 1;\n                }\n                if (PyObject_HasAttrString(obj, \"type_comment\")) {\n                        int res;\n                        tmp = PyObject_GetAttrString(obj, \"type_comment\");\n                        if (tmp == NULL) goto failed;\n                        res = obj2ast_string(tmp, &type_comment, arena);\n                        if (res != 0) goto failed;\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        type_comment = NULL;\n                }\n                *out = With(context_expr, optional_vars, body, type_comment, lineno, col_offset,\n                            arena);\n                if (*out == NULL) goto failed;\n                return 0;\n        }\n        isinstance = PyObject_IsInstance(obj, (PyObject*)Raise_type);\n        if (isinstance == -1) {\n                return 1;\n        }\n        if (isinstance) {\n                expr_ty type;\n                expr_ty inst;\n                expr_ty tback;\n\n                if (PyObject_HasAttrString(obj, \"type\")) {\n                        int res;\n                        tmp = PyObject_GetAttrString(obj, \"type\");\n                        if (tmp == NULL) goto failed;\n                        res = obj2ast_expr(tmp, &type, arena);\n                        if (res != 0) goto failed;\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        type = NULL;\n                }\n                if (PyObject_HasAttrString(obj, \"inst\")) {\n                        int res;\n                        tmp = PyObject_GetAttrString(obj, \"inst\");\n                        if (tmp == NULL) goto failed;\n                        res = obj2ast_expr(tmp, &inst, arena);\n                        if (res != 0) goto failed;\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        inst = NULL;\n                }\n                if (PyObject_HasAttrString(obj, \"tback\")) {\n                        int res;\n                        tmp = PyObject_GetAttrString(obj, \"tback\");\n                        if (tmp == NULL) goto failed;\n                        res = obj2ast_expr(tmp, &tback, arena);\n                        if (res != 0) goto failed;\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        tback = NULL;\n                }\n                *out = Raise(type, inst, tback, lineno, col_offset, arena);\n                if (*out == NULL) goto failed;\n                return 0;\n        }\n        isinstance = PyObject_IsInstance(obj, (PyObject*)TryExcept_type);\n        if (isinstance == -1) {\n                return 1;\n        }\n        if (isinstance) {\n                asdl_seq* body;\n                asdl_seq* handlers;\n                asdl_seq* orelse;\n\n                if (PyObject_HasAttrString(obj, \"body\")) {\n                        int res;\n                        Py_ssize_t len;\n                        Py_ssize_t i;\n                        tmp = PyObject_GetAttrString(obj, \"body\");\n                        if (tmp == NULL) goto failed;\n                        if (!PyList_Check(tmp)) {\n                                PyErr_Format(PyExc_TypeError, \"TryExcept field \\\"body\\\" must be a list, not a %.200s\", tmp->ob_type->tp_name);\n                                goto failed;\n                        }\n                        len = PyList_GET_SIZE(tmp);\n                        body = asdl_seq_new(len, arena);\n                        if (body == NULL) goto failed;\n                        for (i = 0; i < len; i++) {\n                                stmt_ty value;\n                                res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena);\n                                if (res != 0) goto failed;\n                                asdl_seq_SET(body, i, value);\n                        }\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        PyErr_SetString(PyExc_TypeError, \"required field \\\"body\\\" missing from TryExcept\");\n                        return 1;\n                }\n                if (PyObject_HasAttrString(obj, \"handlers\")) {\n                        int res;\n                        Py_ssize_t len;\n                        Py_ssize_t i;\n                        tmp = PyObject_GetAttrString(obj, \"handlers\");\n                        if (tmp == NULL) goto failed;\n                        if (!PyList_Check(tmp)) {\n                                PyErr_Format(PyExc_TypeError, \"TryExcept field \\\"handlers\\\" must be a list, not a %.200s\", tmp->ob_type->tp_name);\n                                goto failed;\n                        }\n                        len = PyList_GET_SIZE(tmp);\n                        handlers = asdl_seq_new(len, arena);\n                        if (handlers == NULL) goto failed;\n                        for (i = 0; i < len; i++) {\n                                excepthandler_ty value;\n                                res = obj2ast_excepthandler(PyList_GET_ITEM(tmp, i), &value, arena);\n                                if (res != 0) goto failed;\n                                asdl_seq_SET(handlers, i, value);\n                        }\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        PyErr_SetString(PyExc_TypeError, \"required field \\\"handlers\\\" missing from TryExcept\");\n                        return 1;\n                }\n                if (PyObject_HasAttrString(obj, \"orelse\")) {\n                        int res;\n                        Py_ssize_t len;\n                        Py_ssize_t i;\n                        tmp = PyObject_GetAttrString(obj, \"orelse\");\n                        if (tmp == NULL) goto failed;\n                        if (!PyList_Check(tmp)) {\n                                PyErr_Format(PyExc_TypeError, \"TryExcept field \\\"orelse\\\" must be a list, not a %.200s\", tmp->ob_type->tp_name);\n                                goto failed;\n                        }\n                        len = PyList_GET_SIZE(tmp);\n                        orelse = asdl_seq_new(len, arena);\n                        if (orelse == NULL) goto failed;\n                        for (i = 0; i < len; i++) {\n                                stmt_ty value;\n                                res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena);\n                                if (res != 0) goto failed;\n                                asdl_seq_SET(orelse, i, value);\n                        }\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        PyErr_SetString(PyExc_TypeError, \"required field \\\"orelse\\\" missing from TryExcept\");\n                        return 1;\n                }\n                *out = TryExcept(body, handlers, orelse, lineno, col_offset, arena);\n                if (*out == NULL) goto failed;\n                return 0;\n        }\n        isinstance = PyObject_IsInstance(obj, (PyObject*)TryFinally_type);\n        if (isinstance == -1) {\n                return 1;\n        }\n        if (isinstance) {\n                asdl_seq* body;\n                asdl_seq* finalbody;\n\n                if (PyObject_HasAttrString(obj, \"body\")) {\n                        int res;\n                        Py_ssize_t len;\n                        Py_ssize_t i;\n                        tmp = PyObject_GetAttrString(obj, \"body\");\n                        if (tmp == NULL) goto failed;\n                        if (!PyList_Check(tmp)) {\n                                PyErr_Format(PyExc_TypeError, \"TryFinally field \\\"body\\\" must be a list, not a %.200s\", tmp->ob_type->tp_name);\n                                goto failed;\n                        }\n                        len = PyList_GET_SIZE(tmp);\n                        body = asdl_seq_new(len, arena);\n                        if (body == NULL) goto failed;\n                        for (i = 0; i < len; i++) {\n                                stmt_ty value;\n                                res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena);\n                                if (res != 0) goto failed;\n                                asdl_seq_SET(body, i, value);\n                        }\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        PyErr_SetString(PyExc_TypeError, \"required field \\\"body\\\" missing from TryFinally\");\n                        return 1;\n                }\n                if (PyObject_HasAttrString(obj, \"finalbody\")) {\n                        int res;\n                        Py_ssize_t len;\n                        Py_ssize_t i;\n                        tmp = PyObject_GetAttrString(obj, \"finalbody\");\n                        if (tmp == NULL) goto failed;\n                        if (!PyList_Check(tmp)) {\n                                PyErr_Format(PyExc_TypeError, \"TryFinally field \\\"finalbody\\\" must be a list, not a %.200s\", tmp->ob_type->tp_name);\n                                goto failed;\n                        }\n                        len = PyList_GET_SIZE(tmp);\n                        finalbody = asdl_seq_new(len, arena);\n                        if (finalbody == NULL) goto failed;\n                        for (i = 0; i < len; i++) {\n                                stmt_ty value;\n                                res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena);\n                                if (res != 0) goto failed;\n                                asdl_seq_SET(finalbody, i, value);\n                        }\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        PyErr_SetString(PyExc_TypeError, \"required field \\\"finalbody\\\" missing from TryFinally\");\n                        return 1;\n                }\n                *out = TryFinally(body, finalbody, lineno, col_offset, arena);\n                if (*out == NULL) goto failed;\n                return 0;\n        }\n        isinstance = PyObject_IsInstance(obj, (PyObject*)Assert_type);\n        if (isinstance == -1) {\n                return 1;\n        }\n        if (isinstance) {\n                expr_ty test;\n                expr_ty msg;\n\n                if (PyObject_HasAttrString(obj, \"test\")) {\n                        int res;\n                        tmp = PyObject_GetAttrString(obj, \"test\");\n                        if (tmp == NULL) goto failed;\n                        res = obj2ast_expr(tmp, &test, arena);\n                        if (res != 0) goto failed;\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        PyErr_SetString(PyExc_TypeError, \"required field \\\"test\\\" missing from Assert\");\n                        return 1;\n                }\n                if (PyObject_HasAttrString(obj, \"msg\")) {\n                        int res;\n                        tmp = PyObject_GetAttrString(obj, \"msg\");\n                        if (tmp == NULL) goto failed;\n                        res = obj2ast_expr(tmp, &msg, arena);\n                        if (res != 0) goto failed;\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        msg = NULL;\n                }\n                *out = Assert(test, msg, lineno, col_offset, arena);\n                if (*out == NULL) goto failed;\n                return 0;\n        }\n        isinstance = PyObject_IsInstance(obj, (PyObject*)Import_type);\n        if (isinstance == -1) {\n                return 1;\n        }\n        if (isinstance) {\n                asdl_seq* names;\n\n                if (PyObject_HasAttrString(obj, \"names\")) {\n                        int res;\n                        Py_ssize_t len;\n                        Py_ssize_t i;\n                        tmp = PyObject_GetAttrString(obj, \"names\");\n                        if (tmp == NULL) goto failed;\n                        if (!PyList_Check(tmp)) {\n                                PyErr_Format(PyExc_TypeError, \"Import field \\\"names\\\" must be a list, not a %.200s\", tmp->ob_type->tp_name);\n                                goto failed;\n                        }\n                        len = PyList_GET_SIZE(tmp);\n                        names = asdl_seq_new(len, arena);\n                        if (names == NULL) goto failed;\n                        for (i = 0; i < len; i++) {\n                                alias_ty value;\n                                res = obj2ast_alias(PyList_GET_ITEM(tmp, i), &value, arena);\n                                if (res != 0) goto failed;\n                                asdl_seq_SET(names, i, value);\n                        }\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        PyErr_SetString(PyExc_TypeError, \"required field \\\"names\\\" missing from Import\");\n                        return 1;\n                }\n                *out = Import(names, lineno, col_offset, arena);\n                if (*out == NULL) goto failed;\n                return 0;\n        }\n        isinstance = PyObject_IsInstance(obj, (PyObject*)ImportFrom_type);\n        if (isinstance == -1) {\n                return 1;\n        }\n        if (isinstance) {\n                identifier module;\n                asdl_seq* names;\n                int level;\n\n                if (PyObject_HasAttrString(obj, \"module\")) {\n                        int res;\n                        tmp = PyObject_GetAttrString(obj, \"module\");\n                        if (tmp == NULL) goto failed;\n                        res = obj2ast_identifier(tmp, &module, arena);\n                        if (res != 0) goto failed;\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        module = NULL;\n                }\n                if (PyObject_HasAttrString(obj, \"names\")) {\n                        int res;\n                        Py_ssize_t len;\n                        Py_ssize_t i;\n                        tmp = PyObject_GetAttrString(obj, \"names\");\n                        if (tmp == NULL) goto failed;\n                        if (!PyList_Check(tmp)) {\n                                PyErr_Format(PyExc_TypeError, \"ImportFrom field \\\"names\\\" must be a list, not a %.200s\", tmp->ob_type->tp_name);\n                                goto failed;\n                        }\n                        len = PyList_GET_SIZE(tmp);\n                        names = asdl_seq_new(len, arena);\n                        if (names == NULL) goto failed;\n                        for (i = 0; i < len; i++) {\n                                alias_ty value;\n                                res = obj2ast_alias(PyList_GET_ITEM(tmp, i), &value, arena);\n                                if (res != 0) goto failed;\n                                asdl_seq_SET(names, i, value);\n                        }\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        PyErr_SetString(PyExc_TypeError, \"required field \\\"names\\\" missing from ImportFrom\");\n                        return 1;\n                }\n                if (PyObject_HasAttrString(obj, \"level\")) {\n                        int res;\n                        tmp = PyObject_GetAttrString(obj, \"level\");\n                        if (tmp == NULL) goto failed;\n                        res = obj2ast_int(tmp, &level, arena);\n                        if (res != 0) goto failed;\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        level = 0;\n                }\n                *out = ImportFrom(module, names, level, lineno, col_offset, arena);\n                if (*out == NULL) goto failed;\n                return 0;\n        }\n        isinstance = PyObject_IsInstance(obj, (PyObject*)Exec_type);\n        if (isinstance == -1) {\n                return 1;\n        }\n        if (isinstance) {\n                expr_ty body;\n                expr_ty globals;\n                expr_ty locals;\n\n                if (PyObject_HasAttrString(obj, \"body\")) {\n                        int res;\n                        tmp = PyObject_GetAttrString(obj, \"body\");\n                        if (tmp == NULL) goto failed;\n                        res = obj2ast_expr(tmp, &body, arena);\n                        if (res != 0) goto failed;\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        PyErr_SetString(PyExc_TypeError, \"required field \\\"body\\\" missing from Exec\");\n                        return 1;\n                }\n                if (PyObject_HasAttrString(obj, \"globals\")) {\n                        int res;\n                        tmp = PyObject_GetAttrString(obj, \"globals\");\n                        if (tmp == NULL) goto failed;\n                        res = obj2ast_expr(tmp, &globals, arena);\n                        if (res != 0) goto failed;\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        globals = NULL;\n                }\n                if (PyObject_HasAttrString(obj, \"locals\")) {\n                        int res;\n                        tmp = PyObject_GetAttrString(obj, \"locals\");\n                        if (tmp == NULL) goto failed;\n                        res = obj2ast_expr(tmp, &locals, arena);\n                        if (res != 0) goto failed;\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        locals = NULL;\n                }\n                *out = Exec(body, globals, locals, lineno, col_offset, arena);\n                if (*out == NULL) goto failed;\n                return 0;\n        }\n        isinstance = PyObject_IsInstance(obj, (PyObject*)Global_type);\n        if (isinstance == -1) {\n                return 1;\n        }\n        if (isinstance) {\n                asdl_seq* names;\n\n                if (PyObject_HasAttrString(obj, \"names\")) {\n                        int res;\n                        Py_ssize_t len;\n                        Py_ssize_t i;\n                        tmp = PyObject_GetAttrString(obj, \"names\");\n                        if (tmp == NULL) goto failed;\n                        if (!PyList_Check(tmp)) {\n                                PyErr_Format(PyExc_TypeError, \"Global field \\\"names\\\" must be a list, not a %.200s\", tmp->ob_type->tp_name);\n                                goto failed;\n                        }\n                        len = PyList_GET_SIZE(tmp);\n                        names = asdl_seq_new(len, arena);\n                        if (names == NULL) goto failed;\n                        for (i = 0; i < len; i++) {\n                                identifier value;\n                                res = obj2ast_identifier(PyList_GET_ITEM(tmp, i), &value, arena);\n                                if (res != 0) goto failed;\n                                asdl_seq_SET(names, i, value);\n                        }\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        PyErr_SetString(PyExc_TypeError, \"required field \\\"names\\\" missing from Global\");\n                        return 1;\n                }\n                *out = Global(names, lineno, col_offset, arena);\n                if (*out == NULL) goto failed;\n                return 0;\n        }\n        isinstance = PyObject_IsInstance(obj, (PyObject*)Expr_type);\n        if (isinstance == -1) {\n                return 1;\n        }\n        if (isinstance) {\n                expr_ty value;\n\n                if (PyObject_HasAttrString(obj, \"value\")) {\n                        int res;\n                        tmp = PyObject_GetAttrString(obj, \"value\");\n                        if (tmp == NULL) goto failed;\n                        res = obj2ast_expr(tmp, &value, arena);\n                        if (res != 0) goto failed;\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        PyErr_SetString(PyExc_TypeError, \"required field \\\"value\\\" missing from Expr\");\n                        return 1;\n                }\n                *out = Expr(value, lineno, col_offset, arena);\n                if (*out == NULL) goto failed;\n                return 0;\n        }\n        isinstance = PyObject_IsInstance(obj, (PyObject*)Pass_type);\n        if (isinstance == -1) {\n                return 1;\n        }\n        if (isinstance) {\n\n                *out = Pass(lineno, col_offset, arena);\n                if (*out == NULL) goto failed;\n                return 0;\n        }\n        isinstance = PyObject_IsInstance(obj, (PyObject*)Break_type);\n        if (isinstance == -1) {\n                return 1;\n        }\n        if (isinstance) {\n\n                *out = Break(lineno, col_offset, arena);\n                if (*out == NULL) goto failed;\n                return 0;\n        }\n        isinstance = PyObject_IsInstance(obj, (PyObject*)Continue_type);\n        if (isinstance == -1) {\n                return 1;\n        }\n        if (isinstance) {\n\n                *out = Continue(lineno, col_offset, arena);\n                if (*out == NULL) goto failed;\n                return 0;\n        }\n\n        tmp = PyObject_Repr(obj);\n        if (tmp == NULL) goto failed;\n        PyErr_Format(PyExc_TypeError, \"expected some sort of stmt, but got %.400s\", _PyUnicode_AsString(tmp));\nfailed:\n        Py_XDECREF(tmp);\n        return 1;\n}\n\nint\nobj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)\n{\n        PyObject* tmp = NULL;\n        int isinstance;\n\n        int lineno;\n        int col_offset;\n\n        if (obj == Py_None) {\n                *out = NULL;\n                return 0;\n        }\n        if (PyObject_HasAttrString(obj, \"lineno\")) {\n                int res;\n                tmp = PyObject_GetAttrString(obj, \"lineno\");\n                if (tmp == NULL) goto failed;\n                res = obj2ast_int(tmp, &lineno, arena);\n                if (res != 0) goto failed;\n                Py_XDECREF(tmp);\n                tmp = NULL;\n        } else {\n                PyErr_SetString(PyExc_TypeError, \"required field \\\"lineno\\\" missing from expr\");\n                return 1;\n        }\n        if (PyObject_HasAttrString(obj, \"col_offset\")) {\n                int res;\n                tmp = PyObject_GetAttrString(obj, \"col_offset\");\n                if (tmp == NULL) goto failed;\n                res = obj2ast_int(tmp, &col_offset, arena);\n                if (res != 0) goto failed;\n                Py_XDECREF(tmp);\n                tmp = NULL;\n        } else {\n                PyErr_SetString(PyExc_TypeError, \"required field \\\"col_offset\\\" missing from expr\");\n                return 1;\n        }\n        isinstance = PyObject_IsInstance(obj, (PyObject*)BoolOp_type);\n        if (isinstance == -1) {\n                return 1;\n        }\n        if (isinstance) {\n                boolop_ty op;\n                asdl_seq* values;\n\n                if (PyObject_HasAttrString(obj, \"op\")) {\n                        int res;\n                        tmp = PyObject_GetAttrString(obj, \"op\");\n                        if (tmp == NULL) goto failed;\n                        res = obj2ast_boolop(tmp, &op, arena);\n                        if (res != 0) goto failed;\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        PyErr_SetString(PyExc_TypeError, \"required field \\\"op\\\" missing from BoolOp\");\n                        return 1;\n                }\n                if (PyObject_HasAttrString(obj, \"values\")) {\n                        int res;\n                        Py_ssize_t len;\n                        Py_ssize_t i;\n                        tmp = PyObject_GetAttrString(obj, \"values\");\n                        if (tmp == NULL) goto failed;\n                        if (!PyList_Check(tmp)) {\n                                PyErr_Format(PyExc_TypeError, \"BoolOp field \\\"values\\\" must be a list, not a %.200s\", tmp->ob_type->tp_name);\n                                goto failed;\n                        }\n                        len = PyList_GET_SIZE(tmp);\n                        values = asdl_seq_new(len, arena);\n                        if (values == NULL) goto failed;\n                        for (i = 0; i < len; i++) {\n                                expr_ty value;\n                                res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena);\n                                if (res != 0) goto failed;\n                                asdl_seq_SET(values, i, value);\n                        }\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        PyErr_SetString(PyExc_TypeError, \"required field \\\"values\\\" missing from BoolOp\");\n                        return 1;\n                }\n                *out = BoolOp(op, values, lineno, col_offset, arena);\n                if (*out == NULL) goto failed;\n                return 0;\n        }\n        isinstance = PyObject_IsInstance(obj, (PyObject*)BinOp_type);\n        if (isinstance == -1) {\n                return 1;\n        }\n        if (isinstance) {\n                expr_ty left;\n                operator_ty op;\n                expr_ty right;\n\n                if (PyObject_HasAttrString(obj, \"left\")) {\n                        int res;\n                        tmp = PyObject_GetAttrString(obj, \"left\");\n                        if (tmp == NULL) goto failed;\n                        res = obj2ast_expr(tmp, &left, arena);\n                        if (res != 0) goto failed;\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        PyErr_SetString(PyExc_TypeError, \"required field \\\"left\\\" missing from BinOp\");\n                        return 1;\n                }\n                if (PyObject_HasAttrString(obj, \"op\")) {\n                        int res;\n                        tmp = PyObject_GetAttrString(obj, \"op\");\n                        if (tmp == NULL) goto failed;\n                        res = obj2ast_operator(tmp, &op, arena);\n                        if (res != 0) goto failed;\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        PyErr_SetString(PyExc_TypeError, \"required field \\\"op\\\" missing from BinOp\");\n                        return 1;\n                }\n                if (PyObject_HasAttrString(obj, \"right\")) {\n                        int res;\n                        tmp = PyObject_GetAttrString(obj, \"right\");\n                        if (tmp == NULL) goto failed;\n                        res = obj2ast_expr(tmp, &right, arena);\n                        if (res != 0) goto failed;\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        PyErr_SetString(PyExc_TypeError, \"required field \\\"right\\\" missing from BinOp\");\n                        return 1;\n                }\n                *out = BinOp(left, op, right, lineno, col_offset, arena);\n                if (*out == NULL) goto failed;\n                return 0;\n        }\n        isinstance = PyObject_IsInstance(obj, (PyObject*)UnaryOp_type);\n        if (isinstance == -1) {\n                return 1;\n        }\n        if (isinstance) {\n                unaryop_ty op;\n                expr_ty operand;\n\n                if (PyObject_HasAttrString(obj, \"op\")) {\n                        int res;\n                        tmp = PyObject_GetAttrString(obj, \"op\");\n                        if (tmp == NULL) goto failed;\n                        res = obj2ast_unaryop(tmp, &op, arena);\n                        if (res != 0) goto failed;\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        PyErr_SetString(PyExc_TypeError, \"required field \\\"op\\\" missing from UnaryOp\");\n                        return 1;\n                }\n                if (PyObject_HasAttrString(obj, \"operand\")) {\n                        int res;\n                        tmp = PyObject_GetAttrString(obj, \"operand\");\n                        if (tmp == NULL) goto failed;\n                        res = obj2ast_expr(tmp, &operand, arena);\n                        if (res != 0) goto failed;\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        PyErr_SetString(PyExc_TypeError, \"required field \\\"operand\\\" missing from UnaryOp\");\n                        return 1;\n                }\n                *out = UnaryOp(op, operand, lineno, col_offset, arena);\n                if (*out == NULL) goto failed;\n                return 0;\n        }\n        isinstance = PyObject_IsInstance(obj, (PyObject*)Lambda_type);\n        if (isinstance == -1) {\n                return 1;\n        }\n        if (isinstance) {\n                arguments_ty args;\n                expr_ty body;\n\n                if (PyObject_HasAttrString(obj, \"args\")) {\n                        int res;\n                        tmp = PyObject_GetAttrString(obj, \"args\");\n                        if (tmp == NULL) goto failed;\n                        res = obj2ast_arguments(tmp, &args, arena);\n                        if (res != 0) goto failed;\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        PyErr_SetString(PyExc_TypeError, \"required field \\\"args\\\" missing from Lambda\");\n                        return 1;\n                }\n                if (PyObject_HasAttrString(obj, \"body\")) {\n                        int res;\n                        tmp = PyObject_GetAttrString(obj, \"body\");\n                        if (tmp == NULL) goto failed;\n                        res = obj2ast_expr(tmp, &body, arena);\n                        if (res != 0) goto failed;\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        PyErr_SetString(PyExc_TypeError, \"required field \\\"body\\\" missing from Lambda\");\n                        return 1;\n                }\n                *out = Lambda(args, body, lineno, col_offset, arena);\n                if (*out == NULL) goto failed;\n                return 0;\n        }\n        isinstance = PyObject_IsInstance(obj, (PyObject*)IfExp_type);\n        if (isinstance == -1) {\n                return 1;\n        }\n        if (isinstance) {\n                expr_ty test;\n                expr_ty body;\n                expr_ty orelse;\n\n                if (PyObject_HasAttrString(obj, \"test\")) {\n                        int res;\n                        tmp = PyObject_GetAttrString(obj, \"test\");\n                        if (tmp == NULL) goto failed;\n                        res = obj2ast_expr(tmp, &test, arena);\n                        if (res != 0) goto failed;\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        PyErr_SetString(PyExc_TypeError, \"required field \\\"test\\\" missing from IfExp\");\n                        return 1;\n                }\n                if (PyObject_HasAttrString(obj, \"body\")) {\n                        int res;\n                        tmp = PyObject_GetAttrString(obj, \"body\");\n                        if (tmp == NULL) goto failed;\n                        res = obj2ast_expr(tmp, &body, arena);\n                        if (res != 0) goto failed;\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        PyErr_SetString(PyExc_TypeError, \"required field \\\"body\\\" missing from IfExp\");\n                        return 1;\n                }\n                if (PyObject_HasAttrString(obj, \"orelse\")) {\n                        int res;\n                        tmp = PyObject_GetAttrString(obj, \"orelse\");\n                        if (tmp == NULL) goto failed;\n                        res = obj2ast_expr(tmp, &orelse, arena);\n                        if (res != 0) goto failed;\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        PyErr_SetString(PyExc_TypeError, \"required field \\\"orelse\\\" missing from IfExp\");\n                        return 1;\n                }\n                *out = IfExp(test, body, orelse, lineno, col_offset, arena);\n                if (*out == NULL) goto failed;\n                return 0;\n        }\n        isinstance = PyObject_IsInstance(obj, (PyObject*)Dict_type);\n        if (isinstance == -1) {\n                return 1;\n        }\n        if (isinstance) {\n                asdl_seq* keys;\n                asdl_seq* values;\n\n                if (PyObject_HasAttrString(obj, \"keys\")) {\n                        int res;\n                        Py_ssize_t len;\n                        Py_ssize_t i;\n                        tmp = PyObject_GetAttrString(obj, \"keys\");\n                        if (tmp == NULL) goto failed;\n                        if (!PyList_Check(tmp)) {\n                                PyErr_Format(PyExc_TypeError, \"Dict field \\\"keys\\\" must be a list, not a %.200s\", tmp->ob_type->tp_name);\n                                goto failed;\n                        }\n                        len = PyList_GET_SIZE(tmp);\n                        keys = asdl_seq_new(len, arena);\n                        if (keys == NULL) goto failed;\n                        for (i = 0; i < len; i++) {\n                                expr_ty value;\n                                res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena);\n                                if (res != 0) goto failed;\n                                asdl_seq_SET(keys, i, value);\n                        }\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        PyErr_SetString(PyExc_TypeError, \"required field \\\"keys\\\" missing from Dict\");\n                        return 1;\n                }\n                if (PyObject_HasAttrString(obj, \"values\")) {\n                        int res;\n                        Py_ssize_t len;\n                        Py_ssize_t i;\n                        tmp = PyObject_GetAttrString(obj, \"values\");\n                        if (tmp == NULL) goto failed;\n                        if (!PyList_Check(tmp)) {\n                                PyErr_Format(PyExc_TypeError, \"Dict field \\\"values\\\" must be a list, not a %.200s\", tmp->ob_type->tp_name);\n                                goto failed;\n                        }\n                        len = PyList_GET_SIZE(tmp);\n                        values = asdl_seq_new(len, arena);\n                        if (values == NULL) goto failed;\n                        for (i = 0; i < len; i++) {\n                                expr_ty value;\n                                res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena);\n                                if (res != 0) goto failed;\n                                asdl_seq_SET(values, i, value);\n                        }\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        PyErr_SetString(PyExc_TypeError, \"required field \\\"values\\\" missing from Dict\");\n                        return 1;\n                }\n                *out = Dict(keys, values, lineno, col_offset, arena);\n                if (*out == NULL) goto failed;\n                return 0;\n        }\n        isinstance = PyObject_IsInstance(obj, (PyObject*)Set_type);\n        if (isinstance == -1) {\n                return 1;\n        }\n        if (isinstance) {\n                asdl_seq* elts;\n\n                if (PyObject_HasAttrString(obj, \"elts\")) {\n                        int res;\n                        Py_ssize_t len;\n                        Py_ssize_t i;\n                        tmp = PyObject_GetAttrString(obj, \"elts\");\n                        if (tmp == NULL) goto failed;\n                        if (!PyList_Check(tmp)) {\n                                PyErr_Format(PyExc_TypeError, \"Set field \\\"elts\\\" must be a list, not a %.200s\", tmp->ob_type->tp_name);\n                                goto failed;\n                        }\n                        len = PyList_GET_SIZE(tmp);\n                        elts = asdl_seq_new(len, arena);\n                        if (elts == NULL) goto failed;\n                        for (i = 0; i < len; i++) {\n                                expr_ty value;\n                                res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena);\n                                if (res != 0) goto failed;\n                                asdl_seq_SET(elts, i, value);\n                        }\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        PyErr_SetString(PyExc_TypeError, \"required field \\\"elts\\\" missing from Set\");\n                        return 1;\n                }\n                *out = Set(elts, lineno, col_offset, arena);\n                if (*out == NULL) goto failed;\n                return 0;\n        }\n        isinstance = PyObject_IsInstance(obj, (PyObject*)ListComp_type);\n        if (isinstance == -1) {\n                return 1;\n        }\n        if (isinstance) {\n                expr_ty elt;\n                asdl_seq* generators;\n\n                if (PyObject_HasAttrString(obj, \"elt\")) {\n                        int res;\n                        tmp = PyObject_GetAttrString(obj, \"elt\");\n                        if (tmp == NULL) goto failed;\n                        res = obj2ast_expr(tmp, &elt, arena);\n                        if (res != 0) goto failed;\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        PyErr_SetString(PyExc_TypeError, \"required field \\\"elt\\\" missing from ListComp\");\n                        return 1;\n                }\n                if (PyObject_HasAttrString(obj, \"generators\")) {\n                        int res;\n                        Py_ssize_t len;\n                        Py_ssize_t i;\n                        tmp = PyObject_GetAttrString(obj, \"generators\");\n                        if (tmp == NULL) goto failed;\n                        if (!PyList_Check(tmp)) {\n                                PyErr_Format(PyExc_TypeError, \"ListComp field \\\"generators\\\" must be a list, not a %.200s\", tmp->ob_type->tp_name);\n                                goto failed;\n                        }\n                        len = PyList_GET_SIZE(tmp);\n                        generators = asdl_seq_new(len, arena);\n                        if (generators == NULL) goto failed;\n                        for (i = 0; i < len; i++) {\n                                comprehension_ty value;\n                                res = obj2ast_comprehension(PyList_GET_ITEM(tmp, i), &value, arena);\n                                if (res != 0) goto failed;\n                                asdl_seq_SET(generators, i, value);\n                        }\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        PyErr_SetString(PyExc_TypeError, \"required field \\\"generators\\\" missing from ListComp\");\n                        return 1;\n                }\n                *out = ListComp(elt, generators, lineno, col_offset, arena);\n                if (*out == NULL) goto failed;\n                return 0;\n        }\n        isinstance = PyObject_IsInstance(obj, (PyObject*)SetComp_type);\n        if (isinstance == -1) {\n                return 1;\n        }\n        if (isinstance) {\n                expr_ty elt;\n                asdl_seq* generators;\n\n                if (PyObject_HasAttrString(obj, \"elt\")) {\n                        int res;\n                        tmp = PyObject_GetAttrString(obj, \"elt\");\n                        if (tmp == NULL) goto failed;\n                        res = obj2ast_expr(tmp, &elt, arena);\n                        if (res != 0) goto failed;\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        PyErr_SetString(PyExc_TypeError, \"required field \\\"elt\\\" missing from SetComp\");\n                        return 1;\n                }\n                if (PyObject_HasAttrString(obj, \"generators\")) {\n                        int res;\n                        Py_ssize_t len;\n                        Py_ssize_t i;\n                        tmp = PyObject_GetAttrString(obj, \"generators\");\n                        if (tmp == NULL) goto failed;\n                        if (!PyList_Check(tmp)) {\n                                PyErr_Format(PyExc_TypeError, \"SetComp field \\\"generators\\\" must be a list, not a %.200s\", tmp->ob_type->tp_name);\n                                goto failed;\n                        }\n                        len = PyList_GET_SIZE(tmp);\n                        generators = asdl_seq_new(len, arena);\n                        if (generators == NULL) goto failed;\n                        for (i = 0; i < len; i++) {\n                                comprehension_ty value;\n                                res = obj2ast_comprehension(PyList_GET_ITEM(tmp, i), &value, arena);\n                                if (res != 0) goto failed;\n                                asdl_seq_SET(generators, i, value);\n                        }\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        PyErr_SetString(PyExc_TypeError, \"required field \\\"generators\\\" missing from SetComp\");\n                        return 1;\n                }\n                *out = SetComp(elt, generators, lineno, col_offset, arena);\n                if (*out == NULL) goto failed;\n                return 0;\n        }\n        isinstance = PyObject_IsInstance(obj, (PyObject*)DictComp_type);\n        if (isinstance == -1) {\n                return 1;\n        }\n        if (isinstance) {\n                expr_ty key;\n                expr_ty value;\n                asdl_seq* generators;\n\n                if (PyObject_HasAttrString(obj, \"key\")) {\n                        int res;\n                        tmp = PyObject_GetAttrString(obj, \"key\");\n                        if (tmp == NULL) goto failed;\n                        res = obj2ast_expr(tmp, &key, arena);\n                        if (res != 0) goto failed;\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        PyErr_SetString(PyExc_TypeError, \"required field \\\"key\\\" missing from DictComp\");\n                        return 1;\n                }\n                if (PyObject_HasAttrString(obj, \"value\")) {\n                        int res;\n                        tmp = PyObject_GetAttrString(obj, \"value\");\n                        if (tmp == NULL) goto failed;\n                        res = obj2ast_expr(tmp, &value, arena);\n                        if (res != 0) goto failed;\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        PyErr_SetString(PyExc_TypeError, \"required field \\\"value\\\" missing from DictComp\");\n                        return 1;\n                }\n                if (PyObject_HasAttrString(obj, \"generators\")) {\n                        int res;\n                        Py_ssize_t len;\n                        Py_ssize_t i;\n                        tmp = PyObject_GetAttrString(obj, \"generators\");\n                        if (tmp == NULL) goto failed;\n                        if (!PyList_Check(tmp)) {\n                                PyErr_Format(PyExc_TypeError, \"DictComp field \\\"generators\\\" must be a list, not a %.200s\", tmp->ob_type->tp_name);\n                                goto failed;\n                        }\n                        len = PyList_GET_SIZE(tmp);\n                        generators = asdl_seq_new(len, arena);\n                        if (generators == NULL) goto failed;\n                        for (i = 0; i < len; i++) {\n                                comprehension_ty value;\n                                res = obj2ast_comprehension(PyList_GET_ITEM(tmp, i), &value, arena);\n                                if (res != 0) goto failed;\n                                asdl_seq_SET(generators, i, value);\n                        }\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        PyErr_SetString(PyExc_TypeError, \"required field \\\"generators\\\" missing from DictComp\");\n                        return 1;\n                }\n                *out = DictComp(key, value, generators, lineno, col_offset, arena);\n                if (*out == NULL) goto failed;\n                return 0;\n        }\n        isinstance = PyObject_IsInstance(obj, (PyObject*)GeneratorExp_type);\n        if (isinstance == -1) {\n                return 1;\n        }\n        if (isinstance) {\n                expr_ty elt;\n                asdl_seq* generators;\n\n                if (PyObject_HasAttrString(obj, \"elt\")) {\n                        int res;\n                        tmp = PyObject_GetAttrString(obj, \"elt\");\n                        if (tmp == NULL) goto failed;\n                        res = obj2ast_expr(tmp, &elt, arena);\n                        if (res != 0) goto failed;\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        PyErr_SetString(PyExc_TypeError, \"required field \\\"elt\\\" missing from GeneratorExp\");\n                        return 1;\n                }\n                if (PyObject_HasAttrString(obj, \"generators\")) {\n                        int res;\n                        Py_ssize_t len;\n                        Py_ssize_t i;\n                        tmp = PyObject_GetAttrString(obj, \"generators\");\n                        if (tmp == NULL) goto failed;\n                        if (!PyList_Check(tmp)) {\n                                PyErr_Format(PyExc_TypeError, \"GeneratorExp field \\\"generators\\\" must be a list, not a %.200s\", tmp->ob_type->tp_name);\n                                goto failed;\n                        }\n                        len = PyList_GET_SIZE(tmp);\n                        generators = asdl_seq_new(len, arena);\n                        if (generators == NULL) goto failed;\n                        for (i = 0; i < len; i++) {\n                                comprehension_ty value;\n                                res = obj2ast_comprehension(PyList_GET_ITEM(tmp, i), &value, arena);\n                                if (res != 0) goto failed;\n                                asdl_seq_SET(generators, i, value);\n                        }\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        PyErr_SetString(PyExc_TypeError, \"required field \\\"generators\\\" missing from GeneratorExp\");\n                        return 1;\n                }\n                *out = GeneratorExp(elt, generators, lineno, col_offset, arena);\n                if (*out == NULL) goto failed;\n                return 0;\n        }\n        isinstance = PyObject_IsInstance(obj, (PyObject*)Yield_type);\n        if (isinstance == -1) {\n                return 1;\n        }\n        if (isinstance) {\n                expr_ty value;\n\n                if (PyObject_HasAttrString(obj, \"value\")) {\n                        int res;\n                        tmp = PyObject_GetAttrString(obj, \"value\");\n                        if (tmp == NULL) goto failed;\n                        res = obj2ast_expr(tmp, &value, arena);\n                        if (res != 0) goto failed;\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        value = NULL;\n                }\n                *out = Yield(value, lineno, col_offset, arena);\n                if (*out == NULL) goto failed;\n                return 0;\n        }\n        isinstance = PyObject_IsInstance(obj, (PyObject*)Compare_type);\n        if (isinstance == -1) {\n                return 1;\n        }\n        if (isinstance) {\n                expr_ty left;\n                asdl_int_seq* ops;\n                asdl_seq* comparators;\n\n                if (PyObject_HasAttrString(obj, \"left\")) {\n                        int res;\n                        tmp = PyObject_GetAttrString(obj, \"left\");\n                        if (tmp == NULL) goto failed;\n                        res = obj2ast_expr(tmp, &left, arena);\n                        if (res != 0) goto failed;\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        PyErr_SetString(PyExc_TypeError, \"required field \\\"left\\\" missing from Compare\");\n                        return 1;\n                }\n                if (PyObject_HasAttrString(obj, \"ops\")) {\n                        int res;\n                        Py_ssize_t len;\n                        Py_ssize_t i;\n                        tmp = PyObject_GetAttrString(obj, \"ops\");\n                        if (tmp == NULL) goto failed;\n                        if (!PyList_Check(tmp)) {\n                                PyErr_Format(PyExc_TypeError, \"Compare field \\\"ops\\\" must be a list, not a %.200s\", tmp->ob_type->tp_name);\n                                goto failed;\n                        }\n                        len = PyList_GET_SIZE(tmp);\n                        ops = asdl_int_seq_new(len, arena);\n                        if (ops == NULL) goto failed;\n                        for (i = 0; i < len; i++) {\n                                cmpop_ty value;\n                                res = obj2ast_cmpop(PyList_GET_ITEM(tmp, i), &value, arena);\n                                if (res != 0) goto failed;\n                                asdl_seq_SET(ops, i, value);\n                        }\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        PyErr_SetString(PyExc_TypeError, \"required field \\\"ops\\\" missing from Compare\");\n                        return 1;\n                }\n                if (PyObject_HasAttrString(obj, \"comparators\")) {\n                        int res;\n                        Py_ssize_t len;\n                        Py_ssize_t i;\n                        tmp = PyObject_GetAttrString(obj, \"comparators\");\n                        if (tmp == NULL) goto failed;\n                        if (!PyList_Check(tmp)) {\n                                PyErr_Format(PyExc_TypeError, \"Compare field \\\"comparators\\\" must be a list, not a %.200s\", tmp->ob_type->tp_name);\n                                goto failed;\n                        }\n                        len = PyList_GET_SIZE(tmp);\n                        comparators = asdl_seq_new(len, arena);\n                        if (comparators == NULL) goto failed;\n                        for (i = 0; i < len; i++) {\n                                expr_ty value;\n                                res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena);\n                                if (res != 0) goto failed;\n                                asdl_seq_SET(comparators, i, value);\n                        }\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        PyErr_SetString(PyExc_TypeError, \"required field \\\"comparators\\\" missing from Compare\");\n                        return 1;\n                }\n                *out = Compare(left, ops, comparators, lineno, col_offset, arena);\n                if (*out == NULL) goto failed;\n                return 0;\n        }\n        isinstance = PyObject_IsInstance(obj, (PyObject*)Call_type);\n        if (isinstance == -1) {\n                return 1;\n        }\n        if (isinstance) {\n                expr_ty func;\n                asdl_seq* args;\n                asdl_seq* keywords;\n                expr_ty starargs;\n                expr_ty kwargs;\n\n                if (PyObject_HasAttrString(obj, \"func\")) {\n                        int res;\n                        tmp = PyObject_GetAttrString(obj, \"func\");\n                        if (tmp == NULL) goto failed;\n                        res = obj2ast_expr(tmp, &func, arena);\n                        if (res != 0) goto failed;\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        PyErr_SetString(PyExc_TypeError, \"required field \\\"func\\\" missing from Call\");\n                        return 1;\n                }\n                if (PyObject_HasAttrString(obj, \"args\")) {\n                        int res;\n                        Py_ssize_t len;\n                        Py_ssize_t i;\n                        tmp = PyObject_GetAttrString(obj, \"args\");\n                        if (tmp == NULL) goto failed;\n                        if (!PyList_Check(tmp)) {\n                                PyErr_Format(PyExc_TypeError, \"Call field \\\"args\\\" must be a list, not a %.200s\", tmp->ob_type->tp_name);\n                                goto failed;\n                        }\n                        len = PyList_GET_SIZE(tmp);\n                        args = asdl_seq_new(len, arena);\n                        if (args == NULL) goto failed;\n                        for (i = 0; i < len; i++) {\n                                expr_ty value;\n                                res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena);\n                                if (res != 0) goto failed;\n                                asdl_seq_SET(args, i, value);\n                        }\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        PyErr_SetString(PyExc_TypeError, \"required field \\\"args\\\" missing from Call\");\n                        return 1;\n                }\n                if (PyObject_HasAttrString(obj, \"keywords\")) {\n                        int res;\n                        Py_ssize_t len;\n                        Py_ssize_t i;\n                        tmp = PyObject_GetAttrString(obj, \"keywords\");\n                        if (tmp == NULL) goto failed;\n                        if (!PyList_Check(tmp)) {\n                                PyErr_Format(PyExc_TypeError, \"Call field \\\"keywords\\\" must be a list, not a %.200s\", tmp->ob_type->tp_name);\n                                goto failed;\n                        }\n                        len = PyList_GET_SIZE(tmp);\n                        keywords = asdl_seq_new(len, arena);\n                        if (keywords == NULL) goto failed;\n                        for (i = 0; i < len; i++) {\n                                keyword_ty value;\n                                res = obj2ast_keyword(PyList_GET_ITEM(tmp, i), &value, arena);\n                                if (res != 0) goto failed;\n                                asdl_seq_SET(keywords, i, value);\n                        }\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        PyErr_SetString(PyExc_TypeError, \"required field \\\"keywords\\\" missing from Call\");\n                        return 1;\n                }\n                if (PyObject_HasAttrString(obj, \"starargs\")) {\n                        int res;\n                        tmp = PyObject_GetAttrString(obj, \"starargs\");\n                        if (tmp == NULL) goto failed;\n                        res = obj2ast_expr(tmp, &starargs, arena);\n                        if (res != 0) goto failed;\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        starargs = NULL;\n                }\n                if (PyObject_HasAttrString(obj, \"kwargs\")) {\n                        int res;\n                        tmp = PyObject_GetAttrString(obj, \"kwargs\");\n                        if (tmp == NULL) goto failed;\n                        res = obj2ast_expr(tmp, &kwargs, arena);\n                        if (res != 0) goto failed;\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        kwargs = NULL;\n                }\n                *out = Call(func, args, keywords, starargs, kwargs, lineno, col_offset, arena);\n                if (*out == NULL) goto failed;\n                return 0;\n        }\n        isinstance = PyObject_IsInstance(obj, (PyObject*)Repr_type);\n        if (isinstance == -1) {\n                return 1;\n        }\n        if (isinstance) {\n                expr_ty value;\n\n                if (PyObject_HasAttrString(obj, \"value\")) {\n                        int res;\n                        tmp = PyObject_GetAttrString(obj, \"value\");\n                        if (tmp == NULL) goto failed;\n                        res = obj2ast_expr(tmp, &value, arena);\n                        if (res != 0) goto failed;\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        PyErr_SetString(PyExc_TypeError, \"required field \\\"value\\\" missing from Repr\");\n                        return 1;\n                }\n                *out = Repr(value, lineno, col_offset, arena);\n                if (*out == NULL) goto failed;\n                return 0;\n        }\n        isinstance = PyObject_IsInstance(obj, (PyObject*)Num_type);\n        if (isinstance == -1) {\n                return 1;\n        }\n        if (isinstance) {\n                object n;\n\n                if (PyObject_HasAttrString(obj, \"n\")) {\n                        int res;\n                        tmp = PyObject_GetAttrString(obj, \"n\");\n                        if (tmp == NULL) goto failed;\n                        res = obj2ast_object(tmp, &n, arena);\n                        if (res != 0) goto failed;\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        PyErr_SetString(PyExc_TypeError, \"required field \\\"n\\\" missing from Num\");\n                        return 1;\n                }\n                *out = Num(n, lineno, col_offset, arena);\n                if (*out == NULL) goto failed;\n                return 0;\n        }\n        isinstance = PyObject_IsInstance(obj, (PyObject*)Str_type);\n        if (isinstance == -1) {\n                return 1;\n        }\n        if (isinstance) {\n                string s;\n                string kind;\n\n                if (PyObject_HasAttrString(obj, \"s\")) {\n                        int res;\n                        tmp = PyObject_GetAttrString(obj, \"s\");\n                        if (tmp == NULL) goto failed;\n                        res = obj2ast_string(tmp, &s, arena);\n                        if (res != 0) goto failed;\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        PyErr_SetString(PyExc_TypeError, \"required field \\\"s\\\" missing from Str\");\n                        return 1;\n                }\n                if (PyObject_HasAttrString(obj, \"kind\")) {\n                        int res;\n                        tmp = PyObject_GetAttrString(obj, \"kind\");\n                        if (tmp == NULL) goto failed;\n                        res = obj2ast_string(tmp, &kind, arena);\n                        if (res != 0) goto failed;\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        PyErr_SetString(PyExc_TypeError, \"required field \\\"kind\\\" missing from Str\");\n                        return 1;\n                }\n                *out = Str(s, kind, lineno, col_offset, arena);\n                if (*out == NULL) goto failed;\n                return 0;\n        }\n        isinstance = PyObject_IsInstance(obj, (PyObject*)Attribute_type);\n        if (isinstance == -1) {\n                return 1;\n        }\n        if (isinstance) {\n                expr_ty value;\n                identifier attr;\n                expr_context_ty ctx;\n\n                if (PyObject_HasAttrString(obj, \"value\")) {\n                        int res;\n                        tmp = PyObject_GetAttrString(obj, \"value\");\n                        if (tmp == NULL) goto failed;\n                        res = obj2ast_expr(tmp, &value, arena);\n                        if (res != 0) goto failed;\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        PyErr_SetString(PyExc_TypeError, \"required field \\\"value\\\" missing from Attribute\");\n                        return 1;\n                }\n                if (PyObject_HasAttrString(obj, \"attr\")) {\n                        int res;\n                        tmp = PyObject_GetAttrString(obj, \"attr\");\n                        if (tmp == NULL) goto failed;\n                        res = obj2ast_identifier(tmp, &attr, arena);\n                        if (res != 0) goto failed;\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        PyErr_SetString(PyExc_TypeError, \"required field \\\"attr\\\" missing from Attribute\");\n                        return 1;\n                }\n                if (PyObject_HasAttrString(obj, \"ctx\")) {\n                        int res;\n                        tmp = PyObject_GetAttrString(obj, \"ctx\");\n                        if (tmp == NULL) goto failed;\n                        res = obj2ast_expr_context(tmp, &ctx, arena);\n                        if (res != 0) goto failed;\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        PyErr_SetString(PyExc_TypeError, \"required field \\\"ctx\\\" missing from Attribute\");\n                        return 1;\n                }\n                *out = Attribute(value, attr, ctx, lineno, col_offset, arena);\n                if (*out == NULL) goto failed;\n                return 0;\n        }\n        isinstance = PyObject_IsInstance(obj, (PyObject*)Subscript_type);\n        if (isinstance == -1) {\n                return 1;\n        }\n        if (isinstance) {\n                expr_ty value;\n                slice_ty slice;\n                expr_context_ty ctx;\n\n                if (PyObject_HasAttrString(obj, \"value\")) {\n                        int res;\n                        tmp = PyObject_GetAttrString(obj, \"value\");\n                        if (tmp == NULL) goto failed;\n                        res = obj2ast_expr(tmp, &value, arena);\n                        if (res != 0) goto failed;\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        PyErr_SetString(PyExc_TypeError, \"required field \\\"value\\\" missing from Subscript\");\n                        return 1;\n                }\n                if (PyObject_HasAttrString(obj, \"slice\")) {\n                        int res;\n                        tmp = PyObject_GetAttrString(obj, \"slice\");\n                        if (tmp == NULL) goto failed;\n                        res = obj2ast_slice(tmp, &slice, arena);\n                        if (res != 0) goto failed;\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        PyErr_SetString(PyExc_TypeError, \"required field \\\"slice\\\" missing from Subscript\");\n                        return 1;\n                }\n                if (PyObject_HasAttrString(obj, \"ctx\")) {\n                        int res;\n                        tmp = PyObject_GetAttrString(obj, \"ctx\");\n                        if (tmp == NULL) goto failed;\n                        res = obj2ast_expr_context(tmp, &ctx, arena);\n                        if (res != 0) goto failed;\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        PyErr_SetString(PyExc_TypeError, \"required field \\\"ctx\\\" missing from Subscript\");\n                        return 1;\n                }\n                *out = Subscript(value, slice, ctx, lineno, col_offset, arena);\n                if (*out == NULL) goto failed;\n                return 0;\n        }\n        isinstance = PyObject_IsInstance(obj, (PyObject*)Name_type);\n        if (isinstance == -1) {\n                return 1;\n        }\n        if (isinstance) {\n                identifier id;\n                expr_context_ty ctx;\n\n                if (PyObject_HasAttrString(obj, \"id\")) {\n                        int res;\n                        tmp = PyObject_GetAttrString(obj, \"id\");\n                        if (tmp == NULL) goto failed;\n                        res = obj2ast_identifier(tmp, &id, arena);\n                        if (res != 0) goto failed;\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        PyErr_SetString(PyExc_TypeError, \"required field \\\"id\\\" missing from Name\");\n                        return 1;\n                }\n                if (PyObject_HasAttrString(obj, \"ctx\")) {\n                        int res;\n                        tmp = PyObject_GetAttrString(obj, \"ctx\");\n                        if (tmp == NULL) goto failed;\n                        res = obj2ast_expr_context(tmp, &ctx, arena);\n                        if (res != 0) goto failed;\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        PyErr_SetString(PyExc_TypeError, \"required field \\\"ctx\\\" missing from Name\");\n                        return 1;\n                }\n                *out = Name(id, ctx, lineno, col_offset, arena);\n                if (*out == NULL) goto failed;\n                return 0;\n        }\n        isinstance = PyObject_IsInstance(obj, (PyObject*)List_type);\n        if (isinstance == -1) {\n                return 1;\n        }\n        if (isinstance) {\n                asdl_seq* elts;\n                expr_context_ty ctx;\n\n                if (PyObject_HasAttrString(obj, \"elts\")) {\n                        int res;\n                        Py_ssize_t len;\n                        Py_ssize_t i;\n                        tmp = PyObject_GetAttrString(obj, \"elts\");\n                        if (tmp == NULL) goto failed;\n                        if (!PyList_Check(tmp)) {\n                                PyErr_Format(PyExc_TypeError, \"List field \\\"elts\\\" must be a list, not a %.200s\", tmp->ob_type->tp_name);\n                                goto failed;\n                        }\n                        len = PyList_GET_SIZE(tmp);\n                        elts = asdl_seq_new(len, arena);\n                        if (elts == NULL) goto failed;\n                        for (i = 0; i < len; i++) {\n                                expr_ty value;\n                                res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena);\n                                if (res != 0) goto failed;\n                                asdl_seq_SET(elts, i, value);\n                        }\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        PyErr_SetString(PyExc_TypeError, \"required field \\\"elts\\\" missing from List\");\n                        return 1;\n                }\n                if (PyObject_HasAttrString(obj, \"ctx\")) {\n                        int res;\n                        tmp = PyObject_GetAttrString(obj, \"ctx\");\n                        if (tmp == NULL) goto failed;\n                        res = obj2ast_expr_context(tmp, &ctx, arena);\n                        if (res != 0) goto failed;\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        PyErr_SetString(PyExc_TypeError, \"required field \\\"ctx\\\" missing from List\");\n                        return 1;\n                }\n                *out = List(elts, ctx, lineno, col_offset, arena);\n                if (*out == NULL) goto failed;\n                return 0;\n        }\n        isinstance = PyObject_IsInstance(obj, (PyObject*)Tuple_type);\n        if (isinstance == -1) {\n                return 1;\n        }\n        if (isinstance) {\n                asdl_seq* elts;\n                expr_context_ty ctx;\n\n                if (PyObject_HasAttrString(obj, \"elts\")) {\n                        int res;\n                        Py_ssize_t len;\n                        Py_ssize_t i;\n                        tmp = PyObject_GetAttrString(obj, \"elts\");\n                        if (tmp == NULL) goto failed;\n                        if (!PyList_Check(tmp)) {\n                                PyErr_Format(PyExc_TypeError, \"Tuple field \\\"elts\\\" must be a list, not a %.200s\", tmp->ob_type->tp_name);\n                                goto failed;\n                        }\n                        len = PyList_GET_SIZE(tmp);\n                        elts = asdl_seq_new(len, arena);\n                        if (elts == NULL) goto failed;\n                        for (i = 0; i < len; i++) {\n                                expr_ty value;\n                                res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena);\n                                if (res != 0) goto failed;\n                                asdl_seq_SET(elts, i, value);\n                        }\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        PyErr_SetString(PyExc_TypeError, \"required field \\\"elts\\\" missing from Tuple\");\n                        return 1;\n                }\n                if (PyObject_HasAttrString(obj, \"ctx\")) {\n                        int res;\n                        tmp = PyObject_GetAttrString(obj, \"ctx\");\n                        if (tmp == NULL) goto failed;\n                        res = obj2ast_expr_context(tmp, &ctx, arena);\n                        if (res != 0) goto failed;\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        PyErr_SetString(PyExc_TypeError, \"required field \\\"ctx\\\" missing from Tuple\");\n                        return 1;\n                }\n                *out = Tuple(elts, ctx, lineno, col_offset, arena);\n                if (*out == NULL) goto failed;\n                return 0;\n        }\n\n        tmp = PyObject_Repr(obj);\n        if (tmp == NULL) goto failed;\n        PyErr_Format(PyExc_TypeError, \"expected some sort of expr, but got %.400s\", _PyUnicode_AsString(tmp));\nfailed:\n        Py_XDECREF(tmp);\n        return 1;\n}\n\nint\nobj2ast_expr_context(PyObject* obj, expr_context_ty* out, PyArena* arena)\n{\n        PyObject* tmp = NULL;\n        int isinstance;\n\n        isinstance = PyObject_IsInstance(obj, (PyObject *)Load_type);\n        if (isinstance == -1) {\n                return 1;\n        }\n        if (isinstance) {\n                *out = Load;\n                return 0;\n        }\n        isinstance = PyObject_IsInstance(obj, (PyObject *)Store_type);\n        if (isinstance == -1) {\n                return 1;\n        }\n        if (isinstance) {\n                *out = Store;\n                return 0;\n        }\n        isinstance = PyObject_IsInstance(obj, (PyObject *)Del_type);\n        if (isinstance == -1) {\n                return 1;\n        }\n        if (isinstance) {\n                *out = Del;\n                return 0;\n        }\n        isinstance = PyObject_IsInstance(obj, (PyObject *)AugLoad_type);\n        if (isinstance == -1) {\n                return 1;\n        }\n        if (isinstance) {\n                *out = AugLoad;\n                return 0;\n        }\n        isinstance = PyObject_IsInstance(obj, (PyObject *)AugStore_type);\n        if (isinstance == -1) {\n                return 1;\n        }\n        if (isinstance) {\n                *out = AugStore;\n                return 0;\n        }\n        isinstance = PyObject_IsInstance(obj, (PyObject *)Param_type);\n        if (isinstance == -1) {\n                return 1;\n        }\n        if (isinstance) {\n                *out = Param;\n                return 0;\n        }\n\n        tmp = PyObject_Repr(obj);\n        if (tmp == NULL) goto failed;\n        PyErr_Format(PyExc_TypeError, \"expected some sort of expr_context, but got %.400s\", _PyUnicode_AsString(tmp));\nfailed:\n        Py_XDECREF(tmp);\n        return 1;\n}\n\nint\nobj2ast_slice(PyObject* obj, slice_ty* out, PyArena* arena)\n{\n        PyObject* tmp = NULL;\n        int isinstance;\n\n\n        if (obj == Py_None) {\n                *out = NULL;\n                return 0;\n        }\n        isinstance = PyObject_IsInstance(obj, (PyObject*)Ellipsis_type);\n        if (isinstance == -1) {\n                return 1;\n        }\n        if (isinstance) {\n\n                *out = Ellipsis(arena);\n                if (*out == NULL) goto failed;\n                return 0;\n        }\n        isinstance = PyObject_IsInstance(obj, (PyObject*)Slice_type);\n        if (isinstance == -1) {\n                return 1;\n        }\n        if (isinstance) {\n                expr_ty lower;\n                expr_ty upper;\n                expr_ty step;\n\n                if (PyObject_HasAttrString(obj, \"lower\")) {\n                        int res;\n                        tmp = PyObject_GetAttrString(obj, \"lower\");\n                        if (tmp == NULL) goto failed;\n                        res = obj2ast_expr(tmp, &lower, arena);\n                        if (res != 0) goto failed;\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        lower = NULL;\n                }\n                if (PyObject_HasAttrString(obj, \"upper\")) {\n                        int res;\n                        tmp = PyObject_GetAttrString(obj, \"upper\");\n                        if (tmp == NULL) goto failed;\n                        res = obj2ast_expr(tmp, &upper, arena);\n                        if (res != 0) goto failed;\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        upper = NULL;\n                }\n                if (PyObject_HasAttrString(obj, \"step\")) {\n                        int res;\n                        tmp = PyObject_GetAttrString(obj, \"step\");\n                        if (tmp == NULL) goto failed;\n                        res = obj2ast_expr(tmp, &step, arena);\n                        if (res != 0) goto failed;\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        step = NULL;\n                }\n                *out = Slice(lower, upper, step, arena);\n                if (*out == NULL) goto failed;\n                return 0;\n        }\n        isinstance = PyObject_IsInstance(obj, (PyObject*)ExtSlice_type);\n        if (isinstance == -1) {\n                return 1;\n        }\n        if (isinstance) {\n                asdl_seq* dims;\n\n                if (PyObject_HasAttrString(obj, \"dims\")) {\n                        int res;\n                        Py_ssize_t len;\n                        Py_ssize_t i;\n                        tmp = PyObject_GetAttrString(obj, \"dims\");\n                        if (tmp == NULL) goto failed;\n                        if (!PyList_Check(tmp)) {\n                                PyErr_Format(PyExc_TypeError, \"ExtSlice field \\\"dims\\\" must be a list, not a %.200s\", tmp->ob_type->tp_name);\n                                goto failed;\n                        }\n                        len = PyList_GET_SIZE(tmp);\n                        dims = asdl_seq_new(len, arena);\n                        if (dims == NULL) goto failed;\n                        for (i = 0; i < len; i++) {\n                                slice_ty value;\n                                res = obj2ast_slice(PyList_GET_ITEM(tmp, i), &value, arena);\n                                if (res != 0) goto failed;\n                                asdl_seq_SET(dims, i, value);\n                        }\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        PyErr_SetString(PyExc_TypeError, \"required field \\\"dims\\\" missing from ExtSlice\");\n                        return 1;\n                }\n                *out = ExtSlice(dims, arena);\n                if (*out == NULL) goto failed;\n                return 0;\n        }\n        isinstance = PyObject_IsInstance(obj, (PyObject*)Index_type);\n        if (isinstance == -1) {\n                return 1;\n        }\n        if (isinstance) {\n                expr_ty value;\n\n                if (PyObject_HasAttrString(obj, \"value\")) {\n                        int res;\n                        tmp = PyObject_GetAttrString(obj, \"value\");\n                        if (tmp == NULL) goto failed;\n                        res = obj2ast_expr(tmp, &value, arena);\n                        if (res != 0) goto failed;\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        PyErr_SetString(PyExc_TypeError, \"required field \\\"value\\\" missing from Index\");\n                        return 1;\n                }\n                *out = Index(value, arena);\n                if (*out == NULL) goto failed;\n                return 0;\n        }\n\n        tmp = PyObject_Repr(obj);\n        if (tmp == NULL) goto failed;\n        PyErr_Format(PyExc_TypeError, \"expected some sort of slice, but got %.400s\", _PyUnicode_AsString(tmp));\nfailed:\n        Py_XDECREF(tmp);\n        return 1;\n}\n\nint\nobj2ast_boolop(PyObject* obj, boolop_ty* out, PyArena* arena)\n{\n        PyObject* tmp = NULL;\n        int isinstance;\n\n        isinstance = PyObject_IsInstance(obj, (PyObject *)And_type);\n        if (isinstance == -1) {\n                return 1;\n        }\n        if (isinstance) {\n                *out = And;\n                return 0;\n        }\n        isinstance = PyObject_IsInstance(obj, (PyObject *)Or_type);\n        if (isinstance == -1) {\n                return 1;\n        }\n        if (isinstance) {\n                *out = Or;\n                return 0;\n        }\n\n        tmp = PyObject_Repr(obj);\n        if (tmp == NULL) goto failed;\n        PyErr_Format(PyExc_TypeError, \"expected some sort of boolop, but got %.400s\", _PyUnicode_AsString(tmp));\nfailed:\n        Py_XDECREF(tmp);\n        return 1;\n}\n\nint\nobj2ast_operator(PyObject* obj, operator_ty* out, PyArena* arena)\n{\n        PyObject* tmp = NULL;\n        int isinstance;\n\n        isinstance = PyObject_IsInstance(obj, (PyObject *)Add_type);\n        if (isinstance == -1) {\n                return 1;\n        }\n        if (isinstance) {\n                *out = Add;\n                return 0;\n        }\n        isinstance = PyObject_IsInstance(obj, (PyObject *)Sub_type);\n        if (isinstance == -1) {\n                return 1;\n        }\n        if (isinstance) {\n                *out = Sub;\n                return 0;\n        }\n        isinstance = PyObject_IsInstance(obj, (PyObject *)Mult_type);\n        if (isinstance == -1) {\n                return 1;\n        }\n        if (isinstance) {\n                *out = Mult;\n                return 0;\n        }\n        isinstance = PyObject_IsInstance(obj, (PyObject *)Div_type);\n        if (isinstance == -1) {\n                return 1;\n        }\n        if (isinstance) {\n                *out = Div;\n                return 0;\n        }\n        isinstance = PyObject_IsInstance(obj, (PyObject *)Mod_type);\n        if (isinstance == -1) {\n                return 1;\n        }\n        if (isinstance) {\n                *out = Mod;\n                return 0;\n        }\n        isinstance = PyObject_IsInstance(obj, (PyObject *)Pow_type);\n        if (isinstance == -1) {\n                return 1;\n        }\n        if (isinstance) {\n                *out = Pow;\n                return 0;\n        }\n        isinstance = PyObject_IsInstance(obj, (PyObject *)LShift_type);\n        if (isinstance == -1) {\n                return 1;\n        }\n        if (isinstance) {\n                *out = LShift;\n                return 0;\n        }\n        isinstance = PyObject_IsInstance(obj, (PyObject *)RShift_type);\n        if (isinstance == -1) {\n                return 1;\n        }\n        if (isinstance) {\n                *out = RShift;\n                return 0;\n        }\n        isinstance = PyObject_IsInstance(obj, (PyObject *)BitOr_type);\n        if (isinstance == -1) {\n                return 1;\n        }\n        if (isinstance) {\n                *out = BitOr;\n                return 0;\n        }\n        isinstance = PyObject_IsInstance(obj, (PyObject *)BitXor_type);\n        if (isinstance == -1) {\n                return 1;\n        }\n        if (isinstance) {\n                *out = BitXor;\n                return 0;\n        }\n        isinstance = PyObject_IsInstance(obj, (PyObject *)BitAnd_type);\n        if (isinstance == -1) {\n                return 1;\n        }\n        if (isinstance) {\n                *out = BitAnd;\n                return 0;\n        }\n        isinstance = PyObject_IsInstance(obj, (PyObject *)FloorDiv_type);\n        if (isinstance == -1) {\n                return 1;\n        }\n        if (isinstance) {\n                *out = FloorDiv;\n                return 0;\n        }\n\n        tmp = PyObject_Repr(obj);\n        if (tmp == NULL) goto failed;\n        PyErr_Format(PyExc_TypeError, \"expected some sort of operator, but got %.400s\", _PyUnicode_AsString(tmp));\nfailed:\n        Py_XDECREF(tmp);\n        return 1;\n}\n\nint\nobj2ast_unaryop(PyObject* obj, unaryop_ty* out, PyArena* arena)\n{\n        PyObject* tmp = NULL;\n        int isinstance;\n\n        isinstance = PyObject_IsInstance(obj, (PyObject *)Invert_type);\n        if (isinstance == -1) {\n                return 1;\n        }\n        if (isinstance) {\n                *out = Invert;\n                return 0;\n        }\n        isinstance = PyObject_IsInstance(obj, (PyObject *)Not_type);\n        if (isinstance == -1) {\n                return 1;\n        }\n        if (isinstance) {\n                *out = Not;\n                return 0;\n        }\n        isinstance = PyObject_IsInstance(obj, (PyObject *)UAdd_type);\n        if (isinstance == -1) {\n                return 1;\n        }\n        if (isinstance) {\n                *out = UAdd;\n                return 0;\n        }\n        isinstance = PyObject_IsInstance(obj, (PyObject *)USub_type);\n        if (isinstance == -1) {\n                return 1;\n        }\n        if (isinstance) {\n                *out = USub;\n                return 0;\n        }\n\n        tmp = PyObject_Repr(obj);\n        if (tmp == NULL) goto failed;\n        PyErr_Format(PyExc_TypeError, \"expected some sort of unaryop, but got %.400s\", _PyUnicode_AsString(tmp));\nfailed:\n        Py_XDECREF(tmp);\n        return 1;\n}\n\nint\nobj2ast_cmpop(PyObject* obj, cmpop_ty* out, PyArena* arena)\n{\n        PyObject* tmp = NULL;\n        int isinstance;\n\n        isinstance = PyObject_IsInstance(obj, (PyObject *)Eq_type);\n        if (isinstance == -1) {\n                return 1;\n        }\n        if (isinstance) {\n                *out = Eq;\n                return 0;\n        }\n        isinstance = PyObject_IsInstance(obj, (PyObject *)NotEq_type);\n        if (isinstance == -1) {\n                return 1;\n        }\n        if (isinstance) {\n                *out = NotEq;\n                return 0;\n        }\n        isinstance = PyObject_IsInstance(obj, (PyObject *)Lt_type);\n        if (isinstance == -1) {\n                return 1;\n        }\n        if (isinstance) {\n                *out = Lt;\n                return 0;\n        }\n        isinstance = PyObject_IsInstance(obj, (PyObject *)LtE_type);\n        if (isinstance == -1) {\n                return 1;\n        }\n        if (isinstance) {\n                *out = LtE;\n                return 0;\n        }\n        isinstance = PyObject_IsInstance(obj, (PyObject *)Gt_type);\n        if (isinstance == -1) {\n                return 1;\n        }\n        if (isinstance) {\n                *out = Gt;\n                return 0;\n        }\n        isinstance = PyObject_IsInstance(obj, (PyObject *)GtE_type);\n        if (isinstance == -1) {\n                return 1;\n        }\n        if (isinstance) {\n                *out = GtE;\n                return 0;\n        }\n        isinstance = PyObject_IsInstance(obj, (PyObject *)Is_type);\n        if (isinstance == -1) {\n                return 1;\n        }\n        if (isinstance) {\n                *out = Is;\n                return 0;\n        }\n        isinstance = PyObject_IsInstance(obj, (PyObject *)IsNot_type);\n        if (isinstance == -1) {\n                return 1;\n        }\n        if (isinstance) {\n                *out = IsNot;\n                return 0;\n        }\n        isinstance = PyObject_IsInstance(obj, (PyObject *)In_type);\n        if (isinstance == -1) {\n                return 1;\n        }\n        if (isinstance) {\n                *out = In;\n                return 0;\n        }\n        isinstance = PyObject_IsInstance(obj, (PyObject *)NotIn_type);\n        if (isinstance == -1) {\n                return 1;\n        }\n        if (isinstance) {\n                *out = NotIn;\n                return 0;\n        }\n\n        tmp = PyObject_Repr(obj);\n        if (tmp == NULL) goto failed;\n        PyErr_Format(PyExc_TypeError, \"expected some sort of cmpop, but got %.400s\", _PyUnicode_AsString(tmp));\nfailed:\n        Py_XDECREF(tmp);\n        return 1;\n}\n\nint\nobj2ast_comprehension(PyObject* obj, comprehension_ty* out, PyArena* arena)\n{\n        PyObject* tmp = NULL;\n        expr_ty target;\n        expr_ty iter;\n        asdl_seq* ifs;\n\n        if (PyObject_HasAttrString(obj, \"target\")) {\n                int res;\n                tmp = PyObject_GetAttrString(obj, \"target\");\n                if (tmp == NULL) goto failed;\n                res = obj2ast_expr(tmp, &target, arena);\n                if (res != 0) goto failed;\n                Py_XDECREF(tmp);\n                tmp = NULL;\n        } else {\n                PyErr_SetString(PyExc_TypeError, \"required field \\\"target\\\" missing from comprehension\");\n                return 1;\n        }\n        if (PyObject_HasAttrString(obj, \"iter\")) {\n                int res;\n                tmp = PyObject_GetAttrString(obj, \"iter\");\n                if (tmp == NULL) goto failed;\n                res = obj2ast_expr(tmp, &iter, arena);\n                if (res != 0) goto failed;\n                Py_XDECREF(tmp);\n                tmp = NULL;\n        } else {\n                PyErr_SetString(PyExc_TypeError, \"required field \\\"iter\\\" missing from comprehension\");\n                return 1;\n        }\n        if (PyObject_HasAttrString(obj, \"ifs\")) {\n                int res;\n                Py_ssize_t len;\n                Py_ssize_t i;\n                tmp = PyObject_GetAttrString(obj, \"ifs\");\n                if (tmp == NULL) goto failed;\n                if (!PyList_Check(tmp)) {\n                        PyErr_Format(PyExc_TypeError, \"comprehension field \\\"ifs\\\" must be a list, not a %.200s\", tmp->ob_type->tp_name);\n                        goto failed;\n                }\n                len = PyList_GET_SIZE(tmp);\n                ifs = asdl_seq_new(len, arena);\n                if (ifs == NULL) goto failed;\n                for (i = 0; i < len; i++) {\n                        expr_ty value;\n                        res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena);\n                        if (res != 0) goto failed;\n                        asdl_seq_SET(ifs, i, value);\n                }\n                Py_XDECREF(tmp);\n                tmp = NULL;\n        } else {\n                PyErr_SetString(PyExc_TypeError, \"required field \\\"ifs\\\" missing from comprehension\");\n                return 1;\n        }\n        *out = comprehension(target, iter, ifs, arena);\n        return 0;\nfailed:\n        Py_XDECREF(tmp);\n        return 1;\n}\n\nint\nobj2ast_excepthandler(PyObject* obj, excepthandler_ty* out, PyArena* arena)\n{\n        PyObject* tmp = NULL;\n        int isinstance;\n\n        int lineno;\n        int col_offset;\n\n        if (obj == Py_None) {\n                *out = NULL;\n                return 0;\n        }\n        if (PyObject_HasAttrString(obj, \"lineno\")) {\n                int res;\n                tmp = PyObject_GetAttrString(obj, \"lineno\");\n                if (tmp == NULL) goto failed;\n                res = obj2ast_int(tmp, &lineno, arena);\n                if (res != 0) goto failed;\n                Py_XDECREF(tmp);\n                tmp = NULL;\n        } else {\n                PyErr_SetString(PyExc_TypeError, \"required field \\\"lineno\\\" missing from excepthandler\");\n                return 1;\n        }\n        if (PyObject_HasAttrString(obj, \"col_offset\")) {\n                int res;\n                tmp = PyObject_GetAttrString(obj, \"col_offset\");\n                if (tmp == NULL) goto failed;\n                res = obj2ast_int(tmp, &col_offset, arena);\n                if (res != 0) goto failed;\n                Py_XDECREF(tmp);\n                tmp = NULL;\n        } else {\n                PyErr_SetString(PyExc_TypeError, \"required field \\\"col_offset\\\" missing from excepthandler\");\n                return 1;\n        }\n        isinstance = PyObject_IsInstance(obj, (PyObject*)ExceptHandler_type);\n        if (isinstance == -1) {\n                return 1;\n        }\n        if (isinstance) {\n                expr_ty type;\n                expr_ty name;\n                asdl_seq* body;\n\n                if (PyObject_HasAttrString(obj, \"type\")) {\n                        int res;\n                        tmp = PyObject_GetAttrString(obj, \"type\");\n                        if (tmp == NULL) goto failed;\n                        res = obj2ast_expr(tmp, &type, arena);\n                        if (res != 0) goto failed;\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        type = NULL;\n                }\n                if (PyObject_HasAttrString(obj, \"name\")) {\n                        int res;\n                        tmp = PyObject_GetAttrString(obj, \"name\");\n                        if (tmp == NULL) goto failed;\n                        res = obj2ast_expr(tmp, &name, arena);\n                        if (res != 0) goto failed;\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        name = NULL;\n                }\n                if (PyObject_HasAttrString(obj, \"body\")) {\n                        int res;\n                        Py_ssize_t len;\n                        Py_ssize_t i;\n                        tmp = PyObject_GetAttrString(obj, \"body\");\n                        if (tmp == NULL) goto failed;\n                        if (!PyList_Check(tmp)) {\n                                PyErr_Format(PyExc_TypeError, \"ExceptHandler field \\\"body\\\" must be a list, not a %.200s\", tmp->ob_type->tp_name);\n                                goto failed;\n                        }\n                        len = PyList_GET_SIZE(tmp);\n                        body = asdl_seq_new(len, arena);\n                        if (body == NULL) goto failed;\n                        for (i = 0; i < len; i++) {\n                                stmt_ty value;\n                                res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena);\n                                if (res != 0) goto failed;\n                                asdl_seq_SET(body, i, value);\n                        }\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        PyErr_SetString(PyExc_TypeError, \"required field \\\"body\\\" missing from ExceptHandler\");\n                        return 1;\n                }\n                *out = ExceptHandler(type, name, body, lineno, col_offset, arena);\n                if (*out == NULL) goto failed;\n                return 0;\n        }\n\n        tmp = PyObject_Repr(obj);\n        if (tmp == NULL) goto failed;\n        PyErr_Format(PyExc_TypeError, \"expected some sort of excepthandler, but got %.400s\", _PyUnicode_AsString(tmp));\nfailed:\n        Py_XDECREF(tmp);\n        return 1;\n}\n\nint\nobj2ast_arguments(PyObject* obj, arguments_ty* out, PyArena* arena)\n{\n        PyObject* tmp = NULL;\n        asdl_seq* args;\n        identifier vararg;\n        identifier kwarg;\n        asdl_seq* defaults;\n        asdl_seq* type_comments;\n\n        if (PyObject_HasAttrString(obj, \"args\")) {\n                int res;\n                Py_ssize_t len;\n                Py_ssize_t i;\n                tmp = PyObject_GetAttrString(obj, \"args\");\n                if (tmp == NULL) goto failed;\n                if (!PyList_Check(tmp)) {\n                        PyErr_Format(PyExc_TypeError, \"arguments field \\\"args\\\" must be a list, not a %.200s\", tmp->ob_type->tp_name);\n                        goto failed;\n                }\n                len = PyList_GET_SIZE(tmp);\n                args = asdl_seq_new(len, arena);\n                if (args == NULL) goto failed;\n                for (i = 0; i < len; i++) {\n                        expr_ty value;\n                        res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena);\n                        if (res != 0) goto failed;\n                        asdl_seq_SET(args, i, value);\n                }\n                Py_XDECREF(tmp);\n                tmp = NULL;\n        } else {\n                PyErr_SetString(PyExc_TypeError, \"required field \\\"args\\\" missing from arguments\");\n                return 1;\n        }\n        if (PyObject_HasAttrString(obj, \"vararg\")) {\n                int res;\n                tmp = PyObject_GetAttrString(obj, \"vararg\");\n                if (tmp == NULL) goto failed;\n                res = obj2ast_identifier(tmp, &vararg, arena);\n                if (res != 0) goto failed;\n                Py_XDECREF(tmp);\n                tmp = NULL;\n        } else {\n                vararg = NULL;\n        }\n        if (PyObject_HasAttrString(obj, \"kwarg\")) {\n                int res;\n                tmp = PyObject_GetAttrString(obj, \"kwarg\");\n                if (tmp == NULL) goto failed;\n                res = obj2ast_identifier(tmp, &kwarg, arena);\n                if (res != 0) goto failed;\n                Py_XDECREF(tmp);\n                tmp = NULL;\n        } else {\n                kwarg = NULL;\n        }\n        if (PyObject_HasAttrString(obj, \"defaults\")) {\n                int res;\n                Py_ssize_t len;\n                Py_ssize_t i;\n                tmp = PyObject_GetAttrString(obj, \"defaults\");\n                if (tmp == NULL) goto failed;\n                if (!PyList_Check(tmp)) {\n                        PyErr_Format(PyExc_TypeError, \"arguments field \\\"defaults\\\" must be a list, not a %.200s\", tmp->ob_type->tp_name);\n                        goto failed;\n                }\n                len = PyList_GET_SIZE(tmp);\n                defaults = asdl_seq_new(len, arena);\n                if (defaults == NULL) goto failed;\n                for (i = 0; i < len; i++) {\n                        expr_ty value;\n                        res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena);\n                        if (res != 0) goto failed;\n                        asdl_seq_SET(defaults, i, value);\n                }\n                Py_XDECREF(tmp);\n                tmp = NULL;\n        } else {\n                PyErr_SetString(PyExc_TypeError, \"required field \\\"defaults\\\" missing from arguments\");\n                return 1;\n        }\n        if (PyObject_HasAttrString(obj, \"type_comments\")) {\n                int res;\n                Py_ssize_t len;\n                Py_ssize_t i;\n                tmp = PyObject_GetAttrString(obj, \"type_comments\");\n                if (tmp == NULL) goto failed;\n                if (!PyList_Check(tmp)) {\n                        PyErr_Format(PyExc_TypeError, \"arguments field \\\"type_comments\\\" must be a list, not a %.200s\", tmp->ob_type->tp_name);\n                        goto failed;\n                }\n                len = PyList_GET_SIZE(tmp);\n                type_comments = asdl_seq_new(len, arena);\n                if (type_comments == NULL) goto failed;\n                for (i = 0; i < len; i++) {\n                        string value;\n                        res = obj2ast_string(PyList_GET_ITEM(tmp, i), &value, arena);\n                        if (res != 0) goto failed;\n                        asdl_seq_SET(type_comments, i, value);\n                }\n                Py_XDECREF(tmp);\n                tmp = NULL;\n        } else {\n                PyErr_SetString(PyExc_TypeError, \"required field \\\"type_comments\\\" missing from arguments\");\n                return 1;\n        }\n        *out = arguments(args, vararg, kwarg, defaults, type_comments, arena);\n        return 0;\nfailed:\n        Py_XDECREF(tmp);\n        return 1;\n}\n\nint\nobj2ast_keyword(PyObject* obj, keyword_ty* out, PyArena* arena)\n{\n        PyObject* tmp = NULL;\n        identifier arg;\n        expr_ty value;\n\n        if (PyObject_HasAttrString(obj, \"arg\")) {\n                int res;\n                tmp = PyObject_GetAttrString(obj, \"arg\");\n                if (tmp == NULL) goto failed;\n                res = obj2ast_identifier(tmp, &arg, arena);\n                if (res != 0) goto failed;\n                Py_XDECREF(tmp);\n                tmp = NULL;\n        } else {\n                PyErr_SetString(PyExc_TypeError, \"required field \\\"arg\\\" missing from keyword\");\n                return 1;\n        }\n        if (PyObject_HasAttrString(obj, \"value\")) {\n                int res;\n                tmp = PyObject_GetAttrString(obj, \"value\");\n                if (tmp == NULL) goto failed;\n                res = obj2ast_expr(tmp, &value, arena);\n                if (res != 0) goto failed;\n                Py_XDECREF(tmp);\n                tmp = NULL;\n        } else {\n                PyErr_SetString(PyExc_TypeError, \"required field \\\"value\\\" missing from keyword\");\n                return 1;\n        }\n        *out = keyword(arg, value, arena);\n        return 0;\nfailed:\n        Py_XDECREF(tmp);\n        return 1;\n}\n\nint\nobj2ast_alias(PyObject* obj, alias_ty* out, PyArena* arena)\n{\n        PyObject* tmp = NULL;\n        identifier name;\n        identifier asname;\n\n        if (PyObject_HasAttrString(obj, \"name\")) {\n                int res;\n                tmp = PyObject_GetAttrString(obj, \"name\");\n                if (tmp == NULL) goto failed;\n                res = obj2ast_identifier(tmp, &name, arena);\n                if (res != 0) goto failed;\n                Py_XDECREF(tmp);\n                tmp = NULL;\n        } else {\n                PyErr_SetString(PyExc_TypeError, \"required field \\\"name\\\" missing from alias\");\n                return 1;\n        }\n        if (PyObject_HasAttrString(obj, \"asname\")) {\n                int res;\n                tmp = PyObject_GetAttrString(obj, \"asname\");\n                if (tmp == NULL) goto failed;\n                res = obj2ast_identifier(tmp, &asname, arena);\n                if (res != 0) goto failed;\n                Py_XDECREF(tmp);\n                tmp = NULL;\n        } else {\n                asname = NULL;\n        }\n        *out = alias(name, asname, arena);\n        return 0;\nfailed:\n        Py_XDECREF(tmp);\n        return 1;\n}\n\nint\nobj2ast_type_ignore(PyObject* obj, type_ignore_ty* out, PyArena* arena)\n{\n        PyObject* tmp = NULL;\n        int isinstance;\n\n\n        if (obj == Py_None) {\n                *out = NULL;\n                return 0;\n        }\n        isinstance = PyObject_IsInstance(obj, (PyObject*)TypeIgnore_type);\n        if (isinstance == -1) {\n                return 1;\n        }\n        if (isinstance) {\n                int lineno;\n                string tag;\n\n                if (PyObject_HasAttrString(obj, \"lineno\")) {\n                        int res;\n                        tmp = PyObject_GetAttrString(obj, \"lineno\");\n                        if (tmp == NULL) goto failed;\n                        res = obj2ast_int(tmp, &lineno, arena);\n                        if (res != 0) goto failed;\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        PyErr_SetString(PyExc_TypeError, \"required field \\\"lineno\\\" missing from TypeIgnore\");\n                        return 1;\n                }\n                if (PyObject_HasAttrString(obj, \"tag\")) {\n                        int res;\n                        tmp = PyObject_GetAttrString(obj, \"tag\");\n                        if (tmp == NULL) goto failed;\n                        res = obj2ast_string(tmp, &tag, arena);\n                        if (res != 0) goto failed;\n                        Py_XDECREF(tmp);\n                        tmp = NULL;\n                } else {\n                        PyErr_SetString(PyExc_TypeError, \"required field \\\"tag\\\" missing from TypeIgnore\");\n                        return 1;\n                }\n                *out = TypeIgnore(lineno, tag, arena);\n                if (*out == NULL) goto failed;\n                return 0;\n        }\n\n        tmp = PyObject_Repr(obj);\n        if (tmp == NULL) goto failed;\n        PyErr_Format(PyExc_TypeError, \"expected some sort of type_ignore, but got %.400s\", _PyUnicode_AsString(tmp));\nfailed:\n        Py_XDECREF(tmp);\n        return 1;\n}\n\n\nPyObject *ast27_parse(PyObject *self, PyObject *args);\nstatic PyMethodDef ast27_methods[] = {\n        {\"parse\",  ast27_parse, METH_VARARGS, \"Parse string into typed AST.\"},\n        {NULL, NULL, 0, NULL}\n};\nstatic struct PyModuleDef _astmodule27 = {\n  PyModuleDef_HEAD_INIT, \"_ast27\", NULL, 0, ast27_methods\n};\nPyMODINIT_FUNC\nPyInit__ast27(void)\n{\n        PyObject *m, *d;\n        if (!init_types()) return NULL;\n        m = PyModule_Create(&_astmodule27);\n        if (!m) return NULL;\n        d = PyModule_GetDict(m);\n        if (PyDict_SetItemString(d, \"AST\", (PyObject*)&AST_type) < 0) return NULL;\n        if (PyModule_AddIntMacro(m, PyCF_ONLY_AST) < 0)\n                return NULL;\n        if (PyDict_SetItemString(d, \"mod\", (PyObject*)mod_type) < 0) return NULL;\n        if (PyDict_SetItemString(d, \"Module\", (PyObject*)Module_type) < 0) return NULL;\n        if (PyDict_SetItemString(d, \"Interactive\", (PyObject*)Interactive_type) < 0) return NULL;\n        if (PyDict_SetItemString(d, \"Expression\", (PyObject*)Expression_type) < 0) return NULL;\n        if (PyDict_SetItemString(d, \"FunctionType\", (PyObject*)FunctionType_type) < 0) return NULL;\n        if (PyDict_SetItemString(d, \"Suite\", (PyObject*)Suite_type) < 0) return NULL;\n        if (PyDict_SetItemString(d, \"stmt\", (PyObject*)stmt_type) < 0) return NULL;\n        if (PyDict_SetItemString(d, \"FunctionDef\", (PyObject*)FunctionDef_type) < 0) return NULL;\n        if (PyDict_SetItemString(d, \"ClassDef\", (PyObject*)ClassDef_type) < 0) return NULL;\n        if (PyDict_SetItemString(d, \"Return\", (PyObject*)Return_type) < 0) return NULL;\n        if (PyDict_SetItemString(d, \"Delete\", (PyObject*)Delete_type) < 0) return NULL;\n        if (PyDict_SetItemString(d, \"Assign\", (PyObject*)Assign_type) < 0) return NULL;\n        if (PyDict_SetItemString(d, \"AugAssign\", (PyObject*)AugAssign_type) < 0) return NULL;\n        if (PyDict_SetItemString(d, \"Print\", (PyObject*)Print_type) < 0) return NULL;\n        if (PyDict_SetItemString(d, \"For\", (PyObject*)For_type) < 0) return NULL;\n        if (PyDict_SetItemString(d, \"While\", (PyObject*)While_type) < 0) return NULL;\n        if (PyDict_SetItemString(d, \"If\", (PyObject*)If_type) < 0) return NULL;\n        if (PyDict_SetItemString(d, \"With\", (PyObject*)With_type) < 0) return NULL;\n        if (PyDict_SetItemString(d, \"Raise\", (PyObject*)Raise_type) < 0) return NULL;\n        if (PyDict_SetItemString(d, \"TryExcept\", (PyObject*)TryExcept_type) < 0) return NULL;\n        if (PyDict_SetItemString(d, \"TryFinally\", (PyObject*)TryFinally_type) < 0) return NULL;\n        if (PyDict_SetItemString(d, \"Assert\", (PyObject*)Assert_type) < 0) return NULL;\n        if (PyDict_SetItemString(d, \"Import\", (PyObject*)Import_type) < 0) return NULL;\n        if (PyDict_SetItemString(d, \"ImportFrom\", (PyObject*)ImportFrom_type) < 0) return NULL;\n        if (PyDict_SetItemString(d, \"Exec\", (PyObject*)Exec_type) < 0) return NULL;\n        if (PyDict_SetItemString(d, \"Global\", (PyObject*)Global_type) < 0) return NULL;\n        if (PyDict_SetItemString(d, \"Expr\", (PyObject*)Expr_type) < 0) return NULL;\n        if (PyDict_SetItemString(d, \"Pass\", (PyObject*)Pass_type) < 0) return NULL;\n        if (PyDict_SetItemString(d, \"Break\", (PyObject*)Break_type) < 0) return NULL;\n        if (PyDict_SetItemString(d, \"Continue\", (PyObject*)Continue_type) < 0) return NULL;\n        if (PyDict_SetItemString(d, \"expr\", (PyObject*)expr_type) < 0) return NULL;\n        if (PyDict_SetItemString(d, \"BoolOp\", (PyObject*)BoolOp_type) < 0) return NULL;\n        if (PyDict_SetItemString(d, \"BinOp\", (PyObject*)BinOp_type) < 0) return NULL;\n        if (PyDict_SetItemString(d, \"UnaryOp\", (PyObject*)UnaryOp_type) < 0) return NULL;\n        if (PyDict_SetItemString(d, \"Lambda\", (PyObject*)Lambda_type) < 0) return NULL;\n        if (PyDict_SetItemString(d, \"IfExp\", (PyObject*)IfExp_type) < 0) return NULL;\n        if (PyDict_SetItemString(d, \"Dict\", (PyObject*)Dict_type) < 0) return NULL;\n        if (PyDict_SetItemString(d, \"Set\", (PyObject*)Set_type) < 0) return NULL;\n        if (PyDict_SetItemString(d, \"ListComp\", (PyObject*)ListComp_type) < 0) return NULL;\n        if (PyDict_SetItemString(d, \"SetComp\", (PyObject*)SetComp_type) < 0) return NULL;\n        if (PyDict_SetItemString(d, \"DictComp\", (PyObject*)DictComp_type) < 0) return NULL;\n        if (PyDict_SetItemString(d, \"GeneratorExp\", (PyObject*)GeneratorExp_type) < 0) return NULL;\n        if (PyDict_SetItemString(d, \"Yield\", (PyObject*)Yield_type) < 0) return NULL;\n        if (PyDict_SetItemString(d, \"Compare\", (PyObject*)Compare_type) < 0) return NULL;\n        if (PyDict_SetItemString(d, \"Call\", (PyObject*)Call_type) < 0) return NULL;\n        if (PyDict_SetItemString(d, \"Repr\", (PyObject*)Repr_type) < 0) return NULL;\n        if (PyDict_SetItemString(d, \"Num\", (PyObject*)Num_type) < 0) return NULL;\n        if (PyDict_SetItemString(d, \"Str\", (PyObject*)Str_type) < 0) return NULL;\n        if (PyDict_SetItemString(d, \"Attribute\", (PyObject*)Attribute_type) < 0) return NULL;\n        if (PyDict_SetItemString(d, \"Subscript\", (PyObject*)Subscript_type) < 0) return NULL;\n        if (PyDict_SetItemString(d, \"Name\", (PyObject*)Name_type) < 0) return NULL;\n        if (PyDict_SetItemString(d, \"List\", (PyObject*)List_type) < 0) return NULL;\n        if (PyDict_SetItemString(d, \"Tuple\", (PyObject*)Tuple_type) < 0) return NULL;\n        if (PyDict_SetItemString(d, \"expr_context\", (PyObject*)expr_context_type) < 0) return NULL;\n        if (PyDict_SetItemString(d, \"Load\", (PyObject*)Load_type) < 0) return NULL;\n        if (PyDict_SetItemString(d, \"Store\", (PyObject*)Store_type) < 0) return NULL;\n        if (PyDict_SetItemString(d, \"Del\", (PyObject*)Del_type) < 0) return NULL;\n        if (PyDict_SetItemString(d, \"AugLoad\", (PyObject*)AugLoad_type) < 0) return NULL;\n        if (PyDict_SetItemString(d, \"AugStore\", (PyObject*)AugStore_type) < 0) return NULL;\n        if (PyDict_SetItemString(d, \"Param\", (PyObject*)Param_type) < 0) return NULL;\n        if (PyDict_SetItemString(d, \"slice\", (PyObject*)slice_type) < 0) return NULL;\n        if (PyDict_SetItemString(d, \"Ellipsis\", (PyObject*)Ellipsis_type) < 0) return NULL;\n        if (PyDict_SetItemString(d, \"Slice\", (PyObject*)Slice_type) < 0) return NULL;\n        if (PyDict_SetItemString(d, \"ExtSlice\", (PyObject*)ExtSlice_type) < 0) return NULL;\n        if (PyDict_SetItemString(d, \"Index\", (PyObject*)Index_type) < 0) return NULL;\n        if (PyDict_SetItemString(d, \"boolop\", (PyObject*)boolop_type) < 0) return NULL;\n        if (PyDict_SetItemString(d, \"And\", (PyObject*)And_type) < 0) return NULL;\n        if (PyDict_SetItemString(d, \"Or\", (PyObject*)Or_type) < 0) return NULL;\n        if (PyDict_SetItemString(d, \"operator\", (PyObject*)operator_type) < 0) return NULL;\n        if (PyDict_SetItemString(d, \"Add\", (PyObject*)Add_type) < 0) return NULL;\n        if (PyDict_SetItemString(d, \"Sub\", (PyObject*)Sub_type) < 0) return NULL;\n        if (PyDict_SetItemString(d, \"Mult\", (PyObject*)Mult_type) < 0) return NULL;\n        if (PyDict_SetItemString(d, \"Div\", (PyObject*)Div_type) < 0) return NULL;\n        if (PyDict_SetItemString(d, \"Mod\", (PyObject*)Mod_type) < 0) return NULL;\n        if (PyDict_SetItemString(d, \"Pow\", (PyObject*)Pow_type) < 0) return NULL;\n        if (PyDict_SetItemString(d, \"LShift\", (PyObject*)LShift_type) < 0) return NULL;\n        if (PyDict_SetItemString(d, \"RShift\", (PyObject*)RShift_type) < 0) return NULL;\n        if (PyDict_SetItemString(d, \"BitOr\", (PyObject*)BitOr_type) < 0) return NULL;\n        if (PyDict_SetItemString(d, \"BitXor\", (PyObject*)BitXor_type) < 0) return NULL;\n        if (PyDict_SetItemString(d, \"BitAnd\", (PyObject*)BitAnd_type) < 0) return NULL;\n        if (PyDict_SetItemString(d, \"FloorDiv\", (PyObject*)FloorDiv_type) < 0) return NULL;\n        if (PyDict_SetItemString(d, \"unaryop\", (PyObject*)unaryop_type) < 0) return NULL;\n        if (PyDict_SetItemString(d, \"Invert\", (PyObject*)Invert_type) < 0) return NULL;\n        if (PyDict_SetItemString(d, \"Not\", (PyObject*)Not_type) < 0) return NULL;\n        if (PyDict_SetItemString(d, \"UAdd\", (PyObject*)UAdd_type) < 0) return NULL;\n        if (PyDict_SetItemString(d, \"USub\", (PyObject*)USub_type) < 0) return NULL;\n        if (PyDict_SetItemString(d, \"cmpop\", (PyObject*)cmpop_type) < 0) return NULL;\n        if (PyDict_SetItemString(d, \"Eq\", (PyObject*)Eq_type) < 0) return NULL;\n        if (PyDict_SetItemString(d, \"NotEq\", (PyObject*)NotEq_type) < 0) return NULL;\n        if (PyDict_SetItemString(d, \"Lt\", (PyObject*)Lt_type) < 0) return NULL;\n        if (PyDict_SetItemString(d, \"LtE\", (PyObject*)LtE_type) < 0) return NULL;\n        if (PyDict_SetItemString(d, \"Gt\", (PyObject*)Gt_type) < 0) return NULL;\n        if (PyDict_SetItemString(d, \"GtE\", (PyObject*)GtE_type) < 0) return NULL;\n        if (PyDict_SetItemString(d, \"Is\", (PyObject*)Is_type) < 0) return NULL;\n        if (PyDict_SetItemString(d, \"IsNot\", (PyObject*)IsNot_type) < 0) return NULL;\n        if (PyDict_SetItemString(d, \"In\", (PyObject*)In_type) < 0) return NULL;\n        if (PyDict_SetItemString(d, \"NotIn\", (PyObject*)NotIn_type) < 0) return NULL;\n        if (PyDict_SetItemString(d, \"comprehension\", (PyObject*)comprehension_type) < 0) return\n            NULL;\n        if (PyDict_SetItemString(d, \"excepthandler\", (PyObject*)excepthandler_type) < 0) return\n            NULL;\n        if (PyDict_SetItemString(d, \"ExceptHandler\", (PyObject*)ExceptHandler_type) < 0) return\n            NULL;\n        if (PyDict_SetItemString(d, \"arguments\", (PyObject*)arguments_type) < 0) return NULL;\n        if (PyDict_SetItemString(d, \"keyword\", (PyObject*)keyword_type) < 0) return NULL;\n        if (PyDict_SetItemString(d, \"alias\", (PyObject*)alias_type) < 0) return NULL;\n        if (PyDict_SetItemString(d, \"type_ignore\", (PyObject*)type_ignore_type) < 0) return NULL;\n        if (PyDict_SetItemString(d, \"TypeIgnore\", (PyObject*)TypeIgnore_type) < 0) return NULL;\n        return m;\n}\n\n\nPyObject* Ta27AST_mod2obj(mod_ty t)\n{\n    init_types();\n    return ast2obj_mod(t);\n}\n\n/* mode is 0 for \"exec\", 1 for \"eval\" and 2 for \"single\" input */\nmod_ty Ta27AST_obj2mod(PyObject* ast, PyArena* arena, int mode)\n{\n    mod_ty res;\n    PyObject *req_type[3];\n    char *req_name[3];\n    int isinstance;\n\n    req_type[0] = (PyObject*)Module_type;\n    req_type[1] = (PyObject*)Expression_type;\n    req_type[2] = (PyObject*)Interactive_type;\n\n    req_name[0] = \"Module\";\n    req_name[1] = \"Expression\";\n    req_name[2] = \"Interactive\";\n\n    assert(0 <= mode && mode <= 2);\n\n    init_types();\n\n    isinstance = PyObject_IsInstance(ast, req_type[mode]);\n    if (isinstance == -1)\n        return NULL;\n    if (!isinstance) {\n        PyErr_Format(PyExc_TypeError, \"expected %s node, got %.400s\",\n                     req_name[mode], Py_TYPE(ast)->tp_name);\n        return NULL;\n    }\n    if (obj2ast_mod(ast, &res, arena) != 0)\n        return NULL;\n    else\n        return res;\n}\n\nint Ta27AST_Check(PyObject* obj)\n{\n    init_types();\n    return PyObject_IsInstance(obj, (PyObject*)&AST_type);\n}\n\n\n"
  },
  {
    "path": "ast27/Python/asdl.c",
    "content": "#include \"Python.h\"\n#include \"../Include/asdl.h\"\n\nasdl_seq *\n_Ta27_asdl_seq_new(Py_ssize_t size, PyArena *arena)\n{\n    asdl_seq *seq = NULL;\n    size_t n;\n\n    /* check size is sane */\n    if (size < 0 ||\n        (size && (((size_t)size - 1) > (PY_SIZE_MAX / sizeof(void *))))) {\n        PyErr_NoMemory();\n        return NULL;\n    }\n    n = (size ? (sizeof(void *) * (size - 1)) : 0);\n\n    /* check if size can be added safely */\n    if (n > PY_SIZE_MAX - sizeof(asdl_seq)) {\n        PyErr_NoMemory();\n        return NULL;\n    }\n    n += sizeof(asdl_seq);\n\n    seq = (asdl_seq *)PyArena_Malloc(arena, n);\n    if (!seq) {\n        PyErr_NoMemory();\n        return NULL;\n    }\n    memset(seq, 0, n);\n    seq->size = size;\n    return seq;\n}\n\nasdl_int_seq *\n_Ta27_asdl_int_seq_new(Py_ssize_t size, PyArena *arena)\n{\n    asdl_int_seq *seq = NULL;\n    size_t n;\n\n    /* check size is sane */\n    if (size < 0 ||\n        (size && (((size_t)size - 1) > (PY_SIZE_MAX / sizeof(void *))))) {\n            PyErr_NoMemory();\n            return NULL;\n    }\n    n = (size ? (sizeof(void *) * (size - 1)) : 0);\n\n    /* check if size can be added safely */\n    if (n > PY_SIZE_MAX - sizeof(asdl_seq)) {\n        PyErr_NoMemory();\n        return NULL;\n    }\n    n += sizeof(asdl_seq);\n\n    seq = (asdl_int_seq *)PyArena_Malloc(arena, n);\n    if (!seq) {\n        PyErr_NoMemory();\n        return NULL;\n    }\n    memset(seq, 0, n);\n    seq->size = size;\n    return seq;\n}\n"
  },
  {
    "path": "ast27/Python/ast.c",
    "content": "/*\n * This file includes functions to transform a concrete syntax tree (CST) to\n * an abstract syntax tree (AST).  The main function is Ta27AST_FromNode().\n *\n */\n#include \"Python.h\"\n#include \"../Include/Python-ast.h\"\n#include \"../Include/grammar.h\"\n#include \"../Include/node.h\"\n#include \"../Include/ast.h\"\n#include \"../Include/token.h\"\n#include \"../Include/parsetok.h\"\n#include \"../Include/graminit.h\"\n#include \"unicodeobject.h\"\n\n#include <assert.h>\n\n/* Data structure used internally */\nstruct compiling {\n    char *c_encoding; /* source encoding */\n    int c_future_unicode; /* __future__ unicode literals flag */\n    PyArena *c_arena; /* arena for allocating memeory */\n    const char *c_filename; /* filename */\n};\n\nstatic asdl_seq *seq_for_testlist(struct compiling *, const node *);\nstatic expr_ty ast_for_expr(struct compiling *, const node *);\nstatic stmt_ty ast_for_stmt(struct compiling *, const node *);\nstatic asdl_seq *ast_for_suite(struct compiling *, const node *);\nstatic asdl_seq *ast_for_exprlist(struct compiling *, const node *,\n                                  expr_context_ty);\nstatic expr_ty ast_for_testlist(struct compiling *, const node *);\nstatic stmt_ty ast_for_classdef(struct compiling *, const node *, asdl_seq *);\nstatic expr_ty ast_for_testlist_comp(struct compiling *, const node *);\n\n/* Note different signature for ast_for_call */\nstatic expr_ty ast_for_call(struct compiling *, const node *, expr_ty);\n\nstatic PyObject *parsenumber(struct compiling *, const char *);\nstatic PyObject *parsestr(struct compiling *, const node *n, const char *);\nstatic PyObject *parsestrplus(struct compiling *, const node *n);\n\nstatic int Py_Py3kWarningFlag = 0;\nstatic int Py_UnicodeFlag = 0;\n\nextern long Ta27OS_strtol(char *str, char **ptr, int base);\n\n#ifndef LINENO\n#define LINENO(n)       ((n)->n_lineno)\n#endif\n\n#define COMP_GENEXP 0\n#define COMP_SETCOMP  1\n\nstatic identifier\nnew_identifier(const char* n, PyArena *arena) {\n    PyObject* id = PyUnicode_InternFromString(n);\n    if (id != NULL)\n        PyArena_AddPyObject(arena, id);\n    return id;\n}\n\n#define NEW_IDENTIFIER(n) new_identifier(STR(n), c->c_arena)\n\nstatic string\nnew_type_comment(const char *s, struct compiling *c)\n{\n  return PyUnicode_DecodeUTF8(s, strlen(s), NULL);\n}\n#define NEW_TYPE_COMMENT(n) new_type_comment(STR(n), c)\n\n\n/* This routine provides an invalid object for the syntax error.\n   The outermost routine must unpack this error and create the\n   proper object.  We do this so that we don't have to pass\n   the filename to everything function.\n\n   XXX Maybe we should just pass the filename...\n*/\n\nstatic int\nast_error(const node *n, const char *errstr)\n{\n    PyObject *u = Py_BuildValue(\"zi\", errstr, LINENO(n));\n    if (!u)\n        return 0;\n    PyErr_SetObject(PyExc_SyntaxError, u);\n    Py_DECREF(u);\n    return 0;\n}\n\nstatic void\nast_error_finish(const char *filename)\n{\n    PyObject *type, *value, *tback, *errstr, *loc, *tmp;\n    long lineno;\n\n    assert(PyErr_Occurred());\n    if (!PyErr_ExceptionMatches(PyExc_SyntaxError))\n        return;\n\n    PyErr_Fetch(&type, &value, &tback);\n    errstr = PyTuple_GetItem(value, 0);\n    if (!errstr)\n        return;\n    Py_INCREF(errstr);\n    lineno = PyLong_AsLong(PyTuple_GetItem(value, 1));\n    if (lineno == -1) {\n        Py_DECREF(errstr);\n        return;\n    }\n    Py_DECREF(value);\n\n    loc = PyErr_ProgramText(filename, lineno);\n    if (!loc) {\n        Py_INCREF(Py_None);\n        loc = Py_None;\n    }\n    tmp = Py_BuildValue(\"(zlOO)\", filename, lineno, Py_None, loc);\n    Py_DECREF(loc);\n    if (!tmp) {\n        Py_DECREF(errstr);\n        return;\n    }\n    value = PyTuple_Pack(2, errstr, tmp);\n    Py_DECREF(errstr);\n    Py_DECREF(tmp);\n    if (!value)\n        return;\n    PyErr_Restore(type, value, tback);\n}\n\nstatic int\nast_warn(struct compiling *c, const node *n, char *msg)\n{\n    if (PyErr_WarnExplicit(PyExc_SyntaxWarning, msg, c->c_filename, LINENO(n),\n                           NULL, NULL) < 0) {\n        /* if -Werr, change it to a SyntaxError */\n        if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_SyntaxWarning))\n            ast_error(n, msg);\n        return 0;\n    }\n    return 1;\n}\n\nstatic int\nforbidden_check(struct compiling *c, const node *n, const char *x)\n{\n    if (!strcmp(x, \"None\"))\n        return ast_error(n, \"cannot assign to None\");\n    if (!strcmp(x, \"__debug__\"))\n        return ast_error(n, \"cannot assign to __debug__\");\n    if (Py_Py3kWarningFlag) {\n        if (!(strcmp(x, \"True\") && strcmp(x, \"False\")) &&\n            !ast_warn(c, n, \"assignment to True or False is forbidden in 3.x\"))\n            return 0;\n        if (!strcmp(x, \"nonlocal\") &&\n            !ast_warn(c, n, \"nonlocal is a keyword in 3.x\"))\n            return 0;\n    }\n    return 1;\n}\n\n/* num_stmts() returns number of contained statements.\n\n   Use this routine to determine how big a sequence is needed for\n   the statements in a parse tree.  Its raison d'etre is this bit of\n   grammar:\n\n   stmt: simple_stmt | compound_stmt\n   simple_stmt: small_stmt (';' small_stmt)* [';'] NEWLINE\n\n   A simple_stmt can contain multiple small_stmt elements joined\n   by semicolons.  If the arg is a simple_stmt, the number of\n   small_stmt elements is returned.\n*/\n\nstatic int\nnum_stmts(const node *n)\n{\n    int i, l;\n    node *ch;\n\n    switch (TYPE(n)) {\n        case single_input:\n            if (TYPE(CHILD(n, 0)) == NEWLINE)\n                return 0;\n            else\n                return num_stmts(CHILD(n, 0));\n        case file_input:\n            l = 0;\n            for (i = 0; i < NCH(n); i++) {\n                ch = CHILD(n, i);\n                if (TYPE(ch) == stmt)\n                    l += num_stmts(ch);\n            }\n            return l;\n        case stmt:\n            return num_stmts(CHILD(n, 0));\n        case compound_stmt:\n            return 1;\n        case simple_stmt:\n            return NCH(n) / 2; /* Divide by 2 to remove count of semi-colons */\n        case suite:\n            /* suite: simple_stmt | NEWLINE [TYPE_COMMENT NEWLINE] INDENT stmt+ DEDENT */\n            if (NCH(n) == 1)\n                return num_stmts(CHILD(n, 0));\n            else {\n                i = 2;\n                l = 0;\n                if (TYPE(CHILD(n, 1)) == TYPE_COMMENT)\n                    i += 2;\n                for (; i < (NCH(n) - 1); i++)\n                    l += num_stmts(CHILD(n, i));\n                return l;\n            }\n        default: {\n            char buf[128];\n\n            sprintf(buf, \"Non-statement found: %d %d\",\n                    TYPE(n), NCH(n));\n            Py_FatalError(buf);\n        }\n    }\n    assert(0);\n    return 0;\n}\n\n/* Transform the CST rooted at node * to the appropriate AST\n*/\n\nmod_ty\nTa27AST_FromNode(const node *n, PyCompilerFlags *flags, const char *filename,\n               PyArena *arena)\n{\n    int i, j, k, num;\n    asdl_seq *stmts = NULL;\n    asdl_seq *type_ignores = NULL;\n    stmt_ty s;\n    node *ch;\n    struct compiling c;\n    asdl_seq *argtypes = NULL;\n    expr_ty ret, arg;\n\n    if (flags && flags->cf_flags & PyCF_SOURCE_IS_UTF8) {\n        c.c_encoding = \"utf-8\";\n        if (TYPE(n) == encoding_decl) {\n            ast_error(n, \"encoding declaration in Unicode string\");\n            goto error;\n        }\n    } else if (TYPE(n) == encoding_decl) {\n        c.c_encoding = STR(n);\n        n = CHILD(n, 0);\n    } else {\n        c.c_encoding = NULL;\n    }\n    c.c_future_unicode = flags && flags->cf_flags & CO_FUTURE_UNICODE_LITERALS;\n    c.c_arena = arena;\n    c.c_filename = filename;\n\n    k = 0;\n    switch (TYPE(n)) {\n        case file_input:\n            stmts = asdl_seq_new(num_stmts(n), arena);\n            if (!stmts)\n                return NULL;\n            for (i = 0; i < NCH(n) - 1; i++) {\n                ch = CHILD(n, i);\n                if (TYPE(ch) == NEWLINE)\n                    continue;\n                REQ(ch, stmt);\n                num = num_stmts(ch);\n                if (num == 1) {\n                    s = ast_for_stmt(&c, ch);\n                    if (!s)\n                        goto error;\n                    asdl_seq_SET(stmts, k++, s);\n                }\n                else {\n                    ch = CHILD(ch, 0);\n                    REQ(ch, simple_stmt);\n                    for (j = 0; j < num; j++) {\n                        s = ast_for_stmt(&c, CHILD(ch, j * 2));\n                        if (!s)\n                            goto error;\n                        asdl_seq_SET(stmts, k++, s);\n                    }\n                }\n            }\n            /* Type ignores are stored under the ENDMARKER in file_input. */\n            ch = CHILD(n, NCH(n) - 1);\n            REQ(ch, ENDMARKER);\n            num = NCH(ch);\n            type_ignores = _Ta27_asdl_seq_new(num, arena);\n            if (!type_ignores)\n                goto error;\n\n            for (i = 0; i < num; i++) {\n                string type_comment = new_type_comment(STR(CHILD(ch, i)), &c);\n                if (!type_comment)\n                    goto error;\n                type_ignore_ty ti = TypeIgnore(LINENO(CHILD(ch, i)), type_comment, arena);\n                if (!ti)\n                    goto error;\n                asdl_seq_SET(type_ignores, i, ti);\n            }\n\n            return Module(stmts, type_ignores, arena);\n        case eval_input: {\n            expr_ty testlist_ast;\n\n            /* XXX Why not comp_for here? */\n            testlist_ast = ast_for_testlist(&c, CHILD(n, 0));\n            if (!testlist_ast)\n                goto error;\n            return Expression(testlist_ast, arena);\n        }\n        case single_input:\n            if (TYPE(CHILD(n, 0)) == NEWLINE) {\n                stmts = asdl_seq_new(1, arena);\n                if (!stmts)\n                    goto error;\n                asdl_seq_SET(stmts, 0, Pass(n->n_lineno, n->n_col_offset,\n                                            arena));\n                if (!asdl_seq_GET(stmts, 0))\n                    goto error;\n                return Interactive(stmts, arena);\n            }\n            else {\n                n = CHILD(n, 0);\n                num = num_stmts(n);\n                stmts = asdl_seq_new(num, arena);\n                if (!stmts)\n                    goto error;\n                if (num == 1) {\n                    s = ast_for_stmt(&c, n);\n                    if (!s)\n                        goto error;\n                    asdl_seq_SET(stmts, 0, s);\n                }\n                else {\n                    /* Only a simple_stmt can contain multiple statements. */\n                    REQ(n, simple_stmt);\n                    for (i = 0; i < NCH(n); i += 2) {\n                        if (TYPE(CHILD(n, i)) == NEWLINE)\n                            break;\n                        s = ast_for_stmt(&c, CHILD(n, i));\n                        if (!s)\n                            goto error;\n                        asdl_seq_SET(stmts, i / 2, s);\n                    }\n                }\n\n                return Interactive(stmts, arena);\n            }\n        case func_type_input:\n            n = CHILD(n, 0);\n            REQ(n, func_type);\n\n            if (TYPE(CHILD(n, 1)) == typelist) {\n                ch = CHILD(n, 1);\n                /* this is overly permissive -- we don't pay any attention to\n                 * stars on the args -- just parse them into an ordered list */\n                num = 0;\n                for (i = 0; i < NCH(ch); i++) {\n                    if (TYPE(CHILD(ch, i)) == test)\n                        num++;\n                }\n\n                argtypes = _Ta27_asdl_seq_new(num, arena);\n\n                j = 0;\n                for (i = 0; i < NCH(ch); i++) {\n                    if (TYPE(CHILD(ch, i)) == test) {\n                        arg = ast_for_expr(&c, CHILD(ch, i));\n                        if (!arg)\n                            goto error;\n                        asdl_seq_SET(argtypes, j++, arg);\n                    }\n                }\n            }\n            else\n                argtypes = _Ta27_asdl_seq_new(0, arena);\n\n            ret = ast_for_expr(&c, CHILD(n, NCH(n) - 1));\n            if (!ret)\n                goto error;\n            return FunctionType(argtypes, ret, arena);\n        default:\n            PyErr_Format(PyExc_SystemError,\n                         \"invalid node %d for Ta27AST_FromNode\", TYPE(n));\n            goto error;\n    }\n error:\n    ast_error_finish(filename);\n    return NULL;\n}\n\n/* Return the AST repr. of the operator represented as syntax (|, ^, etc.)\n*/\n\nstatic operator_ty\nget_operator(const node *n)\n{\n    switch (TYPE(n)) {\n        case VBAR:\n            return BitOr;\n        case CIRCUMFLEX:\n            return BitXor;\n        case AMPER:\n            return BitAnd;\n        case LEFTSHIFT:\n            return LShift;\n        case RIGHTSHIFT:\n            return RShift;\n        case PLUS:\n            return Add;\n        case MINUS:\n            return Sub;\n        case STAR:\n            return Mult;\n        case SLASH:\n            return Div;\n        case DOUBLESLASH:\n            return FloorDiv;\n        case PERCENT:\n            return Mod;\n        default:\n            return (operator_ty)0;\n    }\n}\n\n/* Set the context ctx for expr_ty e, recursively traversing e.\n\n   Only sets context for expr kinds that \"can appear in assignment context\"\n   (according to ../Parser/Python.asdl).  For other expr kinds, it sets\n   an appropriate syntax error and returns false.\n*/\n\nstatic int\nset_context(struct compiling *c, expr_ty e, expr_context_ty ctx, const node *n)\n{\n    asdl_seq *s = NULL;\n    /* If a particular expression type can't be used for assign / delete,\n       set expr_name to its name and an error message will be generated.\n    */\n    const char* expr_name = NULL;\n\n    /* The ast defines augmented store and load contexts, but the\n       implementation here doesn't actually use them.  The code may be\n       a little more complex than necessary as a result.  It also means\n       that expressions in an augmented assignment have a Store context.\n       Consider restructuring so that augmented assignment uses\n       set_context(), too.\n    */\n    assert(ctx != AugStore && ctx != AugLoad);\n\n    switch (e->kind) {\n        case Attribute_kind:\n            if (ctx == Store && !forbidden_check(c, n,\n                                PyUnicode_AsUTF8(e->v.Attribute.attr)))\n                    return 0;\n            e->v.Attribute.ctx = ctx;\n            break;\n        case Subscript_kind:\n            e->v.Subscript.ctx = ctx;\n            break;\n        case Name_kind:\n            if (ctx == Store && !forbidden_check(c, n,\n                                PyUnicode_AsUTF8(e->v.Name.id)))\n                    return 0;\n            e->v.Name.ctx = ctx;\n            break;\n        case List_kind:\n            e->v.List.ctx = ctx;\n            s = e->v.List.elts;\n            break;\n        case Tuple_kind:\n            if (asdl_seq_LEN(e->v.Tuple.elts))  {\n                e->v.Tuple.ctx = ctx;\n                s = e->v.Tuple.elts;\n            }\n            else {\n                expr_name = \"()\";\n            }\n            break;\n        case Lambda_kind:\n            expr_name = \"lambda\";\n            break;\n        case Call_kind:\n            expr_name = \"function call\";\n            break;\n        case BoolOp_kind:\n        case BinOp_kind:\n        case UnaryOp_kind:\n            expr_name = \"operator\";\n            break;\n        case GeneratorExp_kind:\n            expr_name = \"generator expression\";\n            break;\n        case Yield_kind:\n            expr_name = \"yield expression\";\n            break;\n        case ListComp_kind:\n            expr_name = \"list comprehension\";\n            break;\n        case SetComp_kind:\n            expr_name = \"set comprehension\";\n            break;\n        case DictComp_kind:\n            expr_name = \"dict comprehension\";\n            break;\n        case Dict_kind:\n        case Set_kind:\n        case Num_kind:\n        case Str_kind:\n            expr_name = \"literal\";\n            break;\n        case Compare_kind:\n            expr_name = \"comparison\";\n            break;\n        case Repr_kind:\n            expr_name = \"repr\";\n            break;\n        case IfExp_kind:\n            expr_name = \"conditional expression\";\n            break;\n        default:\n            PyErr_Format(PyExc_SystemError,\n                         \"unexpected expression in assignment %d (line %d)\",\n                         e->kind, e->lineno);\n            return 0;\n    }\n    /* Check for error string set by switch */\n    if (expr_name) {\n        char buf[300];\n        PyOS_snprintf(buf, sizeof(buf),\n                      \"can't %s %s\",\n                      ctx == Store ? \"assign to\" : \"delete\",\n                      expr_name);\n        return ast_error(n, buf);\n    }\n\n    /* If the LHS is a list or tuple, we need to set the assignment\n       context for all the contained elements.\n    */\n    if (s) {\n        int i;\n\n        for (i = 0; i < asdl_seq_LEN(s); i++) {\n            if (!set_context(c, (expr_ty)asdl_seq_GET(s, i), ctx, n))\n                return 0;\n        }\n    }\n    return 1;\n}\n\nstatic operator_ty\nast_for_augassign(struct compiling *c, const node *n)\n{\n    REQ(n, augassign);\n    n = CHILD(n, 0);\n    switch (STR(n)[0]) {\n        case '+':\n            return Add;\n        case '-':\n            return Sub;\n        case '/':\n            if (STR(n)[1] == '/')\n                return FloorDiv;\n            else\n                return Div;\n        case '%':\n            return Mod;\n        case '<':\n            return LShift;\n        case '>':\n            return RShift;\n        case '&':\n            return BitAnd;\n        case '^':\n            return BitXor;\n        case '|':\n            return BitOr;\n        case '*':\n            if (STR(n)[1] == '*')\n                return Pow;\n            else\n                return Mult;\n        default:\n            PyErr_Format(PyExc_SystemError, \"invalid augassign: %s\", STR(n));\n            return (operator_ty)0;\n    }\n}\n\nstatic cmpop_ty\nast_for_comp_op(struct compiling *c, const node *n)\n{\n    /* comp_op: '<'|'>'|'=='|'>='|'<='|'<>'|'!='|'in'|'not' 'in'|'is'\n               |'is' 'not'\n    */\n    REQ(n, comp_op);\n    if (NCH(n) == 1) {\n        n = CHILD(n, 0);\n        switch (TYPE(n)) {\n            case LESS:\n                return Lt;\n            case GREATER:\n                return Gt;\n            case EQEQUAL:                       /* == */\n                return Eq;\n            case LESSEQUAL:\n                return LtE;\n            case GREATEREQUAL:\n                return GtE;\n            case NOTEQUAL:\n                return NotEq;\n            case NAME:\n                if (strcmp(STR(n), \"in\") == 0)\n                    return In;\n                if (strcmp(STR(n), \"is\") == 0)\n                    return Is;\n            default:\n                PyErr_Format(PyExc_SystemError, \"invalid comp_op: %s\",\n                             STR(n));\n                return (cmpop_ty)0;\n        }\n    }\n    else if (NCH(n) == 2) {\n        /* handle \"not in\" and \"is not\" */\n        switch (TYPE(CHILD(n, 0))) {\n            case NAME:\n                if (strcmp(STR(CHILD(n, 1)), \"in\") == 0)\n                    return NotIn;\n                if (strcmp(STR(CHILD(n, 0)), \"is\") == 0)\n                    return IsNot;\n            default:\n                PyErr_Format(PyExc_SystemError, \"invalid comp_op: %s %s\",\n                             STR(CHILD(n, 0)), STR(CHILD(n, 1)));\n                return (cmpop_ty)0;\n        }\n    }\n    PyErr_Format(PyExc_SystemError, \"invalid comp_op: has %d children\",\n                 NCH(n));\n    return (cmpop_ty)0;\n}\n\nstatic asdl_seq *\nseq_for_testlist(struct compiling *c, const node *n)\n{\n    /* testlist: test (',' test)* [','] */\n    asdl_seq *seq;\n    expr_ty expression;\n    int i;\n    assert(TYPE(n) == testlist ||\n           TYPE(n) == listmaker ||\n           TYPE(n) == testlist_comp ||\n           TYPE(n) == testlist_safe ||\n           TYPE(n) == testlist1);\n\n    seq = asdl_seq_new((NCH(n) + 1) / 2, c->c_arena);\n    if (!seq)\n        return NULL;\n\n    for (i = 0; i < NCH(n); i += 2) {\n        assert(TYPE(CHILD(n, i)) == test || TYPE(CHILD(n, i)) == old_test);\n\n        expression = ast_for_expr(c, CHILD(n, i));\n        if (!expression)\n            return NULL;\n\n        assert(i / 2 < seq->size);\n        asdl_seq_SET(seq, i / 2, expression);\n    }\n    return seq;\n}\n\nstatic expr_ty\ncompiler_complex_args(struct compiling *c, const node *n)\n{\n    int i, len = (NCH(n) + 1) / 2;\n    expr_ty result;\n    asdl_seq *args = asdl_seq_new(len, c->c_arena);\n    if (!args)\n        return NULL;\n\n    /* fpdef: NAME | '(' fplist ')'\n       fplist: fpdef (',' fpdef)* [',']\n    */\n    REQ(n, fplist);\n    for (i = 0; i < len; i++) {\n        PyObject *arg_id;\n        const node *fpdef_node = CHILD(n, 2*i);\n        const node *child;\n        expr_ty arg;\nset_name:\n        /* fpdef_node is either a NAME or an fplist */\n        child = CHILD(fpdef_node, 0);\n        if (TYPE(child) == NAME) {\n            if (!forbidden_check(c, n, STR(child)))\n                return NULL;\n            arg_id = NEW_IDENTIFIER(child);\n            if (!arg_id)\n                return NULL;\n            arg = Name(arg_id, Store, LINENO(child), child->n_col_offset,\n                       c->c_arena);\n        }\n        else {\n            assert(TYPE(fpdef_node) == fpdef);\n            /* fpdef_node[0] is not a name, so it must be '(', get CHILD[1] */\n            child = CHILD(fpdef_node, 1);\n            assert(TYPE(child) == fplist);\n            /* NCH == 1 means we have (x), we need to elide the extra parens */\n            if (NCH(child) == 1) {\n                fpdef_node = CHILD(child, 0);\n                assert(TYPE(fpdef_node) == fpdef);\n                goto set_name;\n            }\n            arg = compiler_complex_args(c, child);\n        }\n        asdl_seq_SET(args, i, arg);\n    }\n\n    result = Tuple(args, Store, LINENO(n), n->n_col_offset, c->c_arena);\n    if (!set_context(c, result, Store, n))\n        return NULL;\n    return result;\n}\n\n\n/* Create AST for argument list. */\n\nstatic arguments_ty\nast_for_arguments(struct compiling *c, const node *n)\n{\n    /* parameters: '(' [varargslist] ')'\n       varargslist: ((fpdef ['=' test] ',' [TYPE_COMMENT])*\n                     ('*' NAME [',' [TYPE_COMMENT]  '**' NAME] [TYPE_COMMENT] | '**' NAME [TYPE_COMMENT]) |\n                     fpdef ['=' test] (',' [TYPE_COMMENT] fpdef ['=' test])* [','] [TYPE_COMMENT])\n    */\n    int i, j, k, l, n_args = 0, n_all_args = 0, n_defaults = 0, found_default = 0;\n    asdl_seq *args, *defaults, *type_comments = NULL;\n    identifier vararg = NULL, kwarg = NULL;\n    node *ch;\n\n    if (TYPE(n) == parameters) {\n        if (NCH(n) == 2) /* () as argument list */\n            return arguments(NULL, NULL, NULL, NULL, NULL, c->c_arena);\n        n = CHILD(n, 1);\n    }\n    REQ(n, varargslist);\n\n    /* first count the number of normal args & defaults */\n    for (i = 0; i < NCH(n); i++) {\n        ch = CHILD(n, i);\n        if (TYPE(ch) == fpdef)\n            n_args++;\n        if (TYPE(ch) == EQUAL)\n            n_defaults++;\n        if (TYPE(ch) == STAR || TYPE(ch) == DOUBLESTAR)\n            n_all_args++;\n    }\n    n_all_args += n_args;\n    args = (n_args ? asdl_seq_new(n_args, c->c_arena) : NULL);\n    if (!args && n_args)\n        return NULL;\n    defaults = (n_defaults ? asdl_seq_new(n_defaults, c->c_arena) : NULL);\n    if (!defaults && n_defaults)\n        return NULL;\n    /* type_comments will be lazily initialized if needed.  If there are no\n       per-argument type comments, it will remain NULL.  Otherwise, it will be\n       an asdl_seq with length equal to the number of args (including varargs\n       and kwargs, if present) and with members set to the string of each arg's\n       type comment, if present, or NULL otherwise.\n     */\n\n    /* fpdef: NAME | '(' fplist ')'\n       fplist: fpdef (',' fpdef)* [',']\n    */\n    i = 0;\n    j = 0;  /* index for defaults */\n    k = 0;  /* index for args */\n    l = 0;  /* index for type comments */\n    while (i < NCH(n)) {\n        ch = CHILD(n, i);\n        switch (TYPE(ch)) {\n            case fpdef: {\n                int complex_args = 0, parenthesized = 0;\n            handle_fpdef:\n                /* XXX Need to worry about checking if TYPE(CHILD(n, i+1)) is\n                   anything other than EQUAL or a comma? */\n                /* XXX Should NCH(n) check be made a separate check? */\n                if (i + 1 < NCH(n) && TYPE(CHILD(n, i + 1)) == EQUAL) {\n                    expr_ty expression = ast_for_expr(c, CHILD(n, i + 2));\n                    if (!expression)\n                        return NULL;\n                    assert(defaults != NULL);\n                    asdl_seq_SET(defaults, j++, expression);\n                    i += 2;\n                    found_default = 1;\n                }\n                else if (found_default) {\n                    /* def f((x)=4): pass should raise an error.\n                       def f((x, (y))): pass will just incur the tuple unpacking warning. */\n                    if (parenthesized && !complex_args) {\n                        ast_error(n, \"parenthesized arg with default\");\n                        return NULL;\n                    }\n                    ast_error(n,\n                             \"non-default argument follows default argument\");\n                    return NULL;\n                }\n                if (NCH(ch) == 3) {\n                    ch = CHILD(ch, 1);\n                    /* def foo((x)): is not complex, special case. */\n                    if (NCH(ch) != 1) {\n                        /* We have complex arguments, setup for unpacking. */\n                        if (Py_Py3kWarningFlag && !ast_warn(c, ch,\n                            \"tuple parameter unpacking has been removed in 3.x\"))\n                            return NULL;\n                        complex_args = 1;\n                        asdl_seq_SET(args, k++, compiler_complex_args(c, ch));\n                        if (!asdl_seq_GET(args, k-1))\n                                return NULL;\n                    } else {\n                        /* def foo((x)): setup for checking NAME below. */\n                        /* Loop because there can be many parens and tuple\n                           unpacking mixed in. */\n                        parenthesized = 1;\n                        ch = CHILD(ch, 0);\n                        assert(TYPE(ch) == fpdef);\n                        goto handle_fpdef;\n                    }\n                }\n                if (TYPE(CHILD(ch, 0)) == NAME) {\n                    PyObject *id;\n                    expr_ty name;\n                    if (!forbidden_check(c, n, STR(CHILD(ch, 0))))\n                        return NULL;\n                    id = NEW_IDENTIFIER(CHILD(ch, 0));\n                    if (!id)\n                        return NULL;\n                    name = Name(id, Param, LINENO(ch), ch->n_col_offset,\n                                c->c_arena);\n                    if (!name)\n                        return NULL;\n                    asdl_seq_SET(args, k++, name);\n\n                }\n                i += 1; /* the name */\n                if (i < NCH(n) && TYPE(CHILD(n, i)) == COMMA)\n                    i += 1; /* the comma, if present */\n                if (parenthesized && Py_Py3kWarningFlag &&\n                    !ast_warn(c, ch, \"parenthesized argument names \"\n                              \"are invalid in 3.x\"))\n                    return NULL;\n\n                break;\n            }\n            case STAR:\n                if (!forbidden_check(c, CHILD(n, i+1), STR(CHILD(n, i+1))))\n                    return NULL;\n                vararg = NEW_IDENTIFIER(CHILD(n, i+1));\n                if (!vararg)\n                    return NULL;\n                i += 2; /* the star and the name */\n                if (i < NCH(n) && TYPE(CHILD(n, i)) == COMMA)\n                    i += 1; /* the comma, if present */\n                break;\n            case DOUBLESTAR:\n                if (!forbidden_check(c, CHILD(n, i+1), STR(CHILD(n, i+1))))\n                    return NULL;\n                kwarg = NEW_IDENTIFIER(CHILD(n, i+1));\n                if (!kwarg)\n                    return NULL;\n                i += 2; /* the double star and the name */\n                if (i < NCH(n) && TYPE(CHILD(n, i)) == COMMA)\n                    i += 1; /* the comma, if present */\n                break;\n            case TYPE_COMMENT:\n                assert(l < k + !!vararg + !!kwarg);\n\n                if (!type_comments) {\n                    /* lazily allocate the type_comments seq for perf reasons */\n                    type_comments = asdl_seq_new(n_all_args, c->c_arena);\n                    if (!type_comments)\n                        return NULL;\n                }\n\n                while (l < k + !!vararg + !!kwarg - 1) {\n                    asdl_seq_SET(type_comments, l++, NULL);\n                }\n\n                asdl_seq_SET(type_comments, l++, NEW_TYPE_COMMENT(ch));\n                i += 1;\n                break;\n            default:\n                PyErr_Format(PyExc_SystemError,\n                             \"unexpected node in varargslist: %d @ %d\",\n                             TYPE(ch), i);\n                return NULL;\n        }\n    }\n\n    if (type_comments) {\n        while (l < n_all_args) {\n            asdl_seq_SET(type_comments, l++, NULL);\n        }\n    }\n\n    return arguments(args, vararg, kwarg, defaults, type_comments, c->c_arena);\n}\n\nstatic expr_ty\nast_for_dotted_name(struct compiling *c, const node *n)\n{\n    expr_ty e;\n    identifier id;\n    int lineno, col_offset;\n    int i;\n\n    REQ(n, dotted_name);\n\n    lineno = LINENO(n);\n    col_offset = n->n_col_offset;\n\n    id = NEW_IDENTIFIER(CHILD(n, 0));\n    if (!id)\n        return NULL;\n    e = Name(id, Load, lineno, col_offset, c->c_arena);\n    if (!e)\n        return NULL;\n\n    for (i = 2; i < NCH(n); i+=2) {\n        id = NEW_IDENTIFIER(CHILD(n, i));\n        if (!id)\n            return NULL;\n        e = Attribute(e, id, Load, lineno, col_offset, c->c_arena);\n        if (!e)\n            return NULL;\n    }\n\n    return e;\n}\n\nstatic expr_ty\nast_for_decorator(struct compiling *c, const node *n)\n{\n    /* decorator: '@' dotted_name [ '(' [arglist] ')' ] NEWLINE */\n    expr_ty d = NULL;\n    expr_ty name_expr;\n\n    REQ(n, decorator);\n    REQ(CHILD(n, 0), AT);\n    REQ(RCHILD(n, -1), NEWLINE);\n\n    name_expr = ast_for_dotted_name(c, CHILD(n, 1));\n    if (!name_expr)\n        return NULL;\n\n    if (NCH(n) == 3) { /* No arguments */\n        d = name_expr;\n        name_expr = NULL;\n    }\n    else if (NCH(n) == 5) { /* Call with no arguments */\n        d = Call(name_expr, NULL, NULL, NULL, NULL, LINENO(n),\n                 n->n_col_offset, c->c_arena);\n        if (!d)\n            return NULL;\n        name_expr = NULL;\n    }\n    else {\n        d = ast_for_call(c, CHILD(n, 3), name_expr);\n        if (!d)\n            return NULL;\n        name_expr = NULL;\n    }\n\n    return d;\n}\n\nstatic asdl_seq*\nast_for_decorators(struct compiling *c, const node *n)\n{\n    asdl_seq* decorator_seq;\n    expr_ty d;\n    int i;\n\n    REQ(n, decorators);\n    decorator_seq = asdl_seq_new(NCH(n), c->c_arena);\n    if (!decorator_seq)\n        return NULL;\n\n    for (i = 0; i < NCH(n); i++) {\n        d = ast_for_decorator(c, CHILD(n, i));\n        if (!d)\n            return NULL;\n        asdl_seq_SET(decorator_seq, i, d);\n    }\n    return decorator_seq;\n}\n\nstatic stmt_ty\nast_for_funcdef(struct compiling *c, const node *n, asdl_seq *decorator_seq)\n{\n    /* funcdef: 'def' NAME parameters ':' [TYPE_COMMENT] suite */\n    identifier name;\n    arguments_ty args;\n    asdl_seq *body;\n    int name_i = 1;\n    node *tc;\n    string type_comment = NULL;\n\n    REQ(n, funcdef);\n\n    name = NEW_IDENTIFIER(CHILD(n, name_i));\n    if (!name)\n        return NULL;\n    else if (!forbidden_check(c, CHILD(n, name_i), STR(CHILD(n, name_i))))\n        return NULL;\n    args = ast_for_arguments(c, CHILD(n, name_i + 1));\n    if (!args)\n        return NULL;\n    if (TYPE(CHILD(n, name_i + 3)) == TYPE_COMMENT) {\n        type_comment = NEW_TYPE_COMMENT(CHILD(n, name_i + 3));\n        name_i += 1;\n    }\n    body = ast_for_suite(c, CHILD(n, name_i + 3));\n    if (!body)\n        return NULL;\n\n    if (!type_comment && NCH(CHILD(n, name_i + 3)) > 1) {\n        /* If the function doesn't have a type comment on the same line, check\n         * if the suite has a type comment in it. */\n        tc = CHILD(CHILD(n, name_i + 3), 1);\n\n        if (TYPE(tc) == TYPE_COMMENT)\n            type_comment = NEW_TYPE_COMMENT(tc);\n    }\n\n    return FunctionDef(name, args, body, decorator_seq, type_comment, LINENO(n),\n                       n->n_col_offset, c->c_arena);\n}\n\nstatic stmt_ty\nast_for_decorated(struct compiling *c, const node *n)\n{\n    /* decorated: decorators (classdef | funcdef) */\n    stmt_ty thing = NULL;\n    asdl_seq *decorator_seq = NULL;\n\n    REQ(n, decorated);\n\n    decorator_seq = ast_for_decorators(c, CHILD(n, 0));\n    if (!decorator_seq)\n      return NULL;\n\n    assert(TYPE(CHILD(n, 1)) == funcdef ||\n           TYPE(CHILD(n, 1)) == classdef);\n\n    if (TYPE(CHILD(n, 1)) == funcdef) {\n      thing = ast_for_funcdef(c, CHILD(n, 1), decorator_seq);\n    } else if (TYPE(CHILD(n, 1)) == classdef) {\n      thing = ast_for_classdef(c, CHILD(n, 1), decorator_seq);\n    }\n    /* we count the decorators in when talking about the class' or\n       function's line number */\n    if (thing) {\n        thing->lineno = LINENO(n);\n        thing->col_offset = n->n_col_offset;\n    }\n    return thing;\n}\n\nstatic expr_ty\nast_for_lambdef(struct compiling *c, const node *n)\n{\n    /* lambdef: 'lambda' [varargslist] ':' test */\n    arguments_ty args;\n    expr_ty expression;\n\n    if (NCH(n) == 3) {\n        args = arguments(NULL, NULL, NULL, NULL, NULL, c->c_arena);\n        if (!args)\n            return NULL;\n        expression = ast_for_expr(c, CHILD(n, 2));\n        if (!expression)\n            return NULL;\n    }\n    else {\n        args = ast_for_arguments(c, CHILD(n, 1));\n        if (!args)\n            return NULL;\n        expression = ast_for_expr(c, CHILD(n, 3));\n        if (!expression)\n            return NULL;\n    }\n\n    return Lambda(args, expression, LINENO(n), n->n_col_offset, c->c_arena);\n}\n\nstatic expr_ty\nast_for_ifexpr(struct compiling *c, const node *n)\n{\n    /* test: or_test 'if' or_test 'else' test */\n    expr_ty expression, body, orelse;\n\n    assert(NCH(n) == 5);\n    body = ast_for_expr(c, CHILD(n, 0));\n    if (!body)\n        return NULL;\n    expression = ast_for_expr(c, CHILD(n, 2));\n    if (!expression)\n        return NULL;\n    orelse = ast_for_expr(c, CHILD(n, 4));\n    if (!orelse)\n        return NULL;\n    return IfExp(expression, body, orelse, LINENO(n), n->n_col_offset,\n                 c->c_arena);\n}\n\n/* XXX(nnorwitz): the listcomp and genexpr code should be refactored\n   so there is only a single version.  Possibly for loops can also re-use\n   the code.\n*/\n\n/* Count the number of 'for' loop in a list comprehension.\n\n   Helper for ast_for_listcomp().\n*/\n\nstatic int\ncount_list_fors(struct compiling *c, const node *n)\n{\n    int n_fors = 0;\n    node *ch = CHILD(n, 1);\n\n count_list_for:\n    n_fors++;\n    REQ(ch, list_for);\n    if (NCH(ch) == 5)\n        ch = CHILD(ch, 4);\n    else\n        return n_fors;\n count_list_iter:\n    REQ(ch, list_iter);\n    ch = CHILD(ch, 0);\n    if (TYPE(ch) == list_for)\n        goto count_list_for;\n    else if (TYPE(ch) == list_if) {\n        if (NCH(ch) == 3) {\n            ch = CHILD(ch, 2);\n            goto count_list_iter;\n        }\n        else\n            return n_fors;\n    }\n\n    /* Should never be reached */\n    PyErr_SetString(PyExc_SystemError, \"logic error in count_list_fors\");\n    return -1;\n}\n\n/* Count the number of 'if' statements in a list comprehension.\n\n   Helper for ast_for_listcomp().\n*/\n\nstatic int\ncount_list_ifs(struct compiling *c, const node *n)\n{\n    int n_ifs = 0;\n\n count_list_iter:\n    REQ(n, list_iter);\n    if (TYPE(CHILD(n, 0)) == list_for)\n        return n_ifs;\n    n = CHILD(n, 0);\n    REQ(n, list_if);\n    n_ifs++;\n    if (NCH(n) == 2)\n        return n_ifs;\n    n = CHILD(n, 2);\n    goto count_list_iter;\n}\n\nstatic expr_ty\nast_for_listcomp(struct compiling *c, const node *n)\n{\n    /* listmaker: test ( list_for | (',' test)* [','] )\n       list_for: 'for' exprlist 'in' testlist_safe [list_iter]\n       list_iter: list_for | list_if\n       list_if: 'if' test [list_iter]\n       testlist_safe: test [(',' test)+ [',']]\n    */\n    expr_ty elt, first;\n    asdl_seq *listcomps;\n    int i, n_fors;\n    node *ch;\n\n    REQ(n, listmaker);\n    assert(NCH(n) > 1);\n\n    elt = ast_for_expr(c, CHILD(n, 0));\n    if (!elt)\n        return NULL;\n\n    n_fors = count_list_fors(c, n);\n    if (n_fors == -1)\n        return NULL;\n\n    listcomps = asdl_seq_new(n_fors, c->c_arena);\n    if (!listcomps)\n        return NULL;\n\n    ch = CHILD(n, 1);\n    for (i = 0; i < n_fors; i++) {\n        comprehension_ty lc;\n        asdl_seq *t;\n        expr_ty expression;\n        node *for_ch;\n\n        REQ(ch, list_for);\n\n        for_ch = CHILD(ch, 1);\n        t = ast_for_exprlist(c, for_ch, Store);\n        if (!t)\n            return NULL;\n        expression = ast_for_testlist(c, CHILD(ch, 3));\n        if (!expression)\n            return NULL;\n\n        /* Check the # of children rather than the length of t, since\n           [x for x, in ... ] has 1 element in t, but still requires a Tuple.\n        */\n        first = (expr_ty)asdl_seq_GET(t, 0);\n        if (NCH(for_ch) == 1)\n            lc = comprehension(first, expression, NULL, c->c_arena);\n        else\n            lc = comprehension(Tuple(t, Store, first->lineno, first->col_offset,\n                                     c->c_arena),\n                               expression, NULL, c->c_arena);\n        if (!lc)\n            return NULL;\n\n        if (NCH(ch) == 5) {\n            int j, n_ifs;\n            asdl_seq *ifs;\n            expr_ty list_for_expr;\n\n            ch = CHILD(ch, 4);\n            n_ifs = count_list_ifs(c, ch);\n            if (n_ifs == -1)\n                return NULL;\n\n            ifs = asdl_seq_new(n_ifs, c->c_arena);\n            if (!ifs)\n                return NULL;\n\n            for (j = 0; j < n_ifs; j++) {\n                REQ(ch, list_iter);\n                ch = CHILD(ch, 0);\n                REQ(ch, list_if);\n\n                list_for_expr = ast_for_expr(c, CHILD(ch, 1));\n                if (!list_for_expr)\n                    return NULL;\n\n                asdl_seq_SET(ifs, j, list_for_expr);\n                if (NCH(ch) == 3)\n                    ch = CHILD(ch, 2);\n            }\n            /* on exit, must guarantee that ch is a list_for */\n            if (TYPE(ch) == list_iter)\n                ch = CHILD(ch, 0);\n            lc->ifs = ifs;\n        }\n        asdl_seq_SET(listcomps, i, lc);\n    }\n\n    return ListComp(elt, listcomps, LINENO(n), n->n_col_offset, c->c_arena);\n}\n\n/*\n   Count the number of 'for' loops in a comprehension.\n\n   Helper for ast_for_comprehension().\n*/\n\nstatic int\ncount_comp_fors(struct compiling *c, const node *n)\n{\n    int n_fors = 0;\n\n  count_comp_for:\n    n_fors++;\n    REQ(n, comp_for);\n    if (NCH(n) == 5)\n        n = CHILD(n, 4);\n    else\n        return n_fors;\n  count_comp_iter:\n    REQ(n, comp_iter);\n    n = CHILD(n, 0);\n    if (TYPE(n) == comp_for)\n        goto count_comp_for;\n    else if (TYPE(n) == comp_if) {\n        if (NCH(n) == 3) {\n            n = CHILD(n, 2);\n            goto count_comp_iter;\n        }\n        else\n            return n_fors;\n    }\n\n    /* Should never be reached */\n    PyErr_SetString(PyExc_SystemError,\n                    \"logic error in count_comp_fors\");\n    return -1;\n}\n\n/* Count the number of 'if' statements in a comprehension.\n\n   Helper for ast_for_comprehension().\n*/\n\nstatic int\ncount_comp_ifs(struct compiling *c, const node *n)\n{\n    int n_ifs = 0;\n\n    while (1) {\n        REQ(n, comp_iter);\n        if (TYPE(CHILD(n, 0)) == comp_for)\n            return n_ifs;\n        n = CHILD(n, 0);\n        REQ(n, comp_if);\n        n_ifs++;\n        if (NCH(n) == 2)\n            return n_ifs;\n        n = CHILD(n, 2);\n    }\n}\n\nstatic asdl_seq *\nast_for_comprehension(struct compiling *c, const node *n)\n{\n    int i, n_fors;\n    asdl_seq *comps;\n\n    n_fors = count_comp_fors(c, n);\n    if (n_fors == -1)\n        return NULL;\n\n    comps = asdl_seq_new(n_fors, c->c_arena);\n    if (!comps)\n        return NULL;\n\n    for (i = 0; i < n_fors; i++) {\n        comprehension_ty comp;\n        asdl_seq *t;\n        expr_ty expression, first;\n        node *for_ch;\n\n        REQ(n, comp_for);\n\n        for_ch = CHILD(n, 1);\n        t = ast_for_exprlist(c, for_ch, Store);\n        if (!t)\n            return NULL;\n        expression = ast_for_expr(c, CHILD(n, 3));\n        if (!expression)\n            return NULL;\n\n        /* Check the # of children rather than the length of t, since\n           (x for x, in ...) has 1 element in t, but still requires a Tuple. */\n        first = (expr_ty)asdl_seq_GET(t, 0);\n        if (NCH(for_ch) == 1)\n            comp = comprehension(first, expression, NULL, c->c_arena);\n        else\n            comp = comprehension(Tuple(t, Store, first->lineno, first->col_offset,\n                                     c->c_arena),\n                               expression, NULL, c->c_arena);\n        if (!comp)\n            return NULL;\n\n        if (NCH(n) == 5) {\n            int j, n_ifs;\n            asdl_seq *ifs;\n\n            n = CHILD(n, 4);\n            n_ifs = count_comp_ifs(c, n);\n            if (n_ifs == -1)\n                return NULL;\n\n            ifs = asdl_seq_new(n_ifs, c->c_arena);\n            if (!ifs)\n                return NULL;\n\n            for (j = 0; j < n_ifs; j++) {\n                REQ(n, comp_iter);\n                n = CHILD(n, 0);\n                REQ(n, comp_if);\n\n                expression = ast_for_expr(c, CHILD(n, 1));\n                if (!expression)\n                    return NULL;\n                asdl_seq_SET(ifs, j, expression);\n                if (NCH(n) == 3)\n                    n = CHILD(n, 2);\n            }\n            /* on exit, must guarantee that n is a comp_for */\n            if (TYPE(n) == comp_iter)\n                n = CHILD(n, 0);\n            comp->ifs = ifs;\n        }\n        asdl_seq_SET(comps, i, comp);\n    }\n    return comps;\n}\n\nstatic expr_ty\nast_for_itercomp(struct compiling *c, const node *n, int type)\n{\n    expr_ty elt;\n    asdl_seq *comps;\n\n    assert(NCH(n) > 1);\n\n    elt = ast_for_expr(c, CHILD(n, 0));\n    if (!elt)\n        return NULL;\n\n    comps = ast_for_comprehension(c, CHILD(n, 1));\n    if (!comps)\n        return NULL;\n\n    if (type == COMP_GENEXP)\n        return GeneratorExp(elt, comps, LINENO(n), n->n_col_offset, c->c_arena);\n    else if (type == COMP_SETCOMP)\n        return SetComp(elt, comps, LINENO(n), n->n_col_offset, c->c_arena);\n    else\n        /* Should never happen */\n        return NULL;\n}\n\nstatic expr_ty\nast_for_dictcomp(struct compiling *c, const node *n)\n{\n    expr_ty key, value;\n    asdl_seq *comps;\n\n    assert(NCH(n) > 3);\n    REQ(CHILD(n, 1), COLON);\n\n    key = ast_for_expr(c, CHILD(n, 0));\n    if (!key)\n        return NULL;\n\n    value = ast_for_expr(c, CHILD(n, 2));\n    if (!value)\n        return NULL;\n\n    comps = ast_for_comprehension(c, CHILD(n, 3));\n    if (!comps)\n        return NULL;\n\n    return DictComp(key, value, comps, LINENO(n), n->n_col_offset, c->c_arena);\n}\n\nstatic expr_ty\nast_for_genexp(struct compiling *c, const node *n)\n{\n    assert(TYPE(n) == (testlist_comp) || TYPE(n) == (argument));\n    return ast_for_itercomp(c, n, COMP_GENEXP);\n}\n\nstatic expr_ty\nast_for_setcomp(struct compiling *c, const node *n)\n{\n    assert(TYPE(n) == (dictorsetmaker));\n    return ast_for_itercomp(c, n, COMP_SETCOMP);\n}\n\nstatic expr_ty\nast_for_atom(struct compiling *c, const node *n)\n{\n    /* atom: '(' [yield_expr|testlist_comp] ')' | '[' [listmaker] ']'\n       | '{' [dictmaker] '}' | '`' testlist '`' | NAME | NUMBER | STRING+\n    */\n    node *ch = CHILD(n, 0);\n\n    switch (TYPE(ch)) {\n    case NAME: {\n        /* All names start in Load context, but may later be\n           changed. */\n        PyObject *name = NEW_IDENTIFIER(ch);\n        if (!name)\n            return NULL;\n        return Name(name, Load, LINENO(n), n->n_col_offset, c->c_arena);\n    }\n    case STRING: {\n        PyObject *kind, *str = parsestrplus(c, n);\n        const char *raw, *s = STR(CHILD(n, 0));\n        /* currently Python allows up to 2 string modifiers */\n        char *ch, s_kind[3] = {0, 0, 0};\n        ch = s_kind;\n        raw = s;\n        while (*raw && *raw != '\\'' && *raw != '\"') {\n            *ch++ = *raw++;\n        }\n        kind = PyUnicode_FromString(s_kind);\n        if (!kind) {\n            return NULL;\n        }\n        if (!str) {\n#ifdef Py_USING_UNICODE\n            if (PyErr_ExceptionMatches(PyExc_UnicodeError)){\n                PyObject *type, *value, *tback, *errstr;\n                PyErr_Fetch(&type, &value, &tback);\n                errstr = PyObject_Str(value);\n                if (errstr) {\n                    const char *s = \"\";\n                    char buf[128];\n                    s = _PyUnicode_AsString(errstr);\n                    PyOS_snprintf(buf, sizeof(buf), \"(unicode error) %s\", s);\n                    ast_error(n, buf);\n                    Py_DECREF(errstr);\n                } else {\n                    ast_error(n, \"(unicode error) unknown error\");\n                }\n                Py_DECREF(type);\n                Py_DECREF(value);\n                Py_XDECREF(tback);\n            }\n#endif\n            return NULL;\n        }\n        PyArena_AddPyObject(c->c_arena, str);\n        return Str(str, kind, LINENO(n), n->n_col_offset, c->c_arena);\n    }\n    case NUMBER: {\n        PyObject *pynum = parsenumber(c, STR(ch));\n        if (!pynum)\n            return NULL;\n\n        PyArena_AddPyObject(c->c_arena, pynum);\n        return Num(pynum, LINENO(n), n->n_col_offset, c->c_arena);\n    }\n    case LPAR: /* some parenthesized expressions */\n        ch = CHILD(n, 1);\n\n        if (TYPE(ch) == RPAR)\n            return Tuple(NULL, Load, LINENO(n), n->n_col_offset, c->c_arena);\n\n        if (TYPE(ch) == yield_expr)\n            return ast_for_expr(c, ch);\n\n        return ast_for_testlist_comp(c, ch);\n    case LSQB: /* list (or list comprehension) */\n        ch = CHILD(n, 1);\n\n        if (TYPE(ch) == RSQB)\n            return List(NULL, Load, LINENO(n), n->n_col_offset, c->c_arena);\n\n        REQ(ch, listmaker);\n        if (NCH(ch) == 1 || TYPE(CHILD(ch, 1)) == COMMA) {\n            asdl_seq *elts = seq_for_testlist(c, ch);\n            if (!elts)\n                return NULL;\n\n            return List(elts, Load, LINENO(n), n->n_col_offset, c->c_arena);\n        }\n        else\n            return ast_for_listcomp(c, ch);\n    case LBRACE: {\n        /* dictorsetmaker:\n         *    (test ':' test (comp_for | (',' test ':' test)* [','])) |\n         *    (test (comp_for | (',' test)* [',']))\n         */\n        int i, size;\n        asdl_seq *keys, *values;\n\n        ch = CHILD(n, 1);\n        if (TYPE(ch) == RBRACE) {\n            /* it's an empty dict */\n            return Dict(NULL, NULL, LINENO(n), n->n_col_offset, c->c_arena);\n        } else if (NCH(ch) == 1 || TYPE(CHILD(ch, 1)) == COMMA) {\n            /* it's a simple set */\n            asdl_seq *elts;\n            size = (NCH(ch) + 1) / 2; /* +1 in case no trailing comma */\n            elts = asdl_seq_new(size, c->c_arena);\n            if (!elts)\n                return NULL;\n            for (i = 0; i < NCH(ch); i += 2) {\n                expr_ty expression;\n                expression = ast_for_expr(c, CHILD(ch, i));\n                if (!expression)\n                    return NULL;\n                asdl_seq_SET(elts, i / 2, expression);\n            }\n            return Set(elts, LINENO(n), n->n_col_offset, c->c_arena);\n        } else if (TYPE(CHILD(ch, 1)) == comp_for) {\n            /* it's a set comprehension */\n            return ast_for_setcomp(c, ch);\n        } else if (NCH(ch) > 3 && TYPE(CHILD(ch, 3)) == comp_for) {\n            return ast_for_dictcomp(c, ch);\n        } else {\n            /* it's a dict */\n            size = (NCH(ch) + 1) / 4; /* +1 in case no trailing comma */\n            keys = asdl_seq_new(size, c->c_arena);\n            if (!keys)\n                return NULL;\n\n            values = asdl_seq_new(size, c->c_arena);\n            if (!values)\n                return NULL;\n\n            for (i = 0; i < NCH(ch); i += 4) {\n                expr_ty expression;\n\n                expression = ast_for_expr(c, CHILD(ch, i));\n                if (!expression)\n                    return NULL;\n\n                asdl_seq_SET(keys, i / 4, expression);\n\n                expression = ast_for_expr(c, CHILD(ch, i + 2));\n                if (!expression)\n                    return NULL;\n\n                asdl_seq_SET(values, i / 4, expression);\n            }\n            return Dict(keys, values, LINENO(n), n->n_col_offset, c->c_arena);\n        }\n    }\n    case BACKQUOTE: { /* repr */\n        expr_ty expression;\n        if (Py_Py3kWarningFlag &&\n            !ast_warn(c, n, \"backquote not supported in 3.x; use repr()\"))\n            return NULL;\n        expression = ast_for_testlist(c, CHILD(n, 1));\n        if (!expression)\n            return NULL;\n\n        return Repr(expression, LINENO(n), n->n_col_offset, c->c_arena);\n    }\n    default:\n        PyErr_Format(PyExc_SystemError, \"unhandled atom %d\", TYPE(ch));\n        return NULL;\n    }\n}\n\nstatic slice_ty\nast_for_slice(struct compiling *c, const node *n)\n{\n    node *ch;\n    expr_ty lower = NULL, upper = NULL, step = NULL;\n\n    REQ(n, subscript);\n\n    /*\n       subscript: '.' '.' '.' | test | [test] ':' [test] [sliceop]\n       sliceop: ':' [test]\n    */\n    ch = CHILD(n, 0);\n    if (TYPE(ch) == DOT)\n        return Ellipsis(c->c_arena);\n\n    if (NCH(n) == 1 && TYPE(ch) == test) {\n        /* 'step' variable hold no significance in terms of being used over\n           other vars */\n        step = ast_for_expr(c, ch);\n        if (!step)\n            return NULL;\n\n        return Index(step, c->c_arena);\n    }\n\n    if (TYPE(ch) == test) {\n        lower = ast_for_expr(c, ch);\n        if (!lower)\n            return NULL;\n    }\n\n    /* If there's an upper bound it's in the second or third position. */\n    if (TYPE(ch) == COLON) {\n        if (NCH(n) > 1) {\n            node *n2 = CHILD(n, 1);\n\n            if (TYPE(n2) == test) {\n                upper = ast_for_expr(c, n2);\n                if (!upper)\n                    return NULL;\n            }\n        }\n    } else if (NCH(n) > 2) {\n        node *n2 = CHILD(n, 2);\n\n        if (TYPE(n2) == test) {\n            upper = ast_for_expr(c, n2);\n            if (!upper)\n                return NULL;\n        }\n    }\n\n    ch = CHILD(n, NCH(n) - 1);\n    if (TYPE(ch) == sliceop) {\n        if (NCH(ch) == 1) {\n            /*\n              This is an extended slice (ie \"x[::]\") with no expression in the\n              step field. We set this literally to \"None\" in order to\n              disambiguate it from x[:]. (The interpreter might have to call\n              __getslice__ for x[:], but it must call __getitem__ for x[::].)\n            */\n            identifier none = new_identifier(\"None\", c->c_arena);\n            if (!none)\n                return NULL;\n            ch = CHILD(ch, 0);\n            step = Name(none, Load, LINENO(ch), ch->n_col_offset, c->c_arena);\n            if (!step)\n                return NULL;\n        } else {\n            ch = CHILD(ch, 1);\n            if (TYPE(ch) == test) {\n                step = ast_for_expr(c, ch);\n                if (!step)\n                    return NULL;\n            }\n        }\n    }\n\n    return Slice(lower, upper, step, c->c_arena);\n}\n\nstatic expr_ty\nast_for_binop(struct compiling *c, const node *n)\n{\n        /* Must account for a sequence of expressions.\n           How should A op B op C by represented?\n           BinOp(BinOp(A, op, B), op, C).\n        */\n\n        int i, nops;\n        expr_ty expr1, expr2, result;\n        operator_ty newoperator;\n\n        expr1 = ast_for_expr(c, CHILD(n, 0));\n        if (!expr1)\n            return NULL;\n\n        expr2 = ast_for_expr(c, CHILD(n, 2));\n        if (!expr2)\n            return NULL;\n\n        newoperator = get_operator(CHILD(n, 1));\n        if (!newoperator)\n            return NULL;\n\n        result = BinOp(expr1, newoperator, expr2, LINENO(n), n->n_col_offset,\n                       c->c_arena);\n        if (!result)\n            return NULL;\n\n        nops = (NCH(n) - 1) / 2;\n        for (i = 1; i < nops; i++) {\n                expr_ty tmp_result, tmp;\n                const node* next_oper = CHILD(n, i * 2 + 1);\n\n                newoperator = get_operator(next_oper);\n                if (!newoperator)\n                    return NULL;\n\n                tmp = ast_for_expr(c, CHILD(n, i * 2 + 2));\n                if (!tmp)\n                    return NULL;\n\n                tmp_result = BinOp(result, newoperator, tmp,\n                                   LINENO(next_oper), next_oper->n_col_offset,\n                                   c->c_arena);\n                if (!tmp_result)\n                        return NULL;\n                result = tmp_result;\n        }\n        return result;\n}\n\nstatic expr_ty\nast_for_trailer(struct compiling *c, const node *n, expr_ty left_expr)\n{\n    /* trailer: '(' [arglist] ')' | '[' subscriptlist ']' | '.' NAME\n       subscriptlist: subscript (',' subscript)* [',']\n       subscript: '.' '.' '.' | test | [test] ':' [test] [sliceop]\n     */\n    REQ(n, trailer);\n    if (TYPE(CHILD(n, 0)) == LPAR) {\n        if (NCH(n) == 2)\n            return Call(left_expr, NULL, NULL, NULL, NULL, LINENO(n),\n                        n->n_col_offset, c->c_arena);\n        else\n            return ast_for_call(c, CHILD(n, 1), left_expr);\n    }\n    else if (TYPE(CHILD(n, 0)) == DOT ) {\n        PyObject *attr_id = NEW_IDENTIFIER(CHILD(n, 1));\n        if (!attr_id)\n            return NULL;\n        return Attribute(left_expr, attr_id, Load,\n                         LINENO(n), n->n_col_offset, c->c_arena);\n    }\n    else {\n        REQ(CHILD(n, 0), LSQB);\n        REQ(CHILD(n, 2), RSQB);\n        n = CHILD(n, 1);\n        if (NCH(n) == 1) {\n            slice_ty slc = ast_for_slice(c, CHILD(n, 0));\n            if (!slc)\n                return NULL;\n            return Subscript(left_expr, slc, Load, LINENO(n), n->n_col_offset,\n                             c->c_arena);\n        }\n        else {\n            /* The grammar is ambiguous here. The ambiguity is resolved\n               by treating the sequence as a tuple literal if there are\n               no slice features.\n            */\n            int j;\n            slice_ty slc;\n            expr_ty e;\n            bool simple = true;\n            asdl_seq *slices, *elts;\n            slices = asdl_seq_new((NCH(n) + 1) / 2, c->c_arena);\n            if (!slices)\n                return NULL;\n            for (j = 0; j < NCH(n); j += 2) {\n                slc = ast_for_slice(c, CHILD(n, j));\n                if (!slc)\n                    return NULL;\n                if (slc->kind != Index_kind)\n                    simple = false;\n                asdl_seq_SET(slices, j / 2, slc);\n            }\n            if (!simple) {\n                return Subscript(left_expr, ExtSlice(slices, c->c_arena),\n                                 Load, LINENO(n), n->n_col_offset, c->c_arena);\n            }\n            /* extract Index values and put them in a Tuple */\n            elts = asdl_seq_new(asdl_seq_LEN(slices), c->c_arena);\n            if (!elts)\n                return NULL;\n            for (j = 0; j < asdl_seq_LEN(slices); ++j) {\n                slc = (slice_ty)asdl_seq_GET(slices, j);\n                assert(slc->kind == Index_kind  && slc->v.Index.value);\n                asdl_seq_SET(elts, j, slc->v.Index.value);\n            }\n            e = Tuple(elts, Load, LINENO(n), n->n_col_offset, c->c_arena);\n            if (!e)\n                return NULL;\n            return Subscript(left_expr, Index(e, c->c_arena),\n                             Load, LINENO(n), n->n_col_offset, c->c_arena);\n        }\n    }\n}\n\nstatic expr_ty\nast_for_factor(struct compiling *c, const node *n)\n{\n    node *pfactor, *ppower, *patom, *pnum;\n    expr_ty expression;\n\n    /* If the unary - operator is applied to a constant, don't generate\n       a UNARY_NEGATIVE opcode.  Just store the approriate value as a\n       constant.  The peephole optimizer already does something like\n       this but it doesn't handle the case where the constant is\n       (sys.maxint - 1).  In that case, we want a PyIntObject, not a\n       PyLongObject.\n    */\n    if (TYPE(CHILD(n, 0)) == MINUS &&\n        NCH(n) == 2 &&\n        TYPE((pfactor = CHILD(n, 1))) == factor &&\n        NCH(pfactor) == 1 &&\n        TYPE((ppower = CHILD(pfactor, 0))) == power &&\n        NCH(ppower) == 1 &&\n        TYPE((patom = CHILD(ppower, 0))) == atom &&\n        TYPE((pnum = CHILD(patom, 0))) == NUMBER) {\n        PyObject *pynum;\n        char *s = PyObject_MALLOC(strlen(STR(pnum)) + 2);\n        if (s == NULL)\n            return NULL;\n        s[0] = '-';\n        strcpy(s + 1, STR(pnum));\n        pynum = parsenumber(c, s);\n        PyObject_FREE(s);\n        if (!pynum)\n            return NULL;\n\n        PyArena_AddPyObject(c->c_arena, pynum);\n        return Num(pynum, LINENO(n), n->n_col_offset, c->c_arena);\n    }\n\n    expression = ast_for_expr(c, CHILD(n, 1));\n    if (!expression)\n        return NULL;\n\n    switch (TYPE(CHILD(n, 0))) {\n        case PLUS:\n            return UnaryOp(UAdd, expression, LINENO(n), n->n_col_offset,\n                           c->c_arena);\n        case MINUS:\n            return UnaryOp(USub, expression, LINENO(n), n->n_col_offset,\n                           c->c_arena);\n        case TILDE:\n            return UnaryOp(Invert, expression, LINENO(n),\n                           n->n_col_offset, c->c_arena);\n    }\n    PyErr_Format(PyExc_SystemError, \"unhandled factor: %d\",\n                 TYPE(CHILD(n, 0)));\n    return NULL;\n}\n\nstatic expr_ty\nast_for_power(struct compiling *c, const node *n)\n{\n    /* power: atom trailer* ('**' factor)*\n     */\n    int i;\n    expr_ty e, tmp;\n    REQ(n, power);\n    e = ast_for_atom(c, CHILD(n, 0));\n    if (!e)\n        return NULL;\n    if (NCH(n) == 1)\n        return e;\n    for (i = 1; i < NCH(n); i++) {\n        node *ch = CHILD(n, i);\n        if (TYPE(ch) != trailer)\n            break;\n        tmp = ast_for_trailer(c, ch, e);\n        if (!tmp)\n            return NULL;\n        tmp->lineno = e->lineno;\n        tmp->col_offset = e->col_offset;\n        e = tmp;\n    }\n    if (TYPE(CHILD(n, NCH(n) - 1)) == factor) {\n        expr_ty f = ast_for_expr(c, CHILD(n, NCH(n) - 1));\n        if (!f)\n            return NULL;\n        tmp = BinOp(e, Pow, f, LINENO(n), n->n_col_offset, c->c_arena);\n        if (!tmp)\n            return NULL;\n        e = tmp;\n    }\n    return e;\n}\n\n/* Do not name a variable 'expr'!  Will cause a compile error.\n*/\n\nstatic expr_ty\nast_for_expr(struct compiling *c, const node *n)\n{\n    /* handle the full range of simple expressions\n       test: or_test ['if' or_test 'else' test] | lambdef\n       or_test: and_test ('or' and_test)*\n       and_test: not_test ('and' not_test)*\n       not_test: 'not' not_test | comparison\n       comparison: expr (comp_op expr)*\n       expr: xor_expr ('|' xor_expr)*\n       xor_expr: and_expr ('^' and_expr)*\n       and_expr: shift_expr ('&' shift_expr)*\n       shift_expr: arith_expr (('<<'|'>>') arith_expr)*\n       arith_expr: term (('+'|'-') term)*\n       term: factor (('*'|'/'|'%'|'//') factor)*\n       factor: ('+'|'-'|'~') factor | power\n       power: atom trailer* ('**' factor)*\n\n       As well as modified versions that exist for backward compatibility,\n       to explicitly allow:\n       [ x for x in lambda: 0, lambda: 1 ]\n       (which would be ambiguous without these extra rules)\n\n       old_test: or_test | old_lambdef\n       old_lambdef: 'lambda' [vararglist] ':' old_test\n\n    */\n\n    asdl_seq *seq;\n    int i;\n\n loop:\n    switch (TYPE(n)) {\n        case test:\n        case old_test:\n            if (TYPE(CHILD(n, 0)) == lambdef ||\n                TYPE(CHILD(n, 0)) == old_lambdef)\n                return ast_for_lambdef(c, CHILD(n, 0));\n            else if (NCH(n) > 1)\n                return ast_for_ifexpr(c, n);\n            /* Fallthrough */\n        case or_test:\n        case and_test:\n            if (NCH(n) == 1) {\n                n = CHILD(n, 0);\n                goto loop;\n            }\n            seq = asdl_seq_new((NCH(n) + 1) / 2, c->c_arena);\n            if (!seq)\n                return NULL;\n            for (i = 0; i < NCH(n); i += 2) {\n                expr_ty e = ast_for_expr(c, CHILD(n, i));\n                if (!e)\n                    return NULL;\n                asdl_seq_SET(seq, i / 2, e);\n            }\n            if (!strcmp(STR(CHILD(n, 1)), \"and\"))\n                return BoolOp(And, seq, LINENO(n), n->n_col_offset,\n                              c->c_arena);\n            assert(!strcmp(STR(CHILD(n, 1)), \"or\"));\n            return BoolOp(Or, seq, LINENO(n), n->n_col_offset, c->c_arena);\n        case not_test:\n            if (NCH(n) == 1) {\n                n = CHILD(n, 0);\n                goto loop;\n            }\n            else {\n                expr_ty expression = ast_for_expr(c, CHILD(n, 1));\n                if (!expression)\n                    return NULL;\n\n                return UnaryOp(Not, expression, LINENO(n), n->n_col_offset,\n                               c->c_arena);\n            }\n        case comparison:\n            if (NCH(n) == 1) {\n                n = CHILD(n, 0);\n                goto loop;\n            }\n            else {\n                expr_ty expression;\n                asdl_int_seq *ops;\n                asdl_seq *cmps;\n                ops = asdl_int_seq_new(NCH(n) / 2, c->c_arena);\n                if (!ops)\n                    return NULL;\n                cmps = asdl_seq_new(NCH(n) / 2, c->c_arena);\n                if (!cmps) {\n                    return NULL;\n                }\n                for (i = 1; i < NCH(n); i += 2) {\n                    cmpop_ty newoperator;\n\n                    newoperator = ast_for_comp_op(c, CHILD(n, i));\n                    if (!newoperator) {\n                        return NULL;\n                    }\n\n                    expression = ast_for_expr(c, CHILD(n, i + 1));\n                    if (!expression) {\n                        return NULL;\n                    }\n\n                    asdl_seq_SET(ops, i / 2, newoperator);\n                    asdl_seq_SET(cmps, i / 2, expression);\n                }\n                expression = ast_for_expr(c, CHILD(n, 0));\n                if (!expression) {\n                    return NULL;\n                }\n\n                return Compare(expression, ops, cmps, LINENO(n),\n                               n->n_col_offset, c->c_arena);\n            }\n            break;\n\n        /* The next five cases all handle BinOps.  The main body of code\n           is the same in each case, but the switch turned inside out to\n           reuse the code for each type of operator.\n         */\n        case expr:\n        case xor_expr:\n        case and_expr:\n        case shift_expr:\n        case arith_expr:\n        case term:\n            if (NCH(n) == 1) {\n                n = CHILD(n, 0);\n                goto loop;\n            }\n            return ast_for_binop(c, n);\n        case yield_expr: {\n            expr_ty exp = NULL;\n            if (NCH(n) == 2) {\n                exp = ast_for_testlist(c, CHILD(n, 1));\n                if (!exp)\n                    return NULL;\n            }\n            return Yield(exp, LINENO(n), n->n_col_offset, c->c_arena);\n        }\n        case factor:\n            if (NCH(n) == 1) {\n                n = CHILD(n, 0);\n                goto loop;\n            }\n            return ast_for_factor(c, n);\n        case power:\n            return ast_for_power(c, n);\n        default:\n            PyErr_Format(PyExc_SystemError, \"unhandled expr: %d\", TYPE(n));\n            return NULL;\n    }\n    /* should never get here unless if error is set */\n    return NULL;\n}\n\nstatic expr_ty\nast_for_call(struct compiling *c, const node *n, expr_ty func)\n{\n    /*\n      arglist: (argument ',')* (argument [',']| '*' test [',' '**' test]\n               | '**' test)\n      argument: [test '='] test [comp_for]        # Really [keyword '='] test\n    */\n\n    int i, nargs, nkeywords, ngens;\n    asdl_seq *args;\n    asdl_seq *keywords;\n    expr_ty vararg = NULL, kwarg = NULL;\n\n    REQ(n, arglist);\n\n    nargs = 0;\n    nkeywords = 0;\n    ngens = 0;\n    for (i = 0; i < NCH(n); i++) {\n        node *ch = CHILD(n, i);\n        if (TYPE(ch) == argument) {\n            if (NCH(ch) == 1)\n                nargs++;\n            else if (TYPE(CHILD(ch, 1)) == comp_for)\n                ngens++;\n            else\n                nkeywords++;\n        }\n    }\n    if (ngens > 1 || (ngens && (nargs || nkeywords))) {\n        ast_error(n, \"Generator expression must be parenthesized \"\n                  \"if not sole argument\");\n        return NULL;\n    }\n\n    if (nargs + nkeywords + ngens > 255) {\n      ast_error(n, \"more than 255 arguments\");\n      return NULL;\n    }\n\n    args = asdl_seq_new(nargs + ngens, c->c_arena);\n    if (!args)\n        return NULL;\n    keywords = asdl_seq_new(nkeywords, c->c_arena);\n    if (!keywords)\n        return NULL;\n    nargs = 0;\n    nkeywords = 0;\n    for (i = 0; i < NCH(n); i++) {\n        node *ch = CHILD(n, i);\n        if (TYPE(ch) == argument) {\n            expr_ty e;\n            if (NCH(ch) == 1) {\n                if (nkeywords) {\n                    ast_error(CHILD(ch, 0),\n                              \"non-keyword arg after keyword arg\");\n                    return NULL;\n                }\n                if (vararg) {\n                    ast_error(CHILD(ch, 0),\n                              \"only named arguments may follow *expression\");\n                    return NULL;\n                }\n                e = ast_for_expr(c, CHILD(ch, 0));\n                if (!e)\n                    return NULL;\n                asdl_seq_SET(args, nargs++, e);\n            }\n            else if (TYPE(CHILD(ch, 1)) == comp_for) {\n                e = ast_for_genexp(c, ch);\n                if (!e)\n                    return NULL;\n                asdl_seq_SET(args, nargs++, e);\n            }\n            else {\n                keyword_ty kw;\n                identifier key;\n                int k;\n                const char *tmp;\n\n                /* CHILD(ch, 0) is test, but must be an identifier? */\n                e = ast_for_expr(c, CHILD(ch, 0));\n                if (!e)\n                    return NULL;\n                /* f(lambda x: x[0] = 3) ends up getting parsed with\n                 * LHS test = lambda x: x[0], and RHS test = 3.\n                 * SF bug 132313 points out that complaining about a keyword\n                 * then is very confusing.\n                 */\n                if (e->kind == Lambda_kind) {\n                    ast_error(CHILD(ch, 0),\n                              \"lambda cannot contain assignment\");\n                    return NULL;\n                } else if (e->kind != Name_kind) {\n                    ast_error(CHILD(ch, 0), \"keyword can't be an expression\");\n                    return NULL;\n                }\n                key = e->v.Name.id;\n                if (!forbidden_check(c, CHILD(ch, 0), PyUnicode_AsUTF8(key)))\n                    return NULL;\n                for (k = 0; k < nkeywords; k++) {\n                    tmp = _PyUnicode_AsString(\n                        ((keyword_ty)asdl_seq_GET(keywords, k))->arg);\n                    if (!strcmp(tmp, _PyUnicode_AsString(key))) {\n                        ast_error(CHILD(ch, 0), \"keyword argument repeated\");\n                        return NULL;\n                    }\n                }\n                e = ast_for_expr(c, CHILD(ch, 2));\n                if (!e)\n                    return NULL;\n                kw = keyword(key, e, c->c_arena);\n                if (!kw)\n                    return NULL;\n                asdl_seq_SET(keywords, nkeywords++, kw);\n            }\n        }\n        else if (TYPE(ch) == STAR) {\n            vararg = ast_for_expr(c, CHILD(n, i+1));\n            if (!vararg)\n                return NULL;\n            i++;\n        }\n        else if (TYPE(ch) == DOUBLESTAR) {\n            kwarg = ast_for_expr(c, CHILD(n, i+1));\n            if (!kwarg)\n                return NULL;\n            i++;\n        }\n    }\n\n    return Call(func, args, keywords, vararg, kwarg, func->lineno,\n                func->col_offset, c->c_arena);\n}\n\nstatic expr_ty\nast_for_testlist(struct compiling *c, const node* n)\n{\n    /* testlist_comp: test (',' test)* [','] */\n    /* testlist: test (',' test)* [','] */\n    /* testlist_safe: test (',' test)+ [','] */\n    /* testlist1: test (',' test)* */\n    assert(NCH(n) > 0);\n    if (TYPE(n) == testlist_comp) {\n        if (NCH(n) > 1)\n            assert(TYPE(CHILD(n, 1)) != comp_for);\n    }\n    else {\n        assert(TYPE(n) == testlist ||\n               TYPE(n) == testlist_safe ||\n               TYPE(n) == testlist1);\n    }\n    if (NCH(n) == 1)\n        return ast_for_expr(c, CHILD(n, 0));\n    else {\n        asdl_seq *tmp = seq_for_testlist(c, n);\n        if (!tmp)\n            return NULL;\n        return Tuple(tmp, Load, LINENO(n), n->n_col_offset, c->c_arena);\n    }\n}\n\nstatic expr_ty\nast_for_testlist_comp(struct compiling *c, const node* n)\n{\n    /* testlist_comp: test ( comp_for | (',' test)* [','] ) */\n    /* argument: test [ comp_for ] */\n    assert(TYPE(n) == testlist_comp || TYPE(n) == argument);\n    if (NCH(n) > 1 && TYPE(CHILD(n, 1)) == comp_for)\n        return ast_for_genexp(c, n);\n    return ast_for_testlist(c, n);\n}\n\n/* like ast_for_testlist() but returns a sequence */\nstatic asdl_seq*\nast_for_class_bases(struct compiling *c, const node* n)\n{\n    /* testlist: test (',' test)* [','] */\n    assert(NCH(n) > 0);\n    REQ(n, testlist);\n    if (NCH(n) == 1) {\n        expr_ty base;\n        asdl_seq *bases = asdl_seq_new(1, c->c_arena);\n        if (!bases)\n            return NULL;\n        base = ast_for_expr(c, CHILD(n, 0));\n        if (!base)\n            return NULL;\n        asdl_seq_SET(bases, 0, base);\n        return bases;\n    }\n\n    return seq_for_testlist(c, n);\n}\n\nstatic stmt_ty\nast_for_expr_stmt(struct compiling *c, const node *n)\n{\n    int num;\n    REQ(n, expr_stmt);\n    /* expr_stmt: testlist (augassign (yield_expr|testlist)\n                | ('=' (yield_expr|testlist))* [TYPE_COMMENT])\n       testlist: test (',' test)* [',']\n       augassign: '+=' | '-=' | '*=' | '/=' | '%=' | '&=' | '|=' | '^='\n                | '<<=' | '>>=' | '**=' | '//='\n       test: ... here starts the operator precendence dance\n     */\n    num = NCH(n);\n\n    if (num == 1 || (num == 2 && TYPE(CHILD(n, 1)) == TYPE_COMMENT)) {\n        expr_ty e = ast_for_testlist(c, CHILD(n, 0));\n        if (!e)\n            return NULL;\n\n        return Expr(e, LINENO(n), n->n_col_offset, c->c_arena);\n    }\n    else if (TYPE(CHILD(n, 1)) == augassign) {\n        expr_ty expr1, expr2;\n        operator_ty newoperator;\n        node *ch = CHILD(n, 0);\n\n        expr1 = ast_for_testlist(c, ch);\n        if (!expr1)\n            return NULL;\n        if(!set_context(c, expr1, Store, ch))\n            return NULL;\n        /* set_context checks that most expressions are not the left side.\n          Augmented assignments can only have a name, a subscript, or an\n          attribute on the left, though, so we have to explicitly check for\n          those. */\n        switch (expr1->kind) {\n            case Name_kind:\n            case Attribute_kind:\n            case Subscript_kind:\n                break;\n            default:\n                ast_error(ch, \"illegal expression for augmented assignment\");\n                return NULL;\n        }\n\n        ch = CHILD(n, 2);\n        if (TYPE(ch) == testlist)\n            expr2 = ast_for_testlist(c, ch);\n        else\n            expr2 = ast_for_expr(c, ch);\n        if (!expr2)\n            return NULL;\n\n        newoperator = ast_for_augassign(c, CHILD(n, 1));\n        if (!newoperator)\n            return NULL;\n\n        return AugAssign(expr1, newoperator, expr2, LINENO(n), n->n_col_offset,\n                         c->c_arena);\n    }\n    else {\n        int i, nch_minus_type, has_type_comment;\n        asdl_seq *targets;\n        node *value;\n        expr_ty expression;\n        string type_comment;\n\n        /* a normal assignment */\n        REQ(CHILD(n, 1), EQUAL);\n\n        has_type_comment = TYPE(CHILD(n, num - 1)) == TYPE_COMMENT;\n        nch_minus_type = num - has_type_comment;\n\n        targets = asdl_seq_new(nch_minus_type / 2, c->c_arena);\n        if (!targets)\n            return NULL;\n        for (i = 0; i < nch_minus_type - 2; i += 2) {\n            expr_ty e;\n            node *ch = CHILD(n, i);\n            if (TYPE(ch) == yield_expr) {\n                ast_error(ch, \"assignment to yield expression not possible\");\n                return NULL;\n            }\n            e = ast_for_testlist(c, ch);\n            if (!e)\n                return NULL;\n\n            /* set context to assign */\n            if (!set_context(c, e, Store, CHILD(n, i)))\n                return NULL;\n\n            asdl_seq_SET(targets, i / 2, e);\n        }\n        value = CHILD(n, nch_minus_type - 1);\n        if (TYPE(value) == testlist)\n            expression = ast_for_testlist(c, value);\n        else\n            expression = ast_for_expr(c, value);\n        if (!expression)\n            return NULL;\n        if (has_type_comment)\n            type_comment = NEW_TYPE_COMMENT(CHILD(n, nch_minus_type));\n        else\n            type_comment = NULL;\n        return Assign(targets, expression, type_comment, LINENO(n), n->n_col_offset,\n                      c->c_arena);\n    }\n}\n\nstatic stmt_ty\nast_for_print_stmt(struct compiling *c, const node *n)\n{\n    /* print_stmt: 'print' ( [ test (',' test)* [','] ]\n                             | '>>' test [ (',' test)+ [','] ] )\n     */\n    expr_ty dest = NULL, expression;\n    asdl_seq *seq = NULL;\n    bool nl;\n    int i, j, values_count, start = 1;\n\n    REQ(n, print_stmt);\n    if (NCH(n) >= 2 && TYPE(CHILD(n, 1)) == RIGHTSHIFT) {\n        dest = ast_for_expr(c, CHILD(n, 2));\n        if (!dest)\n            return NULL;\n        start = 4;\n    }\n    values_count = (NCH(n) + 1 - start) / 2;\n    if (values_count) {\n        seq = asdl_seq_new(values_count, c->c_arena);\n        if (!seq)\n            return NULL;\n        for (i = start, j = 0; i < NCH(n); i += 2, ++j) {\n            expression = ast_for_expr(c, CHILD(n, i));\n            if (!expression)\n                return NULL;\n            asdl_seq_SET(seq, j, expression);\n        }\n    }\n    nl = (TYPE(CHILD(n, NCH(n) - 1)) == COMMA) ? false : true;\n    return Print(dest, seq, nl, LINENO(n), n->n_col_offset, c->c_arena);\n}\n\nstatic asdl_seq *\nast_for_exprlist(struct compiling *c, const node *n, expr_context_ty context)\n{\n    asdl_seq *seq;\n    int i;\n    expr_ty e;\n\n    REQ(n, exprlist);\n\n    seq = asdl_seq_new((NCH(n) + 1) / 2, c->c_arena);\n    if (!seq)\n        return NULL;\n    for (i = 0; i < NCH(n); i += 2) {\n        e = ast_for_expr(c, CHILD(n, i));\n        if (!e)\n            return NULL;\n        asdl_seq_SET(seq, i / 2, e);\n        if (context && !set_context(c, e, context, CHILD(n, i)))\n            return NULL;\n    }\n    return seq;\n}\n\nstatic stmt_ty\nast_for_del_stmt(struct compiling *c, const node *n)\n{\n    asdl_seq *expr_list;\n\n    /* del_stmt: 'del' exprlist */\n    REQ(n, del_stmt);\n\n    expr_list = ast_for_exprlist(c, CHILD(n, 1), Del);\n    if (!expr_list)\n        return NULL;\n    return Delete(expr_list, LINENO(n), n->n_col_offset, c->c_arena);\n}\n\nstatic stmt_ty\nast_for_flow_stmt(struct compiling *c, const node *n)\n{\n    /*\n      flow_stmt: break_stmt | continue_stmt | return_stmt | raise_stmt\n                 | yield_stmt\n      break_stmt: 'break'\n      continue_stmt: 'continue'\n      return_stmt: 'return' [testlist]\n      yield_stmt: yield_expr\n      yield_expr: 'yield' testlist\n      raise_stmt: 'raise' [test [',' test [',' test]]]\n    */\n    node *ch;\n\n    REQ(n, flow_stmt);\n    ch = CHILD(n, 0);\n    switch (TYPE(ch)) {\n        case break_stmt:\n            return Break(LINENO(n), n->n_col_offset, c->c_arena);\n        case continue_stmt:\n            return Continue(LINENO(n), n->n_col_offset, c->c_arena);\n        case yield_stmt: { /* will reduce to yield_expr */\n            expr_ty exp = ast_for_expr(c, CHILD(ch, 0));\n            if (!exp)\n                return NULL;\n            return Expr(exp, LINENO(n), n->n_col_offset, c->c_arena);\n        }\n        case return_stmt:\n            if (NCH(ch) == 1)\n                return Return(NULL, LINENO(n), n->n_col_offset, c->c_arena);\n            else {\n                expr_ty expression = ast_for_testlist(c, CHILD(ch, 1));\n                if (!expression)\n                    return NULL;\n                return Return(expression, LINENO(n), n->n_col_offset,\n                              c->c_arena);\n            }\n        case raise_stmt:\n            if (NCH(ch) == 1)\n                return Raise(NULL, NULL, NULL, LINENO(n), n->n_col_offset,\n                             c->c_arena);\n            else if (NCH(ch) == 2) {\n                expr_ty expression = ast_for_expr(c, CHILD(ch, 1));\n                if (!expression)\n                    return NULL;\n                return Raise(expression, NULL, NULL, LINENO(n),\n                             n->n_col_offset, c->c_arena);\n            }\n            else if (NCH(ch) == 4) {\n                expr_ty expr1, expr2;\n\n                expr1 = ast_for_expr(c, CHILD(ch, 1));\n                if (!expr1)\n                    return NULL;\n                expr2 = ast_for_expr(c, CHILD(ch, 3));\n                if (!expr2)\n                    return NULL;\n\n                return Raise(expr1, expr2, NULL, LINENO(n), n->n_col_offset,\n                             c->c_arena);\n            }\n            else if (NCH(ch) == 6) {\n                expr_ty expr1, expr2, expr3;\n\n                expr1 = ast_for_expr(c, CHILD(ch, 1));\n                if (!expr1)\n                    return NULL;\n                expr2 = ast_for_expr(c, CHILD(ch, 3));\n                if (!expr2)\n                    return NULL;\n                expr3 = ast_for_expr(c, CHILD(ch, 5));\n                if (!expr3)\n                    return NULL;\n\n                return Raise(expr1, expr2, expr3, LINENO(n), n->n_col_offset,\n                             c->c_arena);\n            }\n        default:\n            PyErr_Format(PyExc_SystemError,\n                         \"unexpected flow_stmt: %d\", TYPE(ch));\n            return NULL;\n    }\n}\n\nstatic alias_ty\nalias_for_import_name(struct compiling *c, const node *n, int store)\n{\n    /*\n      import_as_name: NAME ['as' NAME]\n      dotted_as_name: dotted_name ['as' NAME]\n      dotted_name: NAME ('.' NAME)*\n    */\n    PyObject *str, *name;\n\n loop:\n    switch (TYPE(n)) {\n         case import_as_name: {\n            node *name_node = CHILD(n, 0);\n            str = NULL;\n            if (NCH(n) == 3) {\n                node *str_node = CHILD(n, 2);\n                if (store && !forbidden_check(c, str_node, STR(str_node)))\n                    return NULL;\n                str = NEW_IDENTIFIER(str_node);\n                if (!str)\n                    return NULL;\n            }\n            else {\n                if (!forbidden_check(c, name_node, STR(name_node)))\n                    return NULL;\n            }\n            name = NEW_IDENTIFIER(name_node);\n            if (!name)\n                return NULL;\n            return alias(name, str, c->c_arena);\n        }\n        case dotted_as_name:\n            if (NCH(n) == 1) {\n                n = CHILD(n, 0);\n                goto loop;\n            }\n            else {\n                node *asname_node = CHILD(n, 2);\n                alias_ty a = alias_for_import_name(c, CHILD(n, 0), 0);\n                if (!a)\n                    return NULL;\n                assert(!a->asname);\n                if (!forbidden_check(c, asname_node, STR(asname_node)))\n                    return NULL;\n                a->asname = NEW_IDENTIFIER(asname_node);\n                if (!a->asname)\n                    return NULL;\n                return a;\n            }\n            break;\n        case dotted_name:\n            if (NCH(n) == 1) {\n                node *name_node = CHILD(n, 0);\n                if (store && !forbidden_check(c, name_node, STR(name_node)))\n                    return NULL;\n                name = NEW_IDENTIFIER(name_node);\n                if (!name)\n                    return NULL;\n                return alias(name, NULL, c->c_arena);\n            }\n            else {\n                /* Create a string of the form \"a.b.c\" */\n                int i;\n                size_t len;\n                char *s;\n                PyObject *uni;\n\n                len = 0;\n                for (i = 0; i < NCH(n); i += 2)\n                    /* length of string plus one for the dot */\n                    len += strlen(STR(CHILD(n, i))) + 1;\n                len--; /* the last name doesn't have a dot */\n                str = PyBytes_FromStringAndSize(NULL, len);\n                if (!str)\n                    return NULL;\n                s = PyBytes_AS_STRING(str);\n                if (!s)\n                    return NULL;\n                for (i = 0; i < NCH(n); i += 2) {\n                    char *sch = STR(CHILD(n, i));\n                    strcpy(s, STR(CHILD(n, i)));\n                    s += strlen(sch);\n                    *s++ = '.';\n                }\n                --s;\n                *s = '\\0';\n                uni = PyUnicode_DecodeUTF8(PyBytes_AS_STRING(str),\n                                           PyBytes_GET_SIZE(str),\n                                           NULL);\n                Py_DECREF(str);\n                if (!uni)\n                    return NULL;\n                str = uni;\n                PyUnicode_InternInPlace(&str);\n                if (PyArena_AddPyObject(c->c_arena, str) < 0) {\n                    Py_DECREF(str);\n                    return NULL;\n                }\n                return alias(str, NULL, c->c_arena);\n            }\n            break;\n        case STAR:\n            str = PyUnicode_InternFromString(\"*\");\n            if (PyArena_AddPyObject(c->c_arena, str) < 0) {\n                Py_DECREF(str);\n                return NULL;\n            }\n            return alias(str, NULL, c->c_arena);\n        default:\n            PyErr_Format(PyExc_SystemError,\n                         \"unexpected import name: %d\", TYPE(n));\n            return NULL;\n    }\n\n    PyErr_SetString(PyExc_SystemError, \"unhandled import name condition\");\n    return NULL;\n}\n\nstatic stmt_ty\nast_for_import_stmt(struct compiling *c, const node *n)\n{\n    /*\n      import_stmt: import_name | import_from\n      import_name: 'import' dotted_as_names\n      import_from: 'from' ('.'* dotted_name | '.') 'import'\n                          ('*' | '(' import_as_names ')' | import_as_names)\n    */\n    int lineno;\n    int col_offset;\n    int i;\n    asdl_seq *aliases;\n\n    REQ(n, import_stmt);\n    lineno = LINENO(n);\n    col_offset = n->n_col_offset;\n    n = CHILD(n, 0);\n    if (TYPE(n) == import_name) {\n        n = CHILD(n, 1);\n        REQ(n, dotted_as_names);\n        aliases = asdl_seq_new((NCH(n) + 1) / 2, c->c_arena);\n        if (!aliases)\n            return NULL;\n        for (i = 0; i < NCH(n); i += 2) {\n            alias_ty import_alias = alias_for_import_name(c, CHILD(n, i), 1);\n            if (!import_alias)\n                return NULL;\n            asdl_seq_SET(aliases, i / 2, import_alias);\n        }\n        return Import(aliases, lineno, col_offset, c->c_arena);\n    }\n    else if (TYPE(n) == import_from) {\n        int n_children;\n        int idx, ndots = 0;\n        alias_ty mod = NULL;\n        identifier modname = NULL;\n\n       /* Count the number of dots (for relative imports) and check for the\n          optional module name */\n        for (idx = 1; idx < NCH(n); idx++) {\n            if (TYPE(CHILD(n, idx)) == dotted_name) {\n                mod = alias_for_import_name(c, CHILD(n, idx), 0);\n                if (!mod)\n                    return NULL;\n                idx++;\n                break;\n            } else if (TYPE(CHILD(n, idx)) != DOT) {\n                break;\n            }\n            ndots++;\n        }\n        idx++; /* skip over the 'import' keyword */\n        switch (TYPE(CHILD(n, idx))) {\n        case STAR:\n            /* from ... import * */\n            n = CHILD(n, idx);\n            n_children = 1;\n            break;\n        case LPAR:\n            /* from ... import (x, y, z) */\n            n = CHILD(n, idx + 1);\n            n_children = NCH(n);\n            break;\n        case import_as_names:\n            /* from ... import x, y, z */\n            n = CHILD(n, idx);\n            n_children = NCH(n);\n            if (n_children % 2 == 0) {\n                ast_error(n, \"trailing comma not allowed without\"\n                             \" surrounding parentheses\");\n                return NULL;\n            }\n            break;\n        default:\n            ast_error(n, \"Unexpected node-type in from-import\");\n            return NULL;\n        }\n\n        aliases = asdl_seq_new((n_children + 1) / 2, c->c_arena);\n        if (!aliases)\n            return NULL;\n\n        /* handle \"from ... import *\" special b/c there's no children */\n        if (TYPE(n) == STAR) {\n            alias_ty import_alias = alias_for_import_name(c, n, 1);\n            if (!import_alias)\n                return NULL;\n                asdl_seq_SET(aliases, 0, import_alias);\n        }\n        else {\n            for (i = 0; i < NCH(n); i += 2) {\n                alias_ty import_alias = alias_for_import_name(c, CHILD(n, i), 1);\n                if (!import_alias)\n                    return NULL;\n                    asdl_seq_SET(aliases, i / 2, import_alias);\n            }\n        }\n        if (mod != NULL)\n            modname = mod->name;\n        return ImportFrom(modname, aliases, ndots, lineno, col_offset,\n                          c->c_arena);\n    }\n    PyErr_Format(PyExc_SystemError,\n                 \"unknown import statement: starts with command '%s'\",\n                 STR(CHILD(n, 0)));\n    return NULL;\n}\n\nstatic stmt_ty\nast_for_global_stmt(struct compiling *c, const node *n)\n{\n    /* global_stmt: 'global' NAME (',' NAME)* */\n    identifier name;\n    asdl_seq *s;\n    int i;\n\n    REQ(n, global_stmt);\n    s = asdl_seq_new(NCH(n) / 2, c->c_arena);\n    if (!s)\n        return NULL;\n    for (i = 1; i < NCH(n); i += 2) {\n        name = NEW_IDENTIFIER(CHILD(n, i));\n        if (!name)\n            return NULL;\n        asdl_seq_SET(s, i / 2, name);\n    }\n    return Global(s, LINENO(n), n->n_col_offset, c->c_arena);\n}\n\nstatic stmt_ty\nast_for_exec_stmt(struct compiling *c, const node *n)\n{\n    expr_ty expr1, globals = NULL, locals = NULL;\n    int n_children = NCH(n);\n    if (n_children != 2 && n_children != 4 && n_children != 6) {\n        PyErr_Format(PyExc_SystemError,\n                     \"poorly formed 'exec' statement: %d parts to statement\",\n                     n_children);\n        return NULL;\n    }\n\n    /* exec_stmt: 'exec' expr ['in' test [',' test]] */\n    REQ(n, exec_stmt);\n    expr1 = ast_for_expr(c, CHILD(n, 1));\n    if (!expr1)\n        return NULL;\n\n    if (expr1->kind == Tuple_kind && n_children < 4 &&\n        (asdl_seq_LEN(expr1->v.Tuple.elts) == 2 ||\n         asdl_seq_LEN(expr1->v.Tuple.elts) == 3)) {\n        /* Backwards compatibility: passing exec args as a tuple */\n        globals = asdl_seq_GET(expr1->v.Tuple.elts, 1);\n        if (asdl_seq_LEN(expr1->v.Tuple.elts) == 3) {\n            locals = asdl_seq_GET(expr1->v.Tuple.elts, 2);\n        }\n        expr1 = asdl_seq_GET(expr1->v.Tuple.elts, 0);\n    }\n\n    if (n_children >= 4) {\n        globals = ast_for_expr(c, CHILD(n, 3));\n        if (!globals)\n            return NULL;\n    }\n    if (n_children == 6) {\n        locals = ast_for_expr(c, CHILD(n, 5));\n        if (!locals)\n            return NULL;\n    }\n\n    return Exec(expr1, globals, locals, LINENO(n), n->n_col_offset,\n                c->c_arena);\n}\n\nstatic stmt_ty\nast_for_assert_stmt(struct compiling *c, const node *n)\n{\n    /* assert_stmt: 'assert' test [',' test] */\n    REQ(n, assert_stmt);\n    if (NCH(n) == 2) {\n        expr_ty expression = ast_for_expr(c, CHILD(n, 1));\n        if (!expression)\n            return NULL;\n        return Assert(expression, NULL, LINENO(n), n->n_col_offset,\n                      c->c_arena);\n    }\n    else if (NCH(n) == 4) {\n        expr_ty expr1, expr2;\n\n        expr1 = ast_for_expr(c, CHILD(n, 1));\n        if (!expr1)\n            return NULL;\n        expr2 = ast_for_expr(c, CHILD(n, 3));\n        if (!expr2)\n            return NULL;\n\n        return Assert(expr1, expr2, LINENO(n), n->n_col_offset, c->c_arena);\n    }\n    PyErr_Format(PyExc_SystemError,\n                 \"improper number of parts to 'assert' statement: %d\",\n                 NCH(n));\n    return NULL;\n}\n\nstatic asdl_seq *\nast_for_suite(struct compiling *c, const node *n)\n{\n    /* suite: simple_stmt | NEWLINE [TYPE_COMMENT NEWLINE] INDENT stmt+ DEDENT */\n    asdl_seq *seq;\n    stmt_ty s;\n    int i, total, num, end, pos = 0;\n    node *ch;\n\n    REQ(n, suite);\n\n    total = num_stmts(n);\n    seq = asdl_seq_new(total, c->c_arena);\n    if (!seq)\n        return NULL;\n    if (TYPE(CHILD(n, 0)) == simple_stmt) {\n        n = CHILD(n, 0);\n        /* simple_stmt always ends with a NEWLINE,\n           and may have a trailing SEMI\n        */\n        end = NCH(n) - 1;\n        if (TYPE(CHILD(n, end - 1)) == SEMI)\n            end--;\n        /* loop by 2 to skip semi-colons */\n        for (i = 0; i < end; i += 2) {\n            ch = CHILD(n, i);\n            s = ast_for_stmt(c, ch);\n            if (!s)\n                return NULL;\n            asdl_seq_SET(seq, pos++, s);\n        }\n    }\n    else {\n        i = 2;\n        if (TYPE(CHILD(n, 1)) == TYPE_COMMENT)\n            i += 2;\n\n        for (; i < (NCH(n) - 1); i++) {\n            ch = CHILD(n, i);\n            REQ(ch, stmt);\n            num = num_stmts(ch);\n            if (num == 1) {\n                /* small_stmt or compound_stmt with only one child */\n                s = ast_for_stmt(c, ch);\n                if (!s)\n                    return NULL;\n                asdl_seq_SET(seq, pos++, s);\n            }\n            else {\n                int j;\n                ch = CHILD(ch, 0);\n                REQ(ch, simple_stmt);\n                for (j = 0; j < NCH(ch); j += 2) {\n                    /* statement terminates with a semi-colon ';' */\n                    if (NCH(CHILD(ch, j)) == 0) {\n                        assert((j + 1) == NCH(ch));\n                        break;\n                    }\n                    s = ast_for_stmt(c, CHILD(ch, j));\n                    if (!s)\n                        return NULL;\n                    asdl_seq_SET(seq, pos++, s);\n                }\n            }\n        }\n    }\n    assert(pos == seq->size);\n    return seq;\n}\n\nstatic stmt_ty\nast_for_if_stmt(struct compiling *c, const node *n)\n{\n    /* if_stmt: 'if' test ':' suite ('elif' test ':' suite)*\n       ['else' ':' suite]\n    */\n    char *s;\n\n    REQ(n, if_stmt);\n\n    if (NCH(n) == 4) {\n        expr_ty expression;\n        asdl_seq *suite_seq;\n\n        expression = ast_for_expr(c, CHILD(n, 1));\n        if (!expression)\n            return NULL;\n        suite_seq = ast_for_suite(c, CHILD(n, 3));\n        if (!suite_seq)\n            return NULL;\n\n        return If(expression, suite_seq, NULL, LINENO(n), n->n_col_offset,\n                  c->c_arena);\n    }\n\n    s = STR(CHILD(n, 4));\n    /* s[2], the third character in the string, will be\n       's' for el_s_e, or\n       'i' for el_i_f\n    */\n    if (s[2] == 's') {\n        expr_ty expression;\n        asdl_seq *seq1, *seq2;\n\n        expression = ast_for_expr(c, CHILD(n, 1));\n        if (!expression)\n            return NULL;\n        seq1 = ast_for_suite(c, CHILD(n, 3));\n        if (!seq1)\n            return NULL;\n        seq2 = ast_for_suite(c, CHILD(n, 6));\n        if (!seq2)\n            return NULL;\n\n        return If(expression, seq1, seq2, LINENO(n), n->n_col_offset,\n                  c->c_arena);\n    }\n    else if (s[2] == 'i') {\n        int i, n_elif, has_else = 0;\n        expr_ty expression;\n        asdl_seq *suite_seq;\n        asdl_seq *orelse = NULL;\n        n_elif = NCH(n) - 4;\n        /* must reference the child n_elif+1 since 'else' token is third,\n           not fourth, child from the end. */\n        if (TYPE(CHILD(n, (n_elif + 1))) == NAME\n            && STR(CHILD(n, (n_elif + 1)))[2] == 's') {\n            has_else = 1;\n            n_elif -= 3;\n        }\n        n_elif /= 4;\n\n        if (has_else) {\n            asdl_seq *suite_seq2;\n\n            orelse = asdl_seq_new(1, c->c_arena);\n            if (!orelse)\n                return NULL;\n            expression = ast_for_expr(c, CHILD(n, NCH(n) - 6));\n            if (!expression)\n                return NULL;\n            suite_seq = ast_for_suite(c, CHILD(n, NCH(n) - 4));\n            if (!suite_seq)\n                return NULL;\n            suite_seq2 = ast_for_suite(c, CHILD(n, NCH(n) - 1));\n            if (!suite_seq2)\n                return NULL;\n\n            asdl_seq_SET(orelse, 0,\n                         If(expression, suite_seq, suite_seq2,\n                            LINENO(CHILD(n, NCH(n) - 6)),\n                            CHILD(n, NCH(n) - 6)->n_col_offset,\n                            c->c_arena));\n            /* the just-created orelse handled the last elif */\n            n_elif--;\n        }\n\n        for (i = 0; i < n_elif; i++) {\n            int off = 5 + (n_elif - i - 1) * 4;\n            asdl_seq *newobj = asdl_seq_new(1, c->c_arena);\n            if (!newobj)\n                return NULL;\n            expression = ast_for_expr(c, CHILD(n, off));\n            if (!expression)\n                return NULL;\n            suite_seq = ast_for_suite(c, CHILD(n, off + 2));\n            if (!suite_seq)\n                return NULL;\n\n            asdl_seq_SET(newobj, 0,\n                         If(expression, suite_seq, orelse,\n                            LINENO(CHILD(n, off)),\n                            CHILD(n, off)->n_col_offset, c->c_arena));\n            orelse = newobj;\n        }\n        expression = ast_for_expr(c, CHILD(n, 1));\n        if (!expression)\n            return NULL;\n        suite_seq = ast_for_suite(c, CHILD(n, 3));\n        if (!suite_seq)\n            return NULL;\n        return If(expression, suite_seq, orelse,\n                  LINENO(n), n->n_col_offset, c->c_arena);\n    }\n\n    PyErr_Format(PyExc_SystemError,\n                 \"unexpected token in 'if' statement: %s\", s);\n    return NULL;\n}\n\nstatic stmt_ty\nast_for_while_stmt(struct compiling *c, const node *n)\n{\n    /* while_stmt: 'while' test ':' suite ['else' ':' suite] */\n    REQ(n, while_stmt);\n\n    if (NCH(n) == 4) {\n        expr_ty expression;\n        asdl_seq *suite_seq;\n\n        expression = ast_for_expr(c, CHILD(n, 1));\n        if (!expression)\n            return NULL;\n        suite_seq = ast_for_suite(c, CHILD(n, 3));\n        if (!suite_seq)\n            return NULL;\n        return While(expression, suite_seq, NULL, LINENO(n), n->n_col_offset,\n                     c->c_arena);\n    }\n    else if (NCH(n) == 7) {\n        expr_ty expression;\n        asdl_seq *seq1, *seq2;\n\n        expression = ast_for_expr(c, CHILD(n, 1));\n        if (!expression)\n            return NULL;\n        seq1 = ast_for_suite(c, CHILD(n, 3));\n        if (!seq1)\n            return NULL;\n        seq2 = ast_for_suite(c, CHILD(n, 6));\n        if (!seq2)\n            return NULL;\n\n        return While(expression, seq1, seq2, LINENO(n), n->n_col_offset,\n                     c->c_arena);\n    }\n\n    PyErr_Format(PyExc_SystemError,\n                 \"wrong number of tokens for 'while' statement: %d\",\n                 NCH(n));\n    return NULL;\n}\n\nstatic stmt_ty\nast_for_for_stmt(struct compiling *c, const node *n)\n{\n    asdl_seq *_target, *seq = NULL, *suite_seq;\n    expr_ty expression;\n    expr_ty target, first;\n    const node *node_target;\n    int has_type_comment;\n    string type_comment;\n    /* for_stmt: 'for' exprlist 'in' testlist ':' [TYPE_COMMENT] suite ['else' ':' suite] */\n    REQ(n, for_stmt);\n\n    has_type_comment = TYPE(CHILD(n, 5)) == TYPE_COMMENT;\n\n    if (NCH(n) == 9 + has_type_comment) {\n        seq = ast_for_suite(c, CHILD(n, 8 + has_type_comment));\n        if (!seq)\n            return NULL;\n    }\n\n    node_target = CHILD(n, 1);\n    _target = ast_for_exprlist(c, node_target, Store);\n    if (!_target)\n        return NULL;\n    /* Check the # of children rather than the length of _target, since\n       for x, in ... has 1 element in _target, but still requires a Tuple. */\n    first = (expr_ty)asdl_seq_GET(_target, 0);\n    if (NCH(node_target) == 1)\n        target = first;\n    else\n        target = Tuple(_target, Store, first->lineno, first->col_offset, c->c_arena);\n\n    expression = ast_for_testlist(c, CHILD(n, 3));\n    if (!expression)\n        return NULL;\n    suite_seq = ast_for_suite(c, CHILD(n, 5 + has_type_comment));\n    if (!suite_seq)\n        return NULL;\n\n    if (has_type_comment)\n        type_comment = NEW_TYPE_COMMENT(CHILD(n, 5));\n    else\n        type_comment = NULL;\n\n    return For(target, expression, suite_seq, seq, type_comment, LINENO(n), n->n_col_offset,\n               c->c_arena);\n}\n\nstatic excepthandler_ty\nast_for_except_clause(struct compiling *c, const node *exc, node *body)\n{\n    /* except_clause: 'except' [test [(',' | 'as') test]] */\n    REQ(exc, except_clause);\n    REQ(body, suite);\n\n    if (NCH(exc) == 1) {\n        asdl_seq *suite_seq = ast_for_suite(c, body);\n        if (!suite_seq)\n            return NULL;\n\n        return ExceptHandler(NULL, NULL, suite_seq, LINENO(exc),\n                             exc->n_col_offset, c->c_arena);\n    }\n    else if (NCH(exc) == 2) {\n        expr_ty expression;\n        asdl_seq *suite_seq;\n\n        expression = ast_for_expr(c, CHILD(exc, 1));\n        if (!expression)\n            return NULL;\n        suite_seq = ast_for_suite(c, body);\n        if (!suite_seq)\n            return NULL;\n\n        return ExceptHandler(expression, NULL, suite_seq, LINENO(exc),\n                             exc->n_col_offset, c->c_arena);\n    }\n    else if (NCH(exc) == 4) {\n        asdl_seq *suite_seq;\n        expr_ty expression;\n        expr_ty e = ast_for_expr(c, CHILD(exc, 3));\n        if (!e)\n            return NULL;\n        if (!set_context(c, e, Store, CHILD(exc, 3)))\n            return NULL;\n        expression = ast_for_expr(c, CHILD(exc, 1));\n        if (!expression)\n            return NULL;\n        suite_seq = ast_for_suite(c, body);\n        if (!suite_seq)\n            return NULL;\n\n        return ExceptHandler(expression, e, suite_seq, LINENO(exc),\n                             exc->n_col_offset, c->c_arena);\n    }\n\n    PyErr_Format(PyExc_SystemError,\n                 \"wrong number of children for 'except' clause: %d\",\n                 NCH(exc));\n    return NULL;\n}\n\nstatic stmt_ty\nast_for_try_stmt(struct compiling *c, const node *n)\n{\n    const int nch = NCH(n);\n    int n_except = (nch - 3)/3;\n    asdl_seq *body, *orelse = NULL, *finally = NULL;\n\n    REQ(n, try_stmt);\n\n    body = ast_for_suite(c, CHILD(n, 2));\n    if (body == NULL)\n        return NULL;\n\n    if (TYPE(CHILD(n, nch - 3)) == NAME) {\n        if (strcmp(STR(CHILD(n, nch - 3)), \"finally\") == 0) {\n            if (nch >= 9 && TYPE(CHILD(n, nch - 6)) == NAME) {\n                /* we can assume it's an \"else\",\n                   because nch >= 9 for try-else-finally and\n                   it would otherwise have a type of except_clause */\n                orelse = ast_for_suite(c, CHILD(n, nch - 4));\n                if (orelse == NULL)\n                    return NULL;\n                n_except--;\n            }\n\n            finally = ast_for_suite(c, CHILD(n, nch - 1));\n            if (finally == NULL)\n                return NULL;\n            n_except--;\n        }\n        else {\n            /* we can assume it's an \"else\",\n               otherwise it would have a type of except_clause */\n            orelse = ast_for_suite(c, CHILD(n, nch - 1));\n            if (orelse == NULL)\n                return NULL;\n            n_except--;\n        }\n    }\n    else if (TYPE(CHILD(n, nch - 3)) != except_clause) {\n        ast_error(n, \"malformed 'try' statement\");\n        return NULL;\n    }\n\n    if (n_except > 0) {\n        int i;\n        stmt_ty except_st;\n        /* process except statements to create a try ... except */\n        asdl_seq *handlers = asdl_seq_new(n_except, c->c_arena);\n        if (handlers == NULL)\n            return NULL;\n\n        for (i = 0; i < n_except; i++) {\n            excepthandler_ty e = ast_for_except_clause(c, CHILD(n, 3 + i * 3),\n                                                       CHILD(n, 5 + i * 3));\n            if (!e)\n                return NULL;\n            asdl_seq_SET(handlers, i, e);\n        }\n\n        except_st = TryExcept(body, handlers, orelse, LINENO(n),\n                              n->n_col_offset, c->c_arena);\n        if (!finally)\n            return except_st;\n\n        /* if a 'finally' is present too, we nest the TryExcept within a\n           TryFinally to emulate try ... except ... finally */\n        body = asdl_seq_new(1, c->c_arena);\n        if (body == NULL)\n            return NULL;\n        asdl_seq_SET(body, 0, except_st);\n    }\n\n    /* must be a try ... finally (except clauses are in body, if any exist) */\n    assert(finally != NULL);\n    return TryFinally(body, finally, LINENO(n), n->n_col_offset, c->c_arena);\n}\n\n/* with_item: test ['as' expr] */\nstatic stmt_ty\nast_for_with_item(struct compiling *c, const node *n, asdl_seq *content, string type_comment)\n{\n    expr_ty context_expr, optional_vars = NULL;\n\n    REQ(n, with_item);\n    context_expr = ast_for_expr(c, CHILD(n, 0));\n    if (!context_expr)\n        return NULL;\n    if (NCH(n) == 3) {\n        optional_vars = ast_for_expr(c, CHILD(n, 2));\n\n        if (!optional_vars) {\n            return NULL;\n        }\n        if (!set_context(c, optional_vars, Store, n)) {\n            return NULL;\n        }\n    }\n\n    return With(context_expr, optional_vars, content, type_comment, LINENO(n),\n                n->n_col_offset, c->c_arena);\n}\n\n/* with_stmt: 'with' with_item (',' with_item)*  ':' [TYPE_COMMENT] suite */\nstatic stmt_ty\nast_for_with_stmt(struct compiling *c, const node *n)\n{\n    int i, has_type_comment;\n    stmt_ty ret;\n    asdl_seq *inner;\n    string type_comment;\n\n    REQ(n, with_stmt);\n\n    has_type_comment = TYPE(CHILD(n, NCH(n) - 2)) == TYPE_COMMENT;\n\n    /* process the with items inside-out */\n    i = NCH(n) - 1;\n    /* the suite of the innermost with item is the suite of the with stmt */\n    inner = ast_for_suite(c, CHILD(n, i));\n    if (!inner)\n        return NULL;\n\n    if (has_type_comment) {\n        type_comment = NEW_TYPE_COMMENT(CHILD(n, NCH(n) - 2));\n        i--;\n    } else\n        type_comment = NULL;\n\n\n    for (;;) {\n        i -= 2;\n        ret = ast_for_with_item(c, CHILD(n, i), inner, type_comment);\n        if (!ret)\n            return NULL;\n        /* was this the last item? */\n        if (i == 1)\n            break;\n        /* if not, wrap the result so far in a new sequence */\n        inner = asdl_seq_new(1, c->c_arena);\n        if (!inner)\n            return NULL;\n        asdl_seq_SET(inner, 0, ret);\n    }\n\n    return ret;\n}\n\nstatic stmt_ty\nast_for_classdef(struct compiling *c, const node *n, asdl_seq *decorator_seq)\n{\n    /* classdef: 'class' NAME ['(' testlist ')'] ':' suite */\n    PyObject *classname;\n    asdl_seq *bases, *s;\n\n    REQ(n, classdef);\n\n    if (!forbidden_check(c, n, STR(CHILD(n, 1))))\n            return NULL;\n\n    if (NCH(n) == 4) {\n        s = ast_for_suite(c, CHILD(n, 3));\n        if (!s)\n            return NULL;\n        classname = NEW_IDENTIFIER(CHILD(n, 1));\n        if (!classname)\n            return NULL;\n        return ClassDef(classname, NULL, s, decorator_seq, LINENO(n),\n                        n->n_col_offset, c->c_arena);\n    }\n    /* check for empty base list */\n    if (TYPE(CHILD(n,3)) == RPAR) {\n        s = ast_for_suite(c, CHILD(n,5));\n        if (!s)\n            return NULL;\n        classname = NEW_IDENTIFIER(CHILD(n, 1));\n        if (!classname)\n            return NULL;\n        return ClassDef(classname, NULL, s, decorator_seq, LINENO(n),\n                        n->n_col_offset, c->c_arena);\n    }\n\n    /* else handle the base class list */\n    bases = ast_for_class_bases(c, CHILD(n, 3));\n    if (!bases)\n        return NULL;\n\n    s = ast_for_suite(c, CHILD(n, 6));\n    if (!s)\n        return NULL;\n    classname = NEW_IDENTIFIER(CHILD(n, 1));\n    if (!classname)\n        return NULL;\n    return ClassDef(classname, bases, s, decorator_seq,\n                    LINENO(n), n->n_col_offset, c->c_arena);\n}\n\nstatic stmt_ty\nast_for_stmt(struct compiling *c, const node *n)\n{\n    if (TYPE(n) == stmt) {\n        assert(NCH(n) == 1);\n        n = CHILD(n, 0);\n    }\n    if (TYPE(n) == simple_stmt) {\n        assert(num_stmts(n) == 1);\n        n = CHILD(n, 0);\n    }\n    if (TYPE(n) == small_stmt) {\n        n = CHILD(n, 0);\n        /* small_stmt: expr_stmt | print_stmt  | del_stmt | pass_stmt\n                     | flow_stmt | import_stmt | global_stmt | exec_stmt\n                     | assert_stmt\n        */\n        switch (TYPE(n)) {\n            case expr_stmt:\n                return ast_for_expr_stmt(c, n);\n            case print_stmt:\n                return ast_for_print_stmt(c, n);\n            case del_stmt:\n                return ast_for_del_stmt(c, n);\n            case pass_stmt:\n                return Pass(LINENO(n), n->n_col_offset, c->c_arena);\n            case flow_stmt:\n                return ast_for_flow_stmt(c, n);\n            case import_stmt:\n                return ast_for_import_stmt(c, n);\n            case global_stmt:\n                return ast_for_global_stmt(c, n);\n            case exec_stmt:\n                return ast_for_exec_stmt(c, n);\n            case assert_stmt:\n                return ast_for_assert_stmt(c, n);\n            default:\n                PyErr_Format(PyExc_SystemError,\n                             \"unhandled small_stmt: TYPE=%d NCH=%d\\n\",\n                             TYPE(n), NCH(n));\n                return NULL;\n        }\n    }\n    else {\n        /* compound_stmt: if_stmt | while_stmt | for_stmt | try_stmt\n                        | funcdef | classdef | decorated\n        */\n        node *ch = CHILD(n, 0);\n        REQ(n, compound_stmt);\n        switch (TYPE(ch)) {\n            case if_stmt:\n                return ast_for_if_stmt(c, ch);\n            case while_stmt:\n                return ast_for_while_stmt(c, ch);\n            case for_stmt:\n                return ast_for_for_stmt(c, ch);\n            case try_stmt:\n                return ast_for_try_stmt(c, ch);\n            case with_stmt:\n                return ast_for_with_stmt(c, ch);\n            case funcdef:\n                return ast_for_funcdef(c, ch, NULL);\n            case classdef:\n                return ast_for_classdef(c, ch, NULL);\n            case decorated:\n                return ast_for_decorated(c, ch);\n            default:\n                PyErr_Format(PyExc_SystemError,\n                             \"unhandled small_stmt: TYPE=%d NCH=%d\\n\",\n                             TYPE(n), NCH(n));\n                return NULL;\n        }\n    }\n}\n\nstatic PyObject *\nparsenumber(struct compiling *c, const char *s)\n{\n        const char *end;\n        long x;\n        double dx;\n        int old_style_octal;\n#ifndef WITHOUT_COMPLEX\n        Py_complex complex;\n        int imflag;\n#endif\n\n        assert(s != NULL);\n        errno = 0;\n        end = s + strlen(s) - 1;\n#ifndef WITHOUT_COMPLEX\n        imflag = *end == 'j' || *end == 'J';\n#endif\n        if (*end == 'l' || *end == 'L') {\n                /* Make a copy without the trailing 'L' */\n                size_t len = end - s  + 1;\n                char *copy = malloc(len);\n                PyObject *result;\n                if (copy == NULL)\n                        return PyErr_NoMemory();\n                memcpy(copy, s, len);\n                copy[len - 1] = '\\0';\n                old_style_octal = len > 2 && copy[0] == '0' && copy[1] >= '0' && copy[1] <= '9';\n                result = PyLong_FromString(copy, (char **)0, old_style_octal ? 8 : 0);\n                free(copy);\n                return result;\n        }\n        x = Ta27OS_strtol((char *)s, (char **)&end, 0);\n        if (*end == '\\0') {\n                if (errno != 0) {\n                        old_style_octal = end - s > 1 && s[0] == '0' && s[1] >= '0' && s[1] <= '9';\n                        return PyLong_FromString((char *)s, (char **)0, old_style_octal ? 8 : 0);\n                }\n                return PyLong_FromLong(x);\n        }\n        /* XXX Huge floats may silently fail */\n#ifndef WITHOUT_COMPLEX\n        if (imflag) {\n                complex.real = 0.;\n                complex.imag = PyOS_string_to_double(s, (char **)&end, NULL);\n                if (complex.imag == -1.0 && PyErr_Occurred())\n                        return NULL;\n                return PyComplex_FromCComplex(complex);\n        }\n        else\n#endif\n        {\n                dx = PyOS_string_to_double(s, NULL, NULL);\n                if (dx == -1.0 && PyErr_Occurred())\n                        return NULL;\n                return PyFloat_FromDouble(dx);\n        }\n}\n\n/* adapted from Python 3.5.1 */\nstatic PyObject *\ndecode_utf8(struct compiling *c, const char **sPtr, const char *end)\n{\n#ifndef Py_USING_UNICODE\n        Py_FatalError(\"decode_utf8 should not be called in this build.\");\n        return NULL;\n#else\n    const char *s, *t;\n    t = s = *sPtr;\n    /* while (s < end && *s != '\\\\') s++; */ /* inefficient for u\"..\" */\n    while (s < end && (*s & 0x80)) s++;\n    *sPtr = s;\n    return PyUnicode_DecodeUTF8(t, s - t, NULL);\n#endif\n}\n\n#ifdef Py_USING_UNICODE\n/* taken from Python 3.5.1 */\nstatic PyObject *\ndecode_unicode(struct compiling *c, const char *s, size_t len, int rawmode, const char *encoding)\n{\n    PyObject *v, *u;\n    char *buf;\n    char *p;\n    const char *end;\n\n    if (encoding == NULL) {\n        u = NULL;\n    } else {\n        /* check for integer overflow */\n        if (len > PY_SIZE_MAX / 6)\n            return NULL;\n        /* \"ä\" (2 bytes) may become \"\\U000000E4\" (10 bytes), or 1:5\n           \"\\ä\" (3 bytes) may become \"\\u005c\\U000000E4\" (16 bytes), or ~1:6 */\n        u = PyBytes_FromStringAndSize((char *)NULL, len * 6);\n        if (u == NULL)\n            return NULL;\n        p = buf = PyBytes_AsString(u);\n        end = s + len;\n        while (s < end) {\n            if (*s == '\\\\') {\n                *p++ = *s++;\n                if (*s & 0x80) {\n                    strcpy(p, \"u005c\");\n                    p += 5;\n                }\n            }\n            if (*s & 0x80) { /* XXX inefficient */\n                PyObject *w;\n                int kind;\n                void *data;\n                Py_ssize_t len, i;\n                w = decode_utf8(c, &s, end);\n                if (w == NULL) {\n                    Py_DECREF(u);\n                    return NULL;\n                }\n                kind = PyUnicode_KIND(w);\n                data = PyUnicode_DATA(w);\n                len = PyUnicode_GET_LENGTH(w);\n                for (i = 0; i < len; i++) {\n                    Py_UCS4 chr = PyUnicode_READ(kind, data, i);\n                    sprintf(p, \"\\\\U%08x\", chr);\n                    p += 10;\n                }\n                /* Should be impossible to overflow */\n                assert(p - buf <= Py_SIZE(u));\n                Py_DECREF(w);\n            } else {\n                *p++ = *s++;\n            }\n        }\n        len = p - buf;\n        s = buf;\n    }\n    if (rawmode)\n        v = PyUnicode_DecodeRawUnicodeEscape(s, len, NULL);\n    else\n        v = PyUnicode_DecodeUnicodeEscape(s, len, NULL);\n    Py_XDECREF(u);\n    return v;\n}\n#endif\n\n/* s is a Python string literal, including the bracketing quote characters,\n * and r &/or u prefixes (if any), and embedded escape sequences (if any).\n * parsestr parses it, and returns the decoded Python string object.\n */\nstatic PyObject *\nparsestr(struct compiling *c, const node *n, const char *s)\n{\n        size_t len, i;\n        int quote = Py_CHARMASK(*s);\n        int rawmode = 0;\n        int need_encoding;\n        int unicode = c->c_future_unicode;\n        int bytes = 0;\n\n        if (isalpha(quote) || quote == '_') {\n                if (quote == 'u' || quote == 'U') {\n                        quote = *++s;\n                        unicode = 1;\n                }\n                if (quote == 'b' || quote == 'B') {\n                        quote = *++s;\n                        unicode = 0;\n                        bytes = 1;\n                }\n                if (quote == 'r' || quote == 'R') {\n                        quote = *++s;\n                        rawmode = 1;\n                }\n        }\n        if (quote != '\\'' && quote != '\\\"') {\n                PyErr_BadInternalCall();\n                return NULL;\n        }\n        s++;\n        len = strlen(s);\n        if (len > INT_MAX) {\n                PyErr_SetString(PyExc_OverflowError,\n                                \"string to parse is too long\");\n                return NULL;\n        }\n        if (s[--len] != quote) {\n                PyErr_BadInternalCall();\n                return NULL;\n        }\n        if (len >= 4 && s[0] == quote && s[1] == quote) {\n                s += 2;\n                len -= 2;\n                if (s[--len] != quote || s[--len] != quote) {\n                        PyErr_BadInternalCall();\n                        return NULL;\n                }\n        }\n        if (Py_Py3kWarningFlag && bytes) {\n            for (i = 0; i < len; i++) {\n                if ((unsigned char)s[i] > 127) {\n                    if (!ast_warn(c, n,\n                        \"non-ascii bytes literals not supported in 3.x\"))\n                        return NULL;\n                    break;\n                }\n            }\n        }\n#ifdef Py_USING_UNICODE\n        if (unicode || Py_UnicodeFlag) {\n                return decode_unicode(c, s, len, rawmode, c->c_encoding);\n        }\n#endif\n        need_encoding = (c->c_encoding != NULL &&\n                         strcmp(c->c_encoding, \"utf-8\") != 0 &&\n                         strcmp(c->c_encoding, \"iso-8859-1\") != 0);\n        if (rawmode || strchr(s, '\\\\') == NULL) {\n                if (need_encoding) {\n#ifndef Py_USING_UNICODE\n                        /* This should not happen - we never see any other\n                           encoding. */\n                        Py_FatalError(\n                            \"cannot deal with encodings in this build.\");\n#else\n                        PyObject *v, *u = PyUnicode_DecodeUTF8(s, len, NULL);\n                        if (u == NULL)\n                                return NULL;\n                        v = PyUnicode_AsEncodedString(u, c->c_encoding, NULL);\n                        Py_DECREF(u);\n                        return v;\n#endif\n                } else {\n                  return PyBytes_FromStringAndSize(s, len);\n                }\n        }\n\n        return PyBytes_DecodeEscape(s, len, NULL, 1,\n                                    need_encoding ? c->c_encoding : NULL);\n}\n\n/* Build a Python string object out of a STRING atom.  This takes care of\n * compile-time literal catenation, calling parsestr() on each piece, and\n * pasting the intermediate results together.\n */\nstatic PyObject *\nparsestrplus(struct compiling *c, const node *n)\n{\n        PyObject *v;\n        int i;\n        REQ(CHILD(n, 0), STRING);\n        if ((v = parsestr(c, n, STR(CHILD(n, 0)))) != NULL) {\n                /* String literal concatenation */\n                for (i = 1; i < NCH(n); i++) {\n                        PyObject *s;\n                        s = parsestr(c, n, STR(CHILD(n, i)));\n                        if (s == NULL)\n                                goto onError;\n                        if (PyBytes_Check(v) && PyBytes_Check(s)) {\n                                PyBytes_ConcatAndDel(&v, s);\n                                if (v == NULL)\n                                    goto onError;\n                        }\n#ifdef Py_USING_UNICODE\n                        else {\n                                PyObject *temp;\n                                /* Python 2's PyUnicode_FromObject (which is\n                                 * called on the arguments to PyUnicode_Concat)\n                                 * automatically converts Bytes objects into\n                                 * Str objects, but in Python 3 it throws a\n                                 * syntax error.  To allow mixed literal\n                                 * concatenation e.g. \"foo\" u\"bar\" (which is\n                                 * valid in Python 2), we have to explicitly\n                                 * check for Bytes and convert manually. */\n                                if (PyBytes_Check(s)) {\n                                    temp = PyUnicode_FromEncodedObject(s, NULL, \"strict\");\n                                    Py_DECREF(s);\n                                    s = temp;\n                                }\n\n                                if (PyBytes_Check(v)) {\n                                    temp = PyUnicode_FromEncodedObject(v, NULL, \"strict\");\n                                    Py_DECREF(v);\n                                    v = temp;\n                                }\n\n                                temp = PyUnicode_Concat(v, s);\n                                Py_DECREF(s);\n                                Py_DECREF(v);\n                                v = temp;\n                                if (v == NULL)\n                                    goto onError;\n                        }\n#endif\n                }\n        }\n        return v;\n\n onError:\n        Py_XDECREF(v);\n        return NULL;\n}\n"
  },
  {
    "path": "ast27/Python/graminit.c",
    "content": "/* Generated by Parser/pgen */\n\n#include \"../Include/pgenheaders.h\"\n#include \"../Include/grammar.h\"\ngrammar _Ta27Parser_Grammar;\nstatic arc arcs_0_0[3] = {\n    {2, 1},\n    {3, 1},\n    {4, 2},\n};\nstatic arc arcs_0_1[1] = {\n    {0, 1},\n};\nstatic arc arcs_0_2[1] = {\n    {2, 1},\n};\nstatic state states_0[3] = {\n    {3, arcs_0_0},\n    {1, arcs_0_1},\n    {1, arcs_0_2},\n};\nstatic arc arcs_1_0[3] = {\n    {2, 0},\n    {6, 0},\n    {7, 1},\n};\nstatic arc arcs_1_1[1] = {\n    {0, 1},\n};\nstatic state states_1[2] = {\n    {3, arcs_1_0},\n    {1, arcs_1_1},\n};\nstatic arc arcs_2_0[1] = {\n    {9, 1},\n};\nstatic arc arcs_2_1[2] = {\n    {2, 1},\n    {7, 2},\n};\nstatic arc arcs_2_2[1] = {\n    {0, 2},\n};\nstatic state states_2[3] = {\n    {1, arcs_2_0},\n    {2, arcs_2_1},\n    {1, arcs_2_2},\n};\nstatic arc arcs_3_0[1] = {\n    {11, 1},\n};\nstatic arc arcs_3_1[1] = {\n    {12, 2},\n};\nstatic arc arcs_3_2[2] = {\n    {13, 3},\n    {2, 4},\n};\nstatic arc arcs_3_3[2] = {\n    {14, 5},\n    {15, 6},\n};\nstatic arc arcs_3_4[1] = {\n    {0, 4},\n};\nstatic arc arcs_3_5[1] = {\n    {15, 6},\n};\nstatic arc arcs_3_6[1] = {\n    {2, 4},\n};\nstatic state states_3[7] = {\n    {1, arcs_3_0},\n    {1, arcs_3_1},\n    {2, arcs_3_2},\n    {2, arcs_3_3},\n    {1, arcs_3_4},\n    {1, arcs_3_5},\n    {1, arcs_3_6},\n};\nstatic arc arcs_4_0[1] = {\n    {10, 1},\n};\nstatic arc arcs_4_1[2] = {\n    {10, 1},\n    {0, 1},\n};\nstatic state states_4[2] = {\n    {1, arcs_4_0},\n    {2, arcs_4_1},\n};\nstatic arc arcs_5_0[1] = {\n    {16, 1},\n};\nstatic arc arcs_5_1[2] = {\n    {18, 2},\n    {19, 2},\n};\nstatic arc arcs_5_2[1] = {\n    {0, 2},\n};\nstatic state states_5[3] = {\n    {1, arcs_5_0},\n    {2, arcs_5_1},\n    {1, arcs_5_2},\n};\nstatic arc arcs_6_0[1] = {\n    {20, 1},\n};\nstatic arc arcs_6_1[1] = {\n    {21, 2},\n};\nstatic arc arcs_6_2[1] = {\n    {22, 3},\n};\nstatic arc arcs_6_3[1] = {\n    {23, 4},\n};\nstatic arc arcs_6_4[2] = {\n    {24, 5},\n    {25, 6},\n};\nstatic arc arcs_6_5[1] = {\n    {25, 6},\n};\nstatic arc arcs_6_6[1] = {\n    {0, 6},\n};\nstatic state states_6[7] = {\n    {1, arcs_6_0},\n    {1, arcs_6_1},\n    {1, arcs_6_2},\n    {1, arcs_6_3},\n    {2, arcs_6_4},\n    {1, arcs_6_5},\n    {1, arcs_6_6},\n};\nstatic arc arcs_7_0[1] = {\n    {13, 1},\n};\nstatic arc arcs_7_1[2] = {\n    {26, 2},\n    {15, 3},\n};\nstatic arc arcs_7_2[1] = {\n    {15, 3},\n};\nstatic arc arcs_7_3[1] = {\n    {0, 3},\n};\nstatic state states_7[4] = {\n    {1, arcs_7_0},\n    {2, arcs_7_1},\n    {1, arcs_7_2},\n    {1, arcs_7_3},\n};\nstatic arc arcs_8_0[3] = {\n    {27, 1},\n    {31, 2},\n    {32, 3},\n};\nstatic arc arcs_8_1[4] = {\n    {28, 4},\n    {30, 5},\n    {24, 6},\n    {0, 1},\n};\nstatic arc arcs_8_2[1] = {\n    {21, 7},\n};\nstatic arc arcs_8_3[1] = {\n    {21, 8},\n};\nstatic arc arcs_8_4[1] = {\n    {29, 9},\n};\nstatic arc arcs_8_5[5] = {\n    {27, 1},\n    {24, 10},\n    {31, 2},\n    {32, 3},\n    {0, 5},\n};\nstatic arc arcs_8_6[1] = {\n    {0, 6},\n};\nstatic arc arcs_8_7[3] = {\n    {30, 11},\n    {24, 6},\n    {0, 7},\n};\nstatic arc arcs_8_8[2] = {\n    {24, 6},\n    {0, 8},\n};\nstatic arc arcs_8_9[3] = {\n    {30, 5},\n    {24, 6},\n    {0, 9},\n};\nstatic arc arcs_8_10[4] = {\n    {27, 1},\n    {31, 2},\n    {32, 3},\n    {0, 10},\n};\nstatic arc arcs_8_11[2] = {\n    {24, 12},\n    {32, 3},\n};\nstatic arc arcs_8_12[1] = {\n    {32, 3},\n};\nstatic state states_8[13] = {\n    {3, arcs_8_0},\n    {4, arcs_8_1},\n    {1, arcs_8_2},\n    {1, arcs_8_3},\n    {1, arcs_8_4},\n    {5, arcs_8_5},\n    {1, arcs_8_6},\n    {3, arcs_8_7},\n    {2, arcs_8_8},\n    {3, arcs_8_9},\n    {4, arcs_8_10},\n    {2, arcs_8_11},\n    {1, arcs_8_12},\n};\nstatic arc arcs_9_0[2] = {\n    {21, 1},\n    {13, 2},\n};\nstatic arc arcs_9_1[1] = {\n    {0, 1},\n};\nstatic arc arcs_9_2[1] = {\n    {33, 3},\n};\nstatic arc arcs_9_3[1] = {\n    {15, 1},\n};\nstatic state states_9[4] = {\n    {2, arcs_9_0},\n    {1, arcs_9_1},\n    {1, arcs_9_2},\n    {1, arcs_9_3},\n};\nstatic arc arcs_10_0[1] = {\n    {27, 1},\n};\nstatic arc arcs_10_1[2] = {\n    {30, 2},\n    {0, 1},\n};\nstatic arc arcs_10_2[2] = {\n    {27, 1},\n    {0, 2},\n};\nstatic state states_10[3] = {\n    {1, arcs_10_0},\n    {2, arcs_10_1},\n    {2, arcs_10_2},\n};\nstatic arc arcs_11_0[2] = {\n    {3, 1},\n    {4, 1},\n};\nstatic arc arcs_11_1[1] = {\n    {0, 1},\n};\nstatic state states_11[2] = {\n    {2, arcs_11_0},\n    {1, arcs_11_1},\n};\nstatic arc arcs_12_0[1] = {\n    {34, 1},\n};\nstatic arc arcs_12_1[2] = {\n    {35, 2},\n    {2, 3},\n};\nstatic arc arcs_12_2[2] = {\n    {34, 1},\n    {2, 3},\n};\nstatic arc arcs_12_3[1] = {\n    {0, 3},\n};\nstatic state states_12[4] = {\n    {1, arcs_12_0},\n    {2, arcs_12_1},\n    {2, arcs_12_2},\n    {1, arcs_12_3},\n};\nstatic arc arcs_13_0[9] = {\n    {36, 1},\n    {37, 1},\n    {38, 1},\n    {39, 1},\n    {40, 1},\n    {41, 1},\n    {42, 1},\n    {43, 1},\n    {44, 1},\n};\nstatic arc arcs_13_1[1] = {\n    {0, 1},\n};\nstatic state states_13[2] = {\n    {9, arcs_13_0},\n    {1, arcs_13_1},\n};\nstatic arc arcs_14_0[1] = {\n    {9, 1},\n};\nstatic arc arcs_14_1[4] = {\n    {45, 2},\n    {28, 3},\n    {24, 4},\n    {0, 1},\n};\nstatic arc arcs_14_2[2] = {\n    {46, 4},\n    {9, 4},\n};\nstatic arc arcs_14_3[2] = {\n    {46, 5},\n    {9, 5},\n};\nstatic arc arcs_14_4[1] = {\n    {0, 4},\n};\nstatic arc arcs_14_5[3] = {\n    {28, 3},\n    {24, 4},\n    {0, 5},\n};\nstatic state states_14[6] = {\n    {1, arcs_14_0},\n    {4, arcs_14_1},\n    {2, arcs_14_2},\n    {2, arcs_14_3},\n    {1, arcs_14_4},\n    {3, arcs_14_5},\n};\nstatic arc arcs_15_0[12] = {\n    {47, 1},\n    {48, 1},\n    {49, 1},\n    {50, 1},\n    {51, 1},\n    {52, 1},\n    {53, 1},\n    {54, 1},\n    {55, 1},\n    {56, 1},\n    {57, 1},\n    {58, 1},\n};\nstatic arc arcs_15_1[1] = {\n    {0, 1},\n};\nstatic state states_15[2] = {\n    {12, arcs_15_0},\n    {1, arcs_15_1},\n};\nstatic arc arcs_16_0[1] = {\n    {59, 1},\n};\nstatic arc arcs_16_1[3] = {\n    {29, 2},\n    {60, 3},\n    {0, 1},\n};\nstatic arc arcs_16_2[2] = {\n    {30, 4},\n    {0, 2},\n};\nstatic arc arcs_16_3[1] = {\n    {29, 5},\n};\nstatic arc arcs_16_4[2] = {\n    {29, 2},\n    {0, 4},\n};\nstatic arc arcs_16_5[2] = {\n    {30, 6},\n    {0, 5},\n};\nstatic arc arcs_16_6[1] = {\n    {29, 7},\n};\nstatic arc arcs_16_7[2] = {\n    {30, 8},\n    {0, 7},\n};\nstatic arc arcs_16_8[2] = {\n    {29, 7},\n    {0, 8},\n};\nstatic state states_16[9] = {\n    {1, arcs_16_0},\n    {3, arcs_16_1},\n    {2, arcs_16_2},\n    {1, arcs_16_3},\n    {2, arcs_16_4},\n    {2, arcs_16_5},\n    {1, arcs_16_6},\n    {2, arcs_16_7},\n    {2, arcs_16_8},\n};\nstatic arc arcs_17_0[1] = {\n    {61, 1},\n};\nstatic arc arcs_17_1[1] = {\n    {62, 2},\n};\nstatic arc arcs_17_2[1] = {\n    {0, 2},\n};\nstatic state states_17[3] = {\n    {1, arcs_17_0},\n    {1, arcs_17_1},\n    {1, arcs_17_2},\n};\nstatic arc arcs_18_0[1] = {\n    {63, 1},\n};\nstatic arc arcs_18_1[1] = {\n    {0, 1},\n};\nstatic state states_18[2] = {\n    {1, arcs_18_0},\n    {1, arcs_18_1},\n};\nstatic arc arcs_19_0[5] = {\n    {64, 1},\n    {65, 1},\n    {66, 1},\n    {67, 1},\n    {68, 1},\n};\nstatic arc arcs_19_1[1] = {\n    {0, 1},\n};\nstatic state states_19[2] = {\n    {5, arcs_19_0},\n    {1, arcs_19_1},\n};\nstatic arc arcs_20_0[1] = {\n    {69, 1},\n};\nstatic arc arcs_20_1[1] = {\n    {0, 1},\n};\nstatic state states_20[2] = {\n    {1, arcs_20_0},\n    {1, arcs_20_1},\n};\nstatic arc arcs_21_0[1] = {\n    {70, 1},\n};\nstatic arc arcs_21_1[1] = {\n    {0, 1},\n};\nstatic state states_21[2] = {\n    {1, arcs_21_0},\n    {1, arcs_21_1},\n};\nstatic arc arcs_22_0[1] = {\n    {71, 1},\n};\nstatic arc arcs_22_1[2] = {\n    {9, 2},\n    {0, 1},\n};\nstatic arc arcs_22_2[1] = {\n    {0, 2},\n};\nstatic state states_22[3] = {\n    {1, arcs_22_0},\n    {2, arcs_22_1},\n    {1, arcs_22_2},\n};\nstatic arc arcs_23_0[1] = {\n    {46, 1},\n};\nstatic arc arcs_23_1[1] = {\n    {0, 1},\n};\nstatic state states_23[2] = {\n    {1, arcs_23_0},\n    {1, arcs_23_1},\n};\nstatic arc arcs_24_0[1] = {\n    {72, 1},\n};\nstatic arc arcs_24_1[2] = {\n    {29, 2},\n    {0, 1},\n};\nstatic arc arcs_24_2[2] = {\n    {30, 3},\n    {0, 2},\n};\nstatic arc arcs_24_3[1] = {\n    {29, 4},\n};\nstatic arc arcs_24_4[2] = {\n    {30, 5},\n    {0, 4},\n};\nstatic arc arcs_24_5[1] = {\n    {29, 6},\n};\nstatic arc arcs_24_6[1] = {\n    {0, 6},\n};\nstatic state states_24[7] = {\n    {1, arcs_24_0},\n    {2, arcs_24_1},\n    {2, arcs_24_2},\n    {1, arcs_24_3},\n    {2, arcs_24_4},\n    {1, arcs_24_5},\n    {1, arcs_24_6},\n};\nstatic arc arcs_25_0[2] = {\n    {73, 1},\n    {74, 1},\n};\nstatic arc arcs_25_1[1] = {\n    {0, 1},\n};\nstatic state states_25[2] = {\n    {2, arcs_25_0},\n    {1, arcs_25_1},\n};\nstatic arc arcs_26_0[1] = {\n    {75, 1},\n};\nstatic arc arcs_26_1[1] = {\n    {76, 2},\n};\nstatic arc arcs_26_2[1] = {\n    {0, 2},\n};\nstatic state states_26[3] = {\n    {1, arcs_26_0},\n    {1, arcs_26_1},\n    {1, arcs_26_2},\n};\nstatic arc arcs_27_0[1] = {\n    {77, 1},\n};\nstatic arc arcs_27_1[2] = {\n    {78, 2},\n    {12, 3},\n};\nstatic arc arcs_27_2[3] = {\n    {78, 2},\n    {12, 3},\n    {75, 4},\n};\nstatic arc arcs_27_3[1] = {\n    {75, 4},\n};\nstatic arc arcs_27_4[3] = {\n    {31, 5},\n    {13, 6},\n    {79, 5},\n};\nstatic arc arcs_27_5[1] = {\n    {0, 5},\n};\nstatic arc arcs_27_6[1] = {\n    {79, 7},\n};\nstatic arc arcs_27_7[1] = {\n    {15, 5},\n};\nstatic state states_27[8] = {\n    {1, arcs_27_0},\n    {2, arcs_27_1},\n    {3, arcs_27_2},\n    {1, arcs_27_3},\n    {3, arcs_27_4},\n    {1, arcs_27_5},\n    {1, arcs_27_6},\n    {1, arcs_27_7},\n};\nstatic arc arcs_28_0[1] = {\n    {21, 1},\n};\nstatic arc arcs_28_1[2] = {\n    {81, 2},\n    {0, 1},\n};\nstatic arc arcs_28_2[1] = {\n    {21, 3},\n};\nstatic arc arcs_28_3[1] = {\n    {0, 3},\n};\nstatic state states_28[4] = {\n    {1, arcs_28_0},\n    {2, arcs_28_1},\n    {1, arcs_28_2},\n    {1, arcs_28_3},\n};\nstatic arc arcs_29_0[1] = {\n    {12, 1},\n};\nstatic arc arcs_29_1[2] = {\n    {81, 2},\n    {0, 1},\n};\nstatic arc arcs_29_2[1] = {\n    {21, 3},\n};\nstatic arc arcs_29_3[1] = {\n    {0, 3},\n};\nstatic state states_29[4] = {\n    {1, arcs_29_0},\n    {2, arcs_29_1},\n    {1, arcs_29_2},\n    {1, arcs_29_3},\n};\nstatic arc arcs_30_0[1] = {\n    {80, 1},\n};\nstatic arc arcs_30_1[2] = {\n    {30, 2},\n    {0, 1},\n};\nstatic arc arcs_30_2[2] = {\n    {80, 1},\n    {0, 2},\n};\nstatic state states_30[3] = {\n    {1, arcs_30_0},\n    {2, arcs_30_1},\n    {2, arcs_30_2},\n};\nstatic arc arcs_31_0[1] = {\n    {82, 1},\n};\nstatic arc arcs_31_1[2] = {\n    {30, 0},\n    {0, 1},\n};\nstatic state states_31[2] = {\n    {1, arcs_31_0},\n    {2, arcs_31_1},\n};\nstatic arc arcs_32_0[1] = {\n    {21, 1},\n};\nstatic arc arcs_32_1[2] = {\n    {78, 0},\n    {0, 1},\n};\nstatic state states_32[2] = {\n    {1, arcs_32_0},\n    {2, arcs_32_1},\n};\nstatic arc arcs_33_0[1] = {\n    {83, 1},\n};\nstatic arc arcs_33_1[1] = {\n    {21, 2},\n};\nstatic arc arcs_33_2[2] = {\n    {30, 1},\n    {0, 2},\n};\nstatic state states_33[3] = {\n    {1, arcs_33_0},\n    {1, arcs_33_1},\n    {2, arcs_33_2},\n};\nstatic arc arcs_34_0[1] = {\n    {84, 1},\n};\nstatic arc arcs_34_1[1] = {\n    {85, 2},\n};\nstatic arc arcs_34_2[2] = {\n    {86, 3},\n    {0, 2},\n};\nstatic arc arcs_34_3[1] = {\n    {29, 4},\n};\nstatic arc arcs_34_4[2] = {\n    {30, 5},\n    {0, 4},\n};\nstatic arc arcs_34_5[1] = {\n    {29, 6},\n};\nstatic arc arcs_34_6[1] = {\n    {0, 6},\n};\nstatic state states_34[7] = {\n    {1, arcs_34_0},\n    {1, arcs_34_1},\n    {2, arcs_34_2},\n    {1, arcs_34_3},\n    {2, arcs_34_4},\n    {1, arcs_34_5},\n    {1, arcs_34_6},\n};\nstatic arc arcs_35_0[1] = {\n    {87, 1},\n};\nstatic arc arcs_35_1[1] = {\n    {29, 2},\n};\nstatic arc arcs_35_2[2] = {\n    {30, 3},\n    {0, 2},\n};\nstatic arc arcs_35_3[1] = {\n    {29, 4},\n};\nstatic arc arcs_35_4[1] = {\n    {0, 4},\n};\nstatic state states_35[5] = {\n    {1, arcs_35_0},\n    {1, arcs_35_1},\n    {2, arcs_35_2},\n    {1, arcs_35_3},\n    {1, arcs_35_4},\n};\nstatic arc arcs_36_0[8] = {\n    {88, 1},\n    {89, 1},\n    {90, 1},\n    {91, 1},\n    {92, 1},\n    {19, 1},\n    {18, 1},\n    {17, 1},\n};\nstatic arc arcs_36_1[1] = {\n    {0, 1},\n};\nstatic state states_36[2] = {\n    {8, arcs_36_0},\n    {1, arcs_36_1},\n};\nstatic arc arcs_37_0[1] = {\n    {93, 1},\n};\nstatic arc arcs_37_1[1] = {\n    {29, 2},\n};\nstatic arc arcs_37_2[1] = {\n    {23, 3},\n};\nstatic arc arcs_37_3[1] = {\n    {25, 4},\n};\nstatic arc arcs_37_4[3] = {\n    {94, 1},\n    {95, 5},\n    {0, 4},\n};\nstatic arc arcs_37_5[1] = {\n    {23, 6},\n};\nstatic arc arcs_37_6[1] = {\n    {25, 7},\n};\nstatic arc arcs_37_7[1] = {\n    {0, 7},\n};\nstatic state states_37[8] = {\n    {1, arcs_37_0},\n    {1, arcs_37_1},\n    {1, arcs_37_2},\n    {1, arcs_37_3},\n    {3, arcs_37_4},\n    {1, arcs_37_5},\n    {1, arcs_37_6},\n    {1, arcs_37_7},\n};\nstatic arc arcs_38_0[1] = {\n    {96, 1},\n};\nstatic arc arcs_38_1[1] = {\n    {29, 2},\n};\nstatic arc arcs_38_2[1] = {\n    {23, 3},\n};\nstatic arc arcs_38_3[1] = {\n    {25, 4},\n};\nstatic arc arcs_38_4[2] = {\n    {95, 5},\n    {0, 4},\n};\nstatic arc arcs_38_5[1] = {\n    {23, 6},\n};\nstatic arc arcs_38_6[1] = {\n    {25, 7},\n};\nstatic arc arcs_38_7[1] = {\n    {0, 7},\n};\nstatic state states_38[8] = {\n    {1, arcs_38_0},\n    {1, arcs_38_1},\n    {1, arcs_38_2},\n    {1, arcs_38_3},\n    {2, arcs_38_4},\n    {1, arcs_38_5},\n    {1, arcs_38_6},\n    {1, arcs_38_7},\n};\nstatic arc arcs_39_0[1] = {\n    {97, 1},\n};\nstatic arc arcs_39_1[1] = {\n    {62, 2},\n};\nstatic arc arcs_39_2[1] = {\n    {86, 3},\n};\nstatic arc arcs_39_3[1] = {\n    {9, 4},\n};\nstatic arc arcs_39_4[1] = {\n    {23, 5},\n};\nstatic arc arcs_39_5[2] = {\n    {24, 6},\n    {25, 7},\n};\nstatic arc arcs_39_6[1] = {\n    {25, 7},\n};\nstatic arc arcs_39_7[2] = {\n    {95, 8},\n    {0, 7},\n};\nstatic arc arcs_39_8[1] = {\n    {23, 9},\n};\nstatic arc arcs_39_9[1] = {\n    {25, 10},\n};\nstatic arc arcs_39_10[1] = {\n    {0, 10},\n};\nstatic state states_39[11] = {\n    {1, arcs_39_0},\n    {1, arcs_39_1},\n    {1, arcs_39_2},\n    {1, arcs_39_3},\n    {1, arcs_39_4},\n    {2, arcs_39_5},\n    {1, arcs_39_6},\n    {2, arcs_39_7},\n    {1, arcs_39_8},\n    {1, arcs_39_9},\n    {1, arcs_39_10},\n};\nstatic arc arcs_40_0[1] = {\n    {98, 1},\n};\nstatic arc arcs_40_1[1] = {\n    {23, 2},\n};\nstatic arc arcs_40_2[1] = {\n    {25, 3},\n};\nstatic arc arcs_40_3[2] = {\n    {99, 4},\n    {100, 5},\n};\nstatic arc arcs_40_4[1] = {\n    {23, 6},\n};\nstatic arc arcs_40_5[1] = {\n    {23, 7},\n};\nstatic arc arcs_40_6[1] = {\n    {25, 8},\n};\nstatic arc arcs_40_7[1] = {\n    {25, 9},\n};\nstatic arc arcs_40_8[4] = {\n    {99, 4},\n    {95, 10},\n    {100, 5},\n    {0, 8},\n};\nstatic arc arcs_40_9[1] = {\n    {0, 9},\n};\nstatic arc arcs_40_10[1] = {\n    {23, 11},\n};\nstatic arc arcs_40_11[1] = {\n    {25, 12},\n};\nstatic arc arcs_40_12[2] = {\n    {100, 5},\n    {0, 12},\n};\nstatic state states_40[13] = {\n    {1, arcs_40_0},\n    {1, arcs_40_1},\n    {1, arcs_40_2},\n    {2, arcs_40_3},\n    {1, arcs_40_4},\n    {1, arcs_40_5},\n    {1, arcs_40_6},\n    {1, arcs_40_7},\n    {4, arcs_40_8},\n    {1, arcs_40_9},\n    {1, arcs_40_10},\n    {1, arcs_40_11},\n    {2, arcs_40_12},\n};\nstatic arc arcs_41_0[1] = {\n    {101, 1},\n};\nstatic arc arcs_41_1[1] = {\n    {102, 2},\n};\nstatic arc arcs_41_2[2] = {\n    {30, 1},\n    {23, 3},\n};\nstatic arc arcs_41_3[2] = {\n    {24, 4},\n    {25, 5},\n};\nstatic arc arcs_41_4[1] = {\n    {25, 5},\n};\nstatic arc arcs_41_5[1] = {\n    {0, 5},\n};\nstatic state states_41[6] = {\n    {1, arcs_41_0},\n    {1, arcs_41_1},\n    {2, arcs_41_2},\n    {2, arcs_41_3},\n    {1, arcs_41_4},\n    {1, arcs_41_5},\n};\nstatic arc arcs_42_0[1] = {\n    {29, 1},\n};\nstatic arc arcs_42_1[2] = {\n    {81, 2},\n    {0, 1},\n};\nstatic arc arcs_42_2[1] = {\n    {85, 3},\n};\nstatic arc arcs_42_3[1] = {\n    {0, 3},\n};\nstatic state states_42[4] = {\n    {1, arcs_42_0},\n    {2, arcs_42_1},\n    {1, arcs_42_2},\n    {1, arcs_42_3},\n};\nstatic arc arcs_43_0[1] = {\n    {103, 1},\n};\nstatic arc arcs_43_1[2] = {\n    {29, 2},\n    {0, 1},\n};\nstatic arc arcs_43_2[3] = {\n    {81, 3},\n    {30, 3},\n    {0, 2},\n};\nstatic arc arcs_43_3[1] = {\n    {29, 4},\n};\nstatic arc arcs_43_4[1] = {\n    {0, 4},\n};\nstatic state states_43[5] = {\n    {1, arcs_43_0},\n    {2, arcs_43_1},\n    {3, arcs_43_2},\n    {1, arcs_43_3},\n    {1, arcs_43_4},\n};\nstatic arc arcs_44_0[2] = {\n    {3, 1},\n    {2, 2},\n};\nstatic arc arcs_44_1[1] = {\n    {0, 1},\n};\nstatic arc arcs_44_2[2] = {\n    {24, 3},\n    {104, 4},\n};\nstatic arc arcs_44_3[1] = {\n    {2, 5},\n};\nstatic arc arcs_44_4[1] = {\n    {6, 6},\n};\nstatic arc arcs_44_5[1] = {\n    {104, 4},\n};\nstatic arc arcs_44_6[2] = {\n    {6, 6},\n    {105, 1},\n};\nstatic state states_44[7] = {\n    {2, arcs_44_0},\n    {1, arcs_44_1},\n    {2, arcs_44_2},\n    {1, arcs_44_3},\n    {1, arcs_44_4},\n    {1, arcs_44_5},\n    {2, arcs_44_6},\n};\nstatic arc arcs_45_0[1] = {\n    {107, 1},\n};\nstatic arc arcs_45_1[2] = {\n    {30, 2},\n    {0, 1},\n};\nstatic arc arcs_45_2[1] = {\n    {107, 3},\n};\nstatic arc arcs_45_3[2] = {\n    {30, 4},\n    {0, 3},\n};\nstatic arc arcs_45_4[2] = {\n    {107, 3},\n    {0, 4},\n};\nstatic state states_45[5] = {\n    {1, arcs_45_0},\n    {2, arcs_45_1},\n    {1, arcs_45_2},\n    {2, arcs_45_3},\n    {2, arcs_45_4},\n};\nstatic arc arcs_46_0[2] = {\n    {108, 1},\n    {109, 1},\n};\nstatic arc arcs_46_1[1] = {\n    {0, 1},\n};\nstatic state states_46[2] = {\n    {2, arcs_46_0},\n    {1, arcs_46_1},\n};\nstatic arc arcs_47_0[1] = {\n    {110, 1},\n};\nstatic arc arcs_47_1[2] = {\n    {26, 2},\n    {23, 3},\n};\nstatic arc arcs_47_2[1] = {\n    {23, 3},\n};\nstatic arc arcs_47_3[1] = {\n    {107, 4},\n};\nstatic arc arcs_47_4[1] = {\n    {0, 4},\n};\nstatic state states_47[5] = {\n    {1, arcs_47_0},\n    {2, arcs_47_1},\n    {1, arcs_47_2},\n    {1, arcs_47_3},\n    {1, arcs_47_4},\n};\nstatic arc arcs_48_0[2] = {\n    {108, 1},\n    {111, 2},\n};\nstatic arc arcs_48_1[2] = {\n    {93, 3},\n    {0, 1},\n};\nstatic arc arcs_48_2[1] = {\n    {0, 2},\n};\nstatic arc arcs_48_3[1] = {\n    {108, 4},\n};\nstatic arc arcs_48_4[1] = {\n    {95, 5},\n};\nstatic arc arcs_48_5[1] = {\n    {29, 2},\n};\nstatic state states_48[6] = {\n    {2, arcs_48_0},\n    {2, arcs_48_1},\n    {1, arcs_48_2},\n    {1, arcs_48_3},\n    {1, arcs_48_4},\n    {1, arcs_48_5},\n};\nstatic arc arcs_49_0[1] = {\n    {112, 1},\n};\nstatic arc arcs_49_1[2] = {\n    {113, 0},\n    {0, 1},\n};\nstatic state states_49[2] = {\n    {1, arcs_49_0},\n    {2, arcs_49_1},\n};\nstatic arc arcs_50_0[1] = {\n    {114, 1},\n};\nstatic arc arcs_50_1[2] = {\n    {115, 0},\n    {0, 1},\n};\nstatic state states_50[2] = {\n    {1, arcs_50_0},\n    {2, arcs_50_1},\n};\nstatic arc arcs_51_0[2] = {\n    {116, 1},\n    {117, 2},\n};\nstatic arc arcs_51_1[1] = {\n    {114, 2},\n};\nstatic arc arcs_51_2[1] = {\n    {0, 2},\n};\nstatic state states_51[3] = {\n    {2, arcs_51_0},\n    {1, arcs_51_1},\n    {1, arcs_51_2},\n};\nstatic arc arcs_52_0[1] = {\n    {85, 1},\n};\nstatic arc arcs_52_1[2] = {\n    {118, 0},\n    {0, 1},\n};\nstatic state states_52[2] = {\n    {1, arcs_52_0},\n    {2, arcs_52_1},\n};\nstatic arc arcs_53_0[10] = {\n    {119, 1},\n    {120, 1},\n    {121, 1},\n    {122, 1},\n    {123, 1},\n    {124, 1},\n    {125, 1},\n    {86, 1},\n    {116, 2},\n    {126, 3},\n};\nstatic arc arcs_53_1[1] = {\n    {0, 1},\n};\nstatic arc arcs_53_2[1] = {\n    {86, 1},\n};\nstatic arc arcs_53_3[2] = {\n    {116, 1},\n    {0, 3},\n};\nstatic state states_53[4] = {\n    {10, arcs_53_0},\n    {1, arcs_53_1},\n    {1, arcs_53_2},\n    {2, arcs_53_3},\n};\nstatic arc arcs_54_0[1] = {\n    {127, 1},\n};\nstatic arc arcs_54_1[2] = {\n    {128, 0},\n    {0, 1},\n};\nstatic state states_54[2] = {\n    {1, arcs_54_0},\n    {2, arcs_54_1},\n};\nstatic arc arcs_55_0[1] = {\n    {129, 1},\n};\nstatic arc arcs_55_1[2] = {\n    {130, 0},\n    {0, 1},\n};\nstatic state states_55[2] = {\n    {1, arcs_55_0},\n    {2, arcs_55_1},\n};\nstatic arc arcs_56_0[1] = {\n    {131, 1},\n};\nstatic arc arcs_56_1[2] = {\n    {132, 0},\n    {0, 1},\n};\nstatic state states_56[2] = {\n    {1, arcs_56_0},\n    {2, arcs_56_1},\n};\nstatic arc arcs_57_0[1] = {\n    {133, 1},\n};\nstatic arc arcs_57_1[3] = {\n    {134, 0},\n    {60, 0},\n    {0, 1},\n};\nstatic state states_57[2] = {\n    {1, arcs_57_0},\n    {3, arcs_57_1},\n};\nstatic arc arcs_58_0[1] = {\n    {135, 1},\n};\nstatic arc arcs_58_1[3] = {\n    {136, 0},\n    {137, 0},\n    {0, 1},\n};\nstatic state states_58[2] = {\n    {1, arcs_58_0},\n    {3, arcs_58_1},\n};\nstatic arc arcs_59_0[1] = {\n    {138, 1},\n};\nstatic arc arcs_59_1[5] = {\n    {31, 0},\n    {139, 0},\n    {140, 0},\n    {141, 0},\n    {0, 1},\n};\nstatic state states_59[2] = {\n    {1, arcs_59_0},\n    {5, arcs_59_1},\n};\nstatic arc arcs_60_0[4] = {\n    {136, 1},\n    {137, 1},\n    {142, 1},\n    {143, 2},\n};\nstatic arc arcs_60_1[1] = {\n    {138, 2},\n};\nstatic arc arcs_60_2[1] = {\n    {0, 2},\n};\nstatic state states_60[3] = {\n    {4, arcs_60_0},\n    {1, arcs_60_1},\n    {1, arcs_60_2},\n};\nstatic arc arcs_61_0[1] = {\n    {144, 1},\n};\nstatic arc arcs_61_1[3] = {\n    {145, 1},\n    {32, 2},\n    {0, 1},\n};\nstatic arc arcs_61_2[1] = {\n    {138, 3},\n};\nstatic arc arcs_61_3[1] = {\n    {0, 3},\n};\nstatic state states_61[4] = {\n    {1, arcs_61_0},\n    {3, arcs_61_1},\n    {1, arcs_61_2},\n    {1, arcs_61_3},\n};\nstatic arc arcs_62_0[7] = {\n    {13, 1},\n    {147, 2},\n    {150, 3},\n    {153, 4},\n    {21, 5},\n    {155, 5},\n    {156, 6},\n};\nstatic arc arcs_62_1[3] = {\n    {46, 7},\n    {146, 7},\n    {15, 5},\n};\nstatic arc arcs_62_2[2] = {\n    {148, 8},\n    {149, 5},\n};\nstatic arc arcs_62_3[2] = {\n    {151, 9},\n    {152, 5},\n};\nstatic arc arcs_62_4[1] = {\n    {154, 10},\n};\nstatic arc arcs_62_5[1] = {\n    {0, 5},\n};\nstatic arc arcs_62_6[2] = {\n    {156, 6},\n    {0, 6},\n};\nstatic arc arcs_62_7[1] = {\n    {15, 5},\n};\nstatic arc arcs_62_8[1] = {\n    {149, 5},\n};\nstatic arc arcs_62_9[1] = {\n    {152, 5},\n};\nstatic arc arcs_62_10[1] = {\n    {153, 5},\n};\nstatic state states_62[11] = {\n    {7, arcs_62_0},\n    {3, arcs_62_1},\n    {2, arcs_62_2},\n    {2, arcs_62_3},\n    {1, arcs_62_4},\n    {1, arcs_62_5},\n    {2, arcs_62_6},\n    {1, arcs_62_7},\n    {1, arcs_62_8},\n    {1, arcs_62_9},\n    {1, arcs_62_10},\n};\nstatic arc arcs_63_0[1] = {\n    {29, 1},\n};\nstatic arc arcs_63_1[3] = {\n    {157, 2},\n    {30, 3},\n    {0, 1},\n};\nstatic arc arcs_63_2[1] = {\n    {0, 2},\n};\nstatic arc arcs_63_3[2] = {\n    {29, 4},\n    {0, 3},\n};\nstatic arc arcs_63_4[2] = {\n    {30, 3},\n    {0, 4},\n};\nstatic state states_63[5] = {\n    {1, arcs_63_0},\n    {3, arcs_63_1},\n    {1, arcs_63_2},\n    {2, arcs_63_3},\n    {2, arcs_63_4},\n};\nstatic arc arcs_64_0[1] = {\n    {29, 1},\n};\nstatic arc arcs_64_1[3] = {\n    {158, 2},\n    {30, 3},\n    {0, 1},\n};\nstatic arc arcs_64_2[1] = {\n    {0, 2},\n};\nstatic arc arcs_64_3[2] = {\n    {29, 4},\n    {0, 3},\n};\nstatic arc arcs_64_4[2] = {\n    {30, 3},\n    {0, 4},\n};\nstatic state states_64[5] = {\n    {1, arcs_64_0},\n    {3, arcs_64_1},\n    {1, arcs_64_2},\n    {2, arcs_64_3},\n    {2, arcs_64_4},\n};\nstatic arc arcs_65_0[1] = {\n    {110, 1},\n};\nstatic arc arcs_65_1[2] = {\n    {26, 2},\n    {23, 3},\n};\nstatic arc arcs_65_2[1] = {\n    {23, 3},\n};\nstatic arc arcs_65_3[1] = {\n    {29, 4},\n};\nstatic arc arcs_65_4[1] = {\n    {0, 4},\n};\nstatic state states_65[5] = {\n    {1, arcs_65_0},\n    {2, arcs_65_1},\n    {1, arcs_65_2},\n    {1, arcs_65_3},\n    {1, arcs_65_4},\n};\nstatic arc arcs_66_0[3] = {\n    {13, 1},\n    {147, 2},\n    {78, 3},\n};\nstatic arc arcs_66_1[2] = {\n    {14, 4},\n    {15, 5},\n};\nstatic arc arcs_66_2[1] = {\n    {159, 6},\n};\nstatic arc arcs_66_3[1] = {\n    {21, 5},\n};\nstatic arc arcs_66_4[1] = {\n    {15, 5},\n};\nstatic arc arcs_66_5[1] = {\n    {0, 5},\n};\nstatic arc arcs_66_6[1] = {\n    {149, 5},\n};\nstatic state states_66[7] = {\n    {3, arcs_66_0},\n    {2, arcs_66_1},\n    {1, arcs_66_2},\n    {1, arcs_66_3},\n    {1, arcs_66_4},\n    {1, arcs_66_5},\n    {1, arcs_66_6},\n};\nstatic arc arcs_67_0[1] = {\n    {160, 1},\n};\nstatic arc arcs_67_1[2] = {\n    {30, 2},\n    {0, 1},\n};\nstatic arc arcs_67_2[2] = {\n    {160, 1},\n    {0, 2},\n};\nstatic state states_67[3] = {\n    {1, arcs_67_0},\n    {2, arcs_67_1},\n    {2, arcs_67_2},\n};\nstatic arc arcs_68_0[3] = {\n    {78, 1},\n    {29, 2},\n    {23, 3},\n};\nstatic arc arcs_68_1[1] = {\n    {78, 4},\n};\nstatic arc arcs_68_2[2] = {\n    {23, 3},\n    {0, 2},\n};\nstatic arc arcs_68_3[3] = {\n    {29, 5},\n    {161, 6},\n    {0, 3},\n};\nstatic arc arcs_68_4[1] = {\n    {78, 6},\n};\nstatic arc arcs_68_5[2] = {\n    {161, 6},\n    {0, 5},\n};\nstatic arc arcs_68_6[1] = {\n    {0, 6},\n};\nstatic state states_68[7] = {\n    {3, arcs_68_0},\n    {1, arcs_68_1},\n    {2, arcs_68_2},\n    {3, arcs_68_3},\n    {1, arcs_68_4},\n    {2, arcs_68_5},\n    {1, arcs_68_6},\n};\nstatic arc arcs_69_0[1] = {\n    {23, 1},\n};\nstatic arc arcs_69_1[2] = {\n    {29, 2},\n    {0, 1},\n};\nstatic arc arcs_69_2[1] = {\n    {0, 2},\n};\nstatic state states_69[3] = {\n    {1, arcs_69_0},\n    {2, arcs_69_1},\n    {1, arcs_69_2},\n};\nstatic arc arcs_70_0[1] = {\n    {85, 1},\n};\nstatic arc arcs_70_1[2] = {\n    {30, 2},\n    {0, 1},\n};\nstatic arc arcs_70_2[2] = {\n    {85, 1},\n    {0, 2},\n};\nstatic state states_70[3] = {\n    {1, arcs_70_0},\n    {2, arcs_70_1},\n    {2, arcs_70_2},\n};\nstatic arc arcs_71_0[1] = {\n    {29, 1},\n};\nstatic arc arcs_71_1[2] = {\n    {30, 2},\n    {0, 1},\n};\nstatic arc arcs_71_2[2] = {\n    {29, 1},\n    {0, 2},\n};\nstatic state states_71[3] = {\n    {1, arcs_71_0},\n    {2, arcs_71_1},\n    {2, arcs_71_2},\n};\nstatic arc arcs_72_0[1] = {\n    {29, 1},\n};\nstatic arc arcs_72_1[4] = {\n    {23, 2},\n    {158, 3},\n    {30, 4},\n    {0, 1},\n};\nstatic arc arcs_72_2[1] = {\n    {29, 5},\n};\nstatic arc arcs_72_3[1] = {\n    {0, 3},\n};\nstatic arc arcs_72_4[2] = {\n    {29, 6},\n    {0, 4},\n};\nstatic arc arcs_72_5[3] = {\n    {158, 3},\n    {30, 7},\n    {0, 5},\n};\nstatic arc arcs_72_6[2] = {\n    {30, 4},\n    {0, 6},\n};\nstatic arc arcs_72_7[2] = {\n    {29, 8},\n    {0, 7},\n};\nstatic arc arcs_72_8[1] = {\n    {23, 9},\n};\nstatic arc arcs_72_9[1] = {\n    {29, 10},\n};\nstatic arc arcs_72_10[2] = {\n    {30, 7},\n    {0, 10},\n};\nstatic state states_72[11] = {\n    {1, arcs_72_0},\n    {4, arcs_72_1},\n    {1, arcs_72_2},\n    {1, arcs_72_3},\n    {2, arcs_72_4},\n    {3, arcs_72_5},\n    {2, arcs_72_6},\n    {2, arcs_72_7},\n    {1, arcs_72_8},\n    {1, arcs_72_9},\n    {2, arcs_72_10},\n};\nstatic arc arcs_73_0[1] = {\n    {162, 1},\n};\nstatic arc arcs_73_1[1] = {\n    {21, 2},\n};\nstatic arc arcs_73_2[2] = {\n    {13, 3},\n    {23, 4},\n};\nstatic arc arcs_73_3[2] = {\n    {9, 5},\n    {15, 6},\n};\nstatic arc arcs_73_4[1] = {\n    {25, 7},\n};\nstatic arc arcs_73_5[1] = {\n    {15, 6},\n};\nstatic arc arcs_73_6[1] = {\n    {23, 4},\n};\nstatic arc arcs_73_7[1] = {\n    {0, 7},\n};\nstatic state states_73[8] = {\n    {1, arcs_73_0},\n    {1, arcs_73_1},\n    {2, arcs_73_2},\n    {2, arcs_73_3},\n    {1, arcs_73_4},\n    {1, arcs_73_5},\n    {1, arcs_73_6},\n    {1, arcs_73_7},\n};\nstatic arc arcs_74_0[3] = {\n    {163, 1},\n    {31, 2},\n    {32, 3},\n};\nstatic arc arcs_74_1[2] = {\n    {30, 4},\n    {0, 1},\n};\nstatic arc arcs_74_2[1] = {\n    {29, 5},\n};\nstatic arc arcs_74_3[1] = {\n    {29, 6},\n};\nstatic arc arcs_74_4[4] = {\n    {163, 1},\n    {31, 2},\n    {32, 3},\n    {0, 4},\n};\nstatic arc arcs_74_5[2] = {\n    {30, 7},\n    {0, 5},\n};\nstatic arc arcs_74_6[1] = {\n    {0, 6},\n};\nstatic arc arcs_74_7[2] = {\n    {163, 5},\n    {32, 3},\n};\nstatic state states_74[8] = {\n    {3, arcs_74_0},\n    {2, arcs_74_1},\n    {1, arcs_74_2},\n    {1, arcs_74_3},\n    {4, arcs_74_4},\n    {2, arcs_74_5},\n    {1, arcs_74_6},\n    {2, arcs_74_7},\n};\nstatic arc arcs_75_0[1] = {\n    {29, 1},\n};\nstatic arc arcs_75_1[3] = {\n    {158, 2},\n    {28, 3},\n    {0, 1},\n};\nstatic arc arcs_75_2[1] = {\n    {0, 2},\n};\nstatic arc arcs_75_3[1] = {\n    {29, 2},\n};\nstatic state states_75[4] = {\n    {1, arcs_75_0},\n    {3, arcs_75_1},\n    {1, arcs_75_2},\n    {1, arcs_75_3},\n};\nstatic arc arcs_76_0[2] = {\n    {157, 1},\n    {165, 1},\n};\nstatic arc arcs_76_1[1] = {\n    {0, 1},\n};\nstatic state states_76[2] = {\n    {2, arcs_76_0},\n    {1, arcs_76_1},\n};\nstatic arc arcs_77_0[1] = {\n    {97, 1},\n};\nstatic arc arcs_77_1[1] = {\n    {62, 2},\n};\nstatic arc arcs_77_2[1] = {\n    {86, 3},\n};\nstatic arc arcs_77_3[1] = {\n    {106, 4},\n};\nstatic arc arcs_77_4[2] = {\n    {164, 5},\n    {0, 4},\n};\nstatic arc arcs_77_5[1] = {\n    {0, 5},\n};\nstatic state states_77[6] = {\n    {1, arcs_77_0},\n    {1, arcs_77_1},\n    {1, arcs_77_2},\n    {1, arcs_77_3},\n    {2, arcs_77_4},\n    {1, arcs_77_5},\n};\nstatic arc arcs_78_0[1] = {\n    {93, 1},\n};\nstatic arc arcs_78_1[1] = {\n    {107, 2},\n};\nstatic arc arcs_78_2[2] = {\n    {164, 3},\n    {0, 2},\n};\nstatic arc arcs_78_3[1] = {\n    {0, 3},\n};\nstatic state states_78[4] = {\n    {1, arcs_78_0},\n    {1, arcs_78_1},\n    {2, arcs_78_2},\n    {1, arcs_78_3},\n};\nstatic arc arcs_79_0[2] = {\n    {158, 1},\n    {167, 1},\n};\nstatic arc arcs_79_1[1] = {\n    {0, 1},\n};\nstatic state states_79[2] = {\n    {2, arcs_79_0},\n    {1, arcs_79_1},\n};\nstatic arc arcs_80_0[1] = {\n    {97, 1},\n};\nstatic arc arcs_80_1[1] = {\n    {62, 2},\n};\nstatic arc arcs_80_2[1] = {\n    {86, 3},\n};\nstatic arc arcs_80_3[1] = {\n    {108, 4},\n};\nstatic arc arcs_80_4[2] = {\n    {166, 5},\n    {0, 4},\n};\nstatic arc arcs_80_5[1] = {\n    {0, 5},\n};\nstatic state states_80[6] = {\n    {1, arcs_80_0},\n    {1, arcs_80_1},\n    {1, arcs_80_2},\n    {1, arcs_80_3},\n    {2, arcs_80_4},\n    {1, arcs_80_5},\n};\nstatic arc arcs_81_0[1] = {\n    {93, 1},\n};\nstatic arc arcs_81_1[1] = {\n    {107, 2},\n};\nstatic arc arcs_81_2[2] = {\n    {166, 3},\n    {0, 2},\n};\nstatic arc arcs_81_3[1] = {\n    {0, 3},\n};\nstatic state states_81[4] = {\n    {1, arcs_81_0},\n    {1, arcs_81_1},\n    {2, arcs_81_2},\n    {1, arcs_81_3},\n};\nstatic arc arcs_82_0[1] = {\n    {29, 1},\n};\nstatic arc arcs_82_1[2] = {\n    {30, 0},\n    {0, 1},\n};\nstatic state states_82[2] = {\n    {1, arcs_82_0},\n    {2, arcs_82_1},\n};\nstatic arc arcs_83_0[1] = {\n    {21, 1},\n};\nstatic arc arcs_83_1[1] = {\n    {0, 1},\n};\nstatic state states_83[2] = {\n    {1, arcs_83_0},\n    {1, arcs_83_1},\n};\nstatic arc arcs_84_0[1] = {\n    {169, 1},\n};\nstatic arc arcs_84_1[2] = {\n    {9, 2},\n    {0, 1},\n};\nstatic arc arcs_84_2[1] = {\n    {0, 2},\n};\nstatic state states_84[3] = {\n    {1, arcs_84_0},\n    {2, arcs_84_1},\n    {1, arcs_84_2},\n};\nstatic arc arcs_85_0[1] = {\n    {171, 1},\n};\nstatic arc arcs_85_1[2] = {\n    {2, 1},\n    {7, 2},\n};\nstatic arc arcs_85_2[1] = {\n    {0, 2},\n};\nstatic state states_85[3] = {\n    {1, arcs_85_0},\n    {2, arcs_85_1},\n    {1, arcs_85_2},\n};\nstatic arc arcs_86_0[1] = {\n    {13, 1},\n};\nstatic arc arcs_86_1[2] = {\n    {172, 2},\n    {15, 3},\n};\nstatic arc arcs_86_2[1] = {\n    {15, 3},\n};\nstatic arc arcs_86_3[1] = {\n    {173, 4},\n};\nstatic arc arcs_86_4[1] = {\n    {29, 5},\n};\nstatic arc arcs_86_5[1] = {\n    {0, 5},\n};\nstatic state states_86[6] = {\n    {1, arcs_86_0},\n    {2, arcs_86_1},\n    {1, arcs_86_2},\n    {1, arcs_86_3},\n    {1, arcs_86_4},\n    {1, arcs_86_5},\n};\nstatic arc arcs_87_0[3] = {\n    {29, 1},\n    {31, 2},\n    {32, 3},\n};\nstatic arc arcs_87_1[2] = {\n    {30, 4},\n    {0, 1},\n};\nstatic arc arcs_87_2[3] = {\n    {29, 5},\n    {30, 6},\n    {0, 2},\n};\nstatic arc arcs_87_3[1] = {\n    {29, 7},\n};\nstatic arc arcs_87_4[4] = {\n    {29, 1},\n    {31, 8},\n    {32, 3},\n    {0, 4},\n};\nstatic arc arcs_87_5[2] = {\n    {30, 6},\n    {0, 5},\n};\nstatic arc arcs_87_6[2] = {\n    {29, 5},\n    {32, 3},\n};\nstatic arc arcs_87_7[1] = {\n    {0, 7},\n};\nstatic arc arcs_87_8[3] = {\n    {29, 9},\n    {30, 10},\n    {0, 8},\n};\nstatic arc arcs_87_9[2] = {\n    {30, 10},\n    {0, 9},\n};\nstatic arc arcs_87_10[2] = {\n    {29, 9},\n    {32, 3},\n};\nstatic state states_87[11] = {\n    {3, arcs_87_0},\n    {2, arcs_87_1},\n    {3, arcs_87_2},\n    {1, arcs_87_3},\n    {4, arcs_87_4},\n    {2, arcs_87_5},\n    {2, arcs_87_6},\n    {1, arcs_87_7},\n    {3, arcs_87_8},\n    {2, arcs_87_9},\n    {2, arcs_87_10},\n};\nstatic dfa dfas[88] = {\n    {256, \"single_input\", 0, 3, states_0,\n     \"\\004\\050\\060\\000\\000\\000\\000\\250\\340\\051\\230\\040\\047\\100\\020\\000\\000\\103\\110\\032\\004\\002\"},\n    {257, \"file_input\", 0, 2, states_1,\n     \"\\204\\050\\060\\000\\000\\000\\000\\250\\340\\051\\230\\040\\047\\100\\020\\000\\000\\103\\110\\032\\004\\002\"},\n    {258, \"eval_input\", 0, 3, states_2,\n     \"\\000\\040\\040\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\100\\020\\000\\000\\103\\110\\032\\000\\000\"},\n    {259, \"decorator\", 0, 7, states_3,\n     \"\\000\\010\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\"},\n    {260, \"decorators\", 0, 2, states_4,\n     \"\\000\\010\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\"},\n    {261, \"decorated\", 0, 3, states_5,\n     \"\\000\\010\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\"},\n    {262, \"funcdef\", 0, 7, states_6,\n     \"\\000\\000\\020\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\"},\n    {263, \"parameters\", 0, 4, states_7,\n     \"\\000\\040\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\"},\n    {264, \"varargslist\", 0, 13, states_8,\n     \"\\000\\040\\040\\200\\001\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\"},\n    {265, \"fpdef\", 0, 4, states_9,\n     \"\\000\\040\\040\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\"},\n    {266, \"fplist\", 0, 3, states_10,\n     \"\\000\\040\\040\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\"},\n    {267, \"stmt\", 0, 2, states_11,\n     \"\\000\\050\\060\\000\\000\\000\\000\\250\\340\\051\\230\\040\\047\\100\\020\\000\\000\\103\\110\\032\\004\\002\"},\n    {268, \"simple_stmt\", 0, 4, states_12,\n     \"\\000\\040\\040\\000\\000\\000\\000\\250\\340\\051\\230\\000\\000\\100\\020\\000\\000\\103\\110\\032\\000\\002\"},\n    {269, \"small_stmt\", 0, 2, states_13,\n     \"\\000\\040\\040\\000\\000\\000\\000\\250\\340\\051\\230\\000\\000\\100\\020\\000\\000\\103\\110\\032\\000\\002\"},\n    {270, \"expr_stmt\", 0, 6, states_14,\n     \"\\000\\040\\040\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\100\\020\\000\\000\\103\\110\\032\\000\\000\"},\n    {271, \"augassign\", 0, 2, states_15,\n     \"\\000\\000\\000\\000\\000\\200\\377\\007\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\"},\n    {272, \"print_stmt\", 0, 9, states_16,\n     \"\\000\\000\\000\\000\\000\\000\\000\\010\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\"},\n    {273, \"del_stmt\", 0, 3, states_17,\n     \"\\000\\000\\000\\000\\000\\000\\000\\040\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\"},\n    {274, \"pass_stmt\", 0, 2, states_18,\n     \"\\000\\000\\000\\000\\000\\000\\000\\200\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\"},\n    {275, \"flow_stmt\", 0, 2, states_19,\n     \"\\000\\000\\000\\000\\000\\000\\000\\000\\340\\001\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\002\"},\n    {276, \"break_stmt\", 0, 2, states_20,\n     \"\\000\\000\\000\\000\\000\\000\\000\\000\\040\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\"},\n    {277, \"continue_stmt\", 0, 2, states_21,\n     \"\\000\\000\\000\\000\\000\\000\\000\\000\\100\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\"},\n    {278, \"return_stmt\", 0, 3, states_22,\n     \"\\000\\000\\000\\000\\000\\000\\000\\000\\200\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\"},\n    {279, \"yield_stmt\", 0, 2, states_23,\n     \"\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\002\"},\n    {280, \"raise_stmt\", 0, 7, states_24,\n     \"\\000\\000\\000\\000\\000\\000\\000\\000\\000\\001\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\"},\n    {281, \"import_stmt\", 0, 2, states_25,\n     \"\\000\\000\\000\\000\\000\\000\\000\\000\\000\\050\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\"},\n    {282, \"import_name\", 0, 3, states_26,\n     \"\\000\\000\\000\\000\\000\\000\\000\\000\\000\\010\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\"},\n    {283, \"import_from\", 0, 8, states_27,\n     \"\\000\\000\\000\\000\\000\\000\\000\\000\\000\\040\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\"},\n    {284, \"import_as_name\", 0, 4, states_28,\n     \"\\000\\000\\040\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\"},\n    {285, \"dotted_as_name\", 0, 4, states_29,\n     \"\\000\\000\\040\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\"},\n    {286, \"import_as_names\", 0, 3, states_30,\n     \"\\000\\000\\040\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\"},\n    {287, \"dotted_as_names\", 0, 2, states_31,\n     \"\\000\\000\\040\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\"},\n    {288, \"dotted_name\", 0, 2, states_32,\n     \"\\000\\000\\040\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\"},\n    {289, \"global_stmt\", 0, 3, states_33,\n     \"\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\010\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\"},\n    {290, \"exec_stmt\", 0, 7, states_34,\n     \"\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\020\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\"},\n    {291, \"assert_stmt\", 0, 5, states_35,\n     \"\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\200\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\"},\n    {292, \"compound_stmt\", 0, 2, states_36,\n     \"\\000\\010\\020\\000\\000\\000\\000\\000\\000\\000\\000\\040\\047\\000\\000\\000\\000\\000\\000\\000\\004\\000\"},\n    {293, \"if_stmt\", 0, 8, states_37,\n     \"\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\040\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\"},\n    {294, \"while_stmt\", 0, 8, states_38,\n     \"\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\001\\000\\000\\000\\000\\000\\000\\000\\000\\000\"},\n    {295, \"for_stmt\", 0, 11, states_39,\n     \"\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\002\\000\\000\\000\\000\\000\\000\\000\\000\\000\"},\n    {296, \"try_stmt\", 0, 13, states_40,\n     \"\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\004\\000\\000\\000\\000\\000\\000\\000\\000\\000\"},\n    {297, \"with_stmt\", 0, 6, states_41,\n     \"\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\040\\000\\000\\000\\000\\000\\000\\000\\000\\000\"},\n    {298, \"with_item\", 0, 4, states_42,\n     \"\\000\\040\\040\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\100\\020\\000\\000\\103\\110\\032\\000\\000\"},\n    {299, \"except_clause\", 0, 5, states_43,\n     \"\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\200\\000\\000\\000\\000\\000\\000\\000\\000\\000\"},\n    {300, \"suite\", 0, 7, states_44,\n     \"\\004\\040\\040\\000\\000\\000\\000\\250\\340\\051\\230\\000\\000\\100\\020\\000\\000\\103\\110\\032\\000\\002\"},\n    {301, \"testlist_safe\", 0, 5, states_45,\n     \"\\000\\040\\040\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\100\\020\\000\\000\\103\\110\\032\\000\\000\"},\n    {302, \"old_test\", 0, 2, states_46,\n     \"\\000\\040\\040\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\100\\020\\000\\000\\103\\110\\032\\000\\000\"},\n    {303, \"old_lambdef\", 0, 5, states_47,\n     \"\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\100\\000\\000\\000\\000\\000\\000\\000\\000\"},\n    {304, \"test\", 0, 6, states_48,\n     \"\\000\\040\\040\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\100\\020\\000\\000\\103\\110\\032\\000\\000\"},\n    {305, \"or_test\", 0, 2, states_49,\n     \"\\000\\040\\040\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\020\\000\\000\\103\\110\\032\\000\\000\"},\n    {306, \"and_test\", 0, 2, states_50,\n     \"\\000\\040\\040\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\020\\000\\000\\103\\110\\032\\000\\000\"},\n    {307, \"not_test\", 0, 3, states_51,\n     \"\\000\\040\\040\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\020\\000\\000\\103\\110\\032\\000\\000\"},\n    {308, \"comparison\", 0, 2, states_52,\n     \"\\000\\040\\040\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\103\\110\\032\\000\\000\"},\n    {309, \"comp_op\", 0, 4, states_53,\n     \"\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\100\\000\\000\\000\\220\\177\\000\\000\\000\\000\\000\\000\"},\n    {310, \"expr\", 0, 2, states_54,\n     \"\\000\\040\\040\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\103\\110\\032\\000\\000\"},\n    {311, \"xor_expr\", 0, 2, states_55,\n     \"\\000\\040\\040\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\103\\110\\032\\000\\000\"},\n    {312, \"and_expr\", 0, 2, states_56,\n     \"\\000\\040\\040\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\103\\110\\032\\000\\000\"},\n    {313, \"shift_expr\", 0, 2, states_57,\n     \"\\000\\040\\040\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\103\\110\\032\\000\\000\"},\n    {314, \"arith_expr\", 0, 2, states_58,\n     \"\\000\\040\\040\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\103\\110\\032\\000\\000\"},\n    {315, \"term\", 0, 2, states_59,\n     \"\\000\\040\\040\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\103\\110\\032\\000\\000\"},\n    {316, \"factor\", 0, 3, states_60,\n     \"\\000\\040\\040\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\103\\110\\032\\000\\000\"},\n    {317, \"power\", 0, 4, states_61,\n     \"\\000\\040\\040\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\110\\032\\000\\000\"},\n    {318, \"atom\", 0, 11, states_62,\n     \"\\000\\040\\040\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\110\\032\\000\\000\"},\n    {319, \"listmaker\", 0, 5, states_63,\n     \"\\000\\040\\040\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\100\\020\\000\\000\\103\\110\\032\\000\\000\"},\n    {320, \"testlist_comp\", 0, 5, states_64,\n     \"\\000\\040\\040\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\100\\020\\000\\000\\103\\110\\032\\000\\000\"},\n    {321, \"lambdef\", 0, 5, states_65,\n     \"\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\100\\000\\000\\000\\000\\000\\000\\000\\000\"},\n    {322, \"trailer\", 0, 7, states_66,\n     \"\\000\\040\\000\\000\\000\\000\\000\\000\\000\\100\\000\\000\\000\\000\\000\\000\\000\\000\\010\\000\\000\\000\"},\n    {323, \"subscriptlist\", 0, 3, states_67,\n     \"\\000\\040\\240\\000\\000\\000\\000\\000\\000\\100\\000\\000\\000\\100\\020\\000\\000\\103\\110\\032\\000\\000\"},\n    {324, \"subscript\", 0, 7, states_68,\n     \"\\000\\040\\240\\000\\000\\000\\000\\000\\000\\100\\000\\000\\000\\100\\020\\000\\000\\103\\110\\032\\000\\000\"},\n    {325, \"sliceop\", 0, 3, states_69,\n     \"\\000\\000\\200\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\"},\n    {326, \"exprlist\", 0, 3, states_70,\n     \"\\000\\040\\040\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\103\\110\\032\\000\\000\"},\n    {327, \"testlist\", 0, 3, states_71,\n     \"\\000\\040\\040\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\100\\020\\000\\000\\103\\110\\032\\000\\000\"},\n    {328, \"dictorsetmaker\", 0, 11, states_72,\n     \"\\000\\040\\040\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\100\\020\\000\\000\\103\\110\\032\\000\\000\"},\n    {329, \"classdef\", 0, 8, states_73,\n     \"\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\004\\000\"},\n    {330, \"arglist\", 0, 8, states_74,\n     \"\\000\\040\\040\\200\\001\\000\\000\\000\\000\\000\\000\\000\\000\\100\\020\\000\\000\\103\\110\\032\\000\\000\"},\n    {331, \"argument\", 0, 4, states_75,\n     \"\\000\\040\\040\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\100\\020\\000\\000\\103\\110\\032\\000\\000\"},\n    {332, \"list_iter\", 0, 2, states_76,\n     \"\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\040\\002\\000\\000\\000\\000\\000\\000\\000\\000\\000\"},\n    {333, \"list_for\", 0, 6, states_77,\n     \"\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\002\\000\\000\\000\\000\\000\\000\\000\\000\\000\"},\n    {334, \"list_if\", 0, 4, states_78,\n     \"\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\040\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\"},\n    {335, \"comp_iter\", 0, 2, states_79,\n     \"\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\040\\002\\000\\000\\000\\000\\000\\000\\000\\000\\000\"},\n    {336, \"comp_for\", 0, 6, states_80,\n     \"\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\002\\000\\000\\000\\000\\000\\000\\000\\000\\000\"},\n    {337, \"comp_if\", 0, 4, states_81,\n     \"\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\040\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\"},\n    {338, \"testlist1\", 0, 2, states_82,\n     \"\\000\\040\\040\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\100\\020\\000\\000\\103\\110\\032\\000\\000\"},\n    {339, \"encoding_decl\", 0, 2, states_83,\n     \"\\000\\000\\040\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\"},\n    {340, \"yield_expr\", 0, 3, states_84,\n     \"\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\002\"},\n    {341, \"func_type_input\", 0, 3, states_85,\n     \"\\000\\040\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\"},\n    {342, \"func_type\", 0, 6, states_86,\n     \"\\000\\040\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\"},\n    {343, \"typelist\", 0, 11, states_87,\n     \"\\000\\040\\040\\200\\001\\000\\000\\000\\000\\000\\000\\000\\000\\100\\020\\000\\000\\103\\110\\032\\000\\000\"},\n};\nstatic label labels[174] = {\n    {0, \"EMPTY\"},\n    {256, 0},\n    {4, 0},\n    {268, 0},\n    {292, 0},\n    {257, 0},\n    {267, 0},\n    {0, 0},\n    {258, 0},\n    {327, 0},\n    {259, 0},\n    {50, 0},\n    {288, 0},\n    {7, 0},\n    {330, 0},\n    {8, 0},\n    {260, 0},\n    {261, 0},\n    {329, 0},\n    {262, 0},\n    {1, \"def\"},\n    {1, 0},\n    {263, 0},\n    {11, 0},\n    {54, 0},\n    {300, 0},\n    {264, 0},\n    {265, 0},\n    {22, 0},\n    {304, 0},\n    {12, 0},\n    {16, 0},\n    {36, 0},\n    {266, 0},\n    {269, 0},\n    {13, 0},\n    {270, 0},\n    {272, 0},\n    {273, 0},\n    {274, 0},\n    {275, 0},\n    {281, 0},\n    {289, 0},\n    {290, 0},\n    {291, 0},\n    {271, 0},\n    {340, 0},\n    {37, 0},\n    {38, 0},\n    {39, 0},\n    {40, 0},\n    {41, 0},\n    {42, 0},\n    {43, 0},\n    {44, 0},\n    {45, 0},\n    {46, 0},\n    {47, 0},\n    {49, 0},\n    {1, \"print\"},\n    {35, 0},\n    {1, \"del\"},\n    {326, 0},\n    {1, \"pass\"},\n    {276, 0},\n    {277, 0},\n    {278, 0},\n    {280, 0},\n    {279, 0},\n    {1, \"break\"},\n    {1, \"continue\"},\n    {1, \"return\"},\n    {1, \"raise\"},\n    {282, 0},\n    {283, 0},\n    {1, \"import\"},\n    {287, 0},\n    {1, \"from\"},\n    {23, 0},\n    {286, 0},\n    {284, 0},\n    {1, \"as\"},\n    {285, 0},\n    {1, \"global\"},\n    {1, \"exec\"},\n    {310, 0},\n    {1, \"in\"},\n    {1, \"assert\"},\n    {293, 0},\n    {294, 0},\n    {295, 0},\n    {296, 0},\n    {297, 0},\n    {1, \"if\"},\n    {1, \"elif\"},\n    {1, \"else\"},\n    {1, \"while\"},\n    {1, \"for\"},\n    {1, \"try\"},\n    {299, 0},\n    {1, \"finally\"},\n    {1, \"with\"},\n    {298, 0},\n    {1, \"except\"},\n    {5, 0},\n    {6, 0},\n    {301, 0},\n    {302, 0},\n    {305, 0},\n    {303, 0},\n    {1, \"lambda\"},\n    {321, 0},\n    {306, 0},\n    {1, \"or\"},\n    {307, 0},\n    {1, \"and\"},\n    {1, \"not\"},\n    {308, 0},\n    {309, 0},\n    {20, 0},\n    {21, 0},\n    {28, 0},\n    {31, 0},\n    {30, 0},\n    {29, 0},\n    {29, 0},\n    {1, \"is\"},\n    {311, 0},\n    {18, 0},\n    {312, 0},\n    {33, 0},\n    {313, 0},\n    {19, 0},\n    {314, 0},\n    {34, 0},\n    {315, 0},\n    {14, 0},\n    {15, 0},\n    {316, 0},\n    {17, 0},\n    {24, 0},\n    {48, 0},\n    {32, 0},\n    {317, 0},\n    {318, 0},\n    {322, 0},\n    {320, 0},\n    {9, 0},\n    {319, 0},\n    {10, 0},\n    {26, 0},\n    {328, 0},\n    {27, 0},\n    {25, 0},\n    {338, 0},\n    {2, 0},\n    {3, 0},\n    {333, 0},\n    {336, 0},\n    {323, 0},\n    {324, 0},\n    {325, 0},\n    {1, \"class\"},\n    {331, 0},\n    {332, 0},\n    {334, 0},\n    {335, 0},\n    {337, 0},\n    {339, 0},\n    {1, \"yield\"},\n    {341, 0},\n    {342, 0},\n    {343, 0},\n    {52, 0},\n};\ngrammar _Ta27Parser_Grammar = {\n    88,\n    dfas,\n    {174, labels},\n    256\n};\n"
  },
  {
    "path": "ast27/Python/mystrtoul.c",
    "content": "\n#include \"Python.h\"\n\n#if defined(__sgi) && defined(WITH_THREAD) && !defined(_SGI_MP_SOURCE)\n#define _SGI_MP_SOURCE\n#endif\n\n/* strtol and strtoul, renamed to avoid conflicts */\n\n\n#include <ctype.h>\n#ifdef HAVE_ERRNO_H\n#include <errno.h>\n#endif\n\n/* Static overflow check values for bases 2 through 36.\n * smallmax[base] is the largest unsigned long i such that\n * i * base doesn't overflow unsigned long.\n */\nstatic unsigned long smallmax[] = {\n    0, /* bases 0 and 1 are invalid */\n    0,\n    ULONG_MAX / 2,\n    ULONG_MAX / 3,\n    ULONG_MAX / 4,\n    ULONG_MAX / 5,\n    ULONG_MAX / 6,\n    ULONG_MAX / 7,\n    ULONG_MAX / 8,\n    ULONG_MAX / 9,\n    ULONG_MAX / 10,\n    ULONG_MAX / 11,\n    ULONG_MAX / 12,\n    ULONG_MAX / 13,\n    ULONG_MAX / 14,\n    ULONG_MAX / 15,\n    ULONG_MAX / 16,\n    ULONG_MAX / 17,\n    ULONG_MAX / 18,\n    ULONG_MAX / 19,\n    ULONG_MAX / 20,\n    ULONG_MAX / 21,\n    ULONG_MAX / 22,\n    ULONG_MAX / 23,\n    ULONG_MAX / 24,\n    ULONG_MAX / 25,\n    ULONG_MAX / 26,\n    ULONG_MAX / 27,\n    ULONG_MAX / 28,\n    ULONG_MAX / 29,\n    ULONG_MAX / 30,\n    ULONG_MAX / 31,\n    ULONG_MAX / 32,\n    ULONG_MAX / 33,\n    ULONG_MAX / 34,\n    ULONG_MAX / 35,\n    ULONG_MAX / 36,\n};\n\n/* maximum digits that can't ever overflow for bases 2 through 36,\n * calculated by [int(math.floor(math.log(2**32, i))) for i in range(2, 37)].\n * Note that this is pessimistic if sizeof(long) > 4.\n */\n#if SIZEOF_LONG == 4\nstatic int digitlimit[] = {\n    0,  0, 32, 20, 16, 13, 12, 11, 10, 10,  /*  0 -  9 */\n    9,  9,  8,  8,  8,  8,  8,  7,  7,  7,  /* 10 - 19 */\n    7,  7,  7,  7,  6,  6,  6,  6,  6,  6,  /* 20 - 29 */\n    6,  6,  6,  6,  6,  6,  6};             /* 30 - 36 */\n#elif SIZEOF_LONG == 8\n/* [int(math.floor(math.log(2**64, i))) for i in range(2, 37)] */\nstatic int digitlimit[] = {\n         0,   0, 64, 40, 32, 27, 24, 22, 21, 20,  /*  0 -  9 */\n    19,  18, 17, 17, 16, 16, 16, 15, 15, 15,  /* 10 - 19 */\n    14,  14, 14, 14, 13, 13, 13, 13, 13, 13,  /* 20 - 29 */\n    13,  12, 12, 12, 12, 12, 12};             /* 30 - 36 */\n#else\n#error \"Need table for SIZEOF_LONG\"\n#endif\n\n/* Table of digit values for 8-bit string -> integer conversion.\n * '0' maps to 0, ..., '9' maps to 9.\n * 'a' and 'A' map to 10, ..., 'z' and 'Z' map to 35.\n * All other indices map to 37.\n * Note that when converting a base B string, a char c is a legitimate\n * base B digit iff digitvalue[Py_CHARPyLong_MASK(c)] < B.\n */\nunsigned char digitvalue[256] = {\n    37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,\n    37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,\n    37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,\n    0,  1,  2,  3,  4,  5,  6,  7,  8,  9,  37, 37, 37, 37, 37, 37,\n    37, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,\n    25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 37, 37, 37, 37, 37,\n    37, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,\n    25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 37, 37, 37, 37, 37,\n    37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,\n    37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,\n    37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,\n    37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,\n    37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,\n    37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,\n    37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,\n    37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,\n};\n\n/*\n**      strtoul\n**              This is a general purpose routine for converting\n**              an ascii string to an integer in an arbitrary base.\n**              Leading white space is ignored.  If 'base' is zero\n**              it looks for a leading 0, 0b, 0B, 0o, 0O, 0x or 0X\n**              to tell which base.  If these are absent it defaults\n**              to 10. Base must be 0 or between 2 and 36 (inclusive).\n**              If 'ptr' is non-NULL it will contain a pointer to\n**              the end of the scan.\n**              Errors due to bad pointers will probably result in\n**              exceptions - we don't check for them.\n*/\nunsigned long\nTa27OS_strtoul(register char *str, char **ptr, int base)\n{\n    register unsigned long result = 0; /* return value of the function */\n    register int c;             /* current input character */\n    register int ovlimit;       /* required digits to overflow */\n\n    /* skip leading white space */\n    while (*str && isspace(Py_CHARMASK(*str)))\n        ++str;\n\n    /* check for leading 0 or 0x for auto-base or base 16 */\n    switch (base) {\n    case 0:             /* look for leading 0, 0b, 0o or 0x */\n        if (*str == '0') {\n            ++str;\n            if (*str == 'x' || *str == 'X') {\n                /* there must be at least one digit after 0x */\n                if (digitvalue[Py_CHARMASK(str[1])] >= 16) {\n                    if (ptr)\n                        *ptr = str;\n                    return 0;\n                }\n                ++str;\n                base = 16;\n            } else if (*str == 'o' || *str == 'O') {\n                /* there must be at least one digit after 0o */\n                if (digitvalue[Py_CHARMASK(str[1])] >= 8) {\n                    if (ptr)\n                        *ptr = str;\n                    return 0;\n                }\n                ++str;\n                base = 8;\n            } else if (*str == 'b' || *str == 'B') {\n                /* there must be at least one digit after 0b */\n                if (digitvalue[Py_CHARMASK(str[1])] >= 2) {\n                    if (ptr)\n                        *ptr = str;\n                    return 0;\n                }\n                ++str;\n                base = 2;\n            } else {\n                base = 8;\n            }\n        }\n        else\n            base = 10;\n        break;\n\n    case 2:     /* skip leading 0b or 0B */\n        if (*str == '0') {\n            ++str;\n            if (*str == 'b' || *str == 'B') {\n                /* there must be at least one digit after 0b */\n                if (digitvalue[Py_CHARMASK(str[1])] >= 2) {\n                    if (ptr)\n                        *ptr = str;\n                    return 0;\n                }\n                ++str;\n            }\n        }\n        break;\n\n    case 8:     /* skip leading 0o or 0O */\n        if (*str == '0') {\n            ++str;\n            if (*str == 'o' || *str == 'O') {\n                /* there must be at least one digit after 0o */\n                if (digitvalue[Py_CHARMASK(str[1])] >= 8) {\n                    if (ptr)\n                        *ptr = str;\n                    return 0;\n                }\n                ++str;\n            }\n        }\n        break;\n\n    case 16:            /* skip leading 0x or 0X */\n        if (*str == '0') {\n            ++str;\n            if (*str == 'x' || *str == 'X') {\n                /* there must be at least one digit after 0x */\n                if (digitvalue[Py_CHARMASK(str[1])] >= 16) {\n                    if (ptr)\n                        *ptr = str;\n                    return 0;\n                }\n                ++str;\n            }\n        }\n        break;\n    }\n\n    /* catch silly bases */\n    if (base < 2 || base > 36) {\n        if (ptr)\n            *ptr = str;\n        return 0;\n    }\n\n    /* skip leading zeroes */\n    while (*str == '0')\n        ++str;\n\n    /* base is guaranteed to be in [2, 36] at this point */\n    ovlimit = digitlimit[base];\n\n    /* do the conversion until non-digit character encountered */\n    while ((c = digitvalue[Py_CHARMASK(*str)]) < base) {\n        if (ovlimit > 0) /* no overflow check required */\n            result = result * base + c;\n        else { /* requires overflow check */\n            register unsigned long temp_result;\n\n            if (ovlimit < 0) /* guaranteed overflow */\n                goto overflowed;\n\n            /* there could be an overflow */\n            /* check overflow just from shifting */\n            if (result > smallmax[base])\n                goto overflowed;\n\n            result *= base;\n\n            /* check overflow from the digit's value */\n            temp_result = result + c;\n            if (temp_result < result)\n                goto overflowed;\n\n            result = temp_result;\n        }\n\n        ++str;\n        --ovlimit;\n    }\n\n    /* set pointer to point to the last character scanned */\n    if (ptr)\n        *ptr = str;\n\n    return result;\n\noverflowed:\n    if (ptr) {\n        /* spool through remaining digit characters */\n        while (digitvalue[Py_CHARMASK(*str)] < base)\n            ++str;\n        *ptr = str;\n    }\n    errno = ERANGE;\n    return (unsigned long)-1;\n}\n\n/* Checking for overflow in PyOS_strtol is a PITA; see comments\n * about PY_ABS_LONG_MIN in longobject.c.\n */\n#define PY_ABS_LONG_MIN         (0-(unsigned long)LONG_MIN)\n\nlong\nTa27OS_strtol(char *str, char **ptr, int base)\n{\n    long result;\n    unsigned long uresult;\n    char sign;\n\n    while (*str && isspace(Py_CHARMASK(*str)))\n        str++;\n\n    sign = *str;\n    if (sign == '+' || sign == '-')\n        str++;\n\n    uresult = Ta27OS_strtoul(str, ptr, base);\n\n    if (uresult <= (unsigned long)LONG_MAX) {\n        result = (long)uresult;\n        if (sign == '-')\n            result = -result;\n    }\n    else if (sign == '-' && uresult == PY_ABS_LONG_MIN) {\n        result = LONG_MIN;\n    }\n    else {\n        errno = ERANGE;\n        result = LONG_MAX;\n    }\n    return result;\n}\n"
  },
  {
    "path": "ast3/Custom/typed_ast.c",
    "content": "#include \"Python.h\"\n#include \"../Include/Python-ast.h\"\n#include \"../Include/node.h\"\n#include \"../Include/grammar.h\"\n#include \"../Include/token.h\"\n#include \"../Include/ast.h\"\n#include \"../Include/parsetok.h\"\n#include \"../Include/errcode.h\"\n#include \"../Include/graminit.h\"\n\nextern grammar _Ta3Parser_Grammar; /* from graminit.c */\n\n// from Python/bltinmodule.c\nstatic const char *\nsource_as_string(PyObject *cmd, const char *funcname, const char *what, PyCompilerFlags *cf, PyObject **cmd_copy)\n{\n    const char *str;\n    Py_ssize_t size;\n    Py_buffer view;\n\n    *cmd_copy = NULL;\n    if (PyUnicode_Check(cmd)) {\n        cf->cf_flags |= PyCF_IGNORE_COOKIE;\n        str = PyUnicode_AsUTF8AndSize(cmd, &size);\n        if (str == NULL)\n            return NULL;\n    }\n    else if (PyBytes_Check(cmd)) {\n        str = PyBytes_AS_STRING(cmd);\n        size = PyBytes_GET_SIZE(cmd);\n    }\n    else if (PyByteArray_Check(cmd)) {\n        str = PyByteArray_AS_STRING(cmd);\n        size = PyByteArray_GET_SIZE(cmd);\n    }\n    else if (PyObject_GetBuffer(cmd, &view, PyBUF_SIMPLE) == 0) {\n        /* Copy to NUL-terminated buffer. */\n        *cmd_copy = PyBytes_FromStringAndSize(\n            (const char *)view.buf, view.len);\n        PyBuffer_Release(&view);\n        if (*cmd_copy == NULL) {\n            return NULL;\n        }\n        str = PyBytes_AS_STRING(*cmd_copy);\n        size = PyBytes_GET_SIZE(*cmd_copy);\n    }\n    else {\n        PyErr_Format(PyExc_TypeError,\n          \"%s() arg 1 must be a %s object\",\n          funcname, what);\n        return NULL;\n    }\n\n    if (strlen(str) != (size_t)size) {\n        PyErr_SetString(PyExc_ValueError,\n                        \"source code string cannot contain null bytes\");\n        Py_CLEAR(*cmd_copy);\n        return NULL;\n    }\n    return str;\n}\n\n// from Python/pythonrun.c\n/* compute parser flags based on compiler flags */\nstatic int PARSER_FLAGS(PyCompilerFlags *flags)\n{\n    int parser_flags = 0;\n    if (!flags)\n        return 0;\n    if (flags->cf_flags & PyCF_DONT_IMPLY_DEDENT)\n        parser_flags |= PyPARSE_DONT_IMPLY_DEDENT;\n    if (flags->cf_flags & PyCF_IGNORE_COOKIE)\n        parser_flags |= PyPARSE_IGNORE_COOKIE;\n    if (flags->cf_flags & CO_FUTURE_BARRY_AS_BDFL)\n        parser_flags |= PyPARSE_BARRY_AS_BDFL;\n    return parser_flags;\n}\n\n// from Python/pythonrun.c\n/* Set the error appropriate to the given input error code (see errcode.h) */\nstatic void\nerr_input(perrdetail *err)\n{\n    PyObject *v, *w, *errtype, *errtext;\n    PyObject *msg_obj = NULL;\n    char *msg = NULL;\n    int offset = err->offset;\n\n    errtype = PyExc_SyntaxError;\n    switch (err->error) {\n    case E_ERROR:\n        return;\n    case E_SYNTAX:\n        errtype = PyExc_IndentationError;\n        if (err->expected == INDENT)\n            msg = \"expected an indented block\";\n        else if (err->token == INDENT)\n            msg = \"unexpected indent\";\n        else if (err->token == DEDENT)\n            msg = \"unexpected unindent\";\n        else {\n            errtype = PyExc_SyntaxError;\n            if (err->token == TYPE_COMMENT)\n              msg = \"misplaced type annotation\";\n            else\n            msg = \"invalid syntax\";\n        }\n        break;\n    case E_TOKEN:\n        msg = \"invalid token\";\n        break;\n    case E_EOFS:\n        msg = \"EOF while scanning triple-quoted string literal\";\n        break;\n    case E_EOLS:\n        msg = \"EOL while scanning string literal\";\n        break;\n    case E_INTR:\n        if (!PyErr_Occurred())\n            PyErr_SetNone(PyExc_KeyboardInterrupt);\n        goto cleanup;\n    case E_NOMEM:\n        PyErr_NoMemory();\n        goto cleanup;\n    case E_EOF:\n        msg = \"unexpected EOF while parsing\";\n        break;\n    case E_TABSPACE:\n        errtype = PyExc_TabError;\n        msg = \"inconsistent use of tabs and spaces in indentation\";\n        break;\n    case E_OVERFLOW:\n        msg = \"expression too long\";\n        break;\n    case E_DEDENT:\n        errtype = PyExc_IndentationError;\n        msg = \"unindent does not match any outer indentation level\";\n        break;\n    case E_TOODEEP:\n        errtype = PyExc_IndentationError;\n        msg = \"too many levels of indentation\";\n        break;\n    case E_DECODE: {\n        PyObject *type, *value, *tb;\n        PyErr_Fetch(&type, &value, &tb);\n        msg = \"unknown decode error\";\n        if (value != NULL)\n            msg_obj = PyObject_Str(value);\n        Py_XDECREF(type);\n        Py_XDECREF(value);\n        Py_XDECREF(tb);\n        break;\n    }\n    case E_LINECONT:\n        msg = \"unexpected character after line continuation character\";\n        break;\n\n    case E_IDENTIFIER:\n        msg = \"invalid character in identifier\";\n        break;\n    case E_BADSINGLE:\n        msg = \"multiple statements found while compiling a single statement\";\n        break;\n    default:\n        fprintf(stderr, \"error=%d\\n\", err->error);\n        msg = \"unknown parsing error\";\n        break;\n    }\n    /* err->text may not be UTF-8 in case of decoding errors.\n       Explicitly convert to an object. */\n    if (!err->text) {\n        errtext = Py_None;\n        Py_INCREF(Py_None);\n    } else {\n        errtext = PyUnicode_DecodeUTF8(err->text, err->offset,\n                                       \"replace\");\n        if (errtext != NULL) {\n            Py_ssize_t len = strlen(err->text);\n            offset = (int)PyUnicode_GET_LENGTH(errtext);\n            if (len != err->offset) {\n                Py_DECREF(errtext);\n                errtext = PyUnicode_DecodeUTF8(err->text, len,\n                                               \"replace\");\n            }\n        }\n    }\n    v = Py_BuildValue(\"(OiiN)\", err->filename,\n                      err->lineno, offset, errtext);\n    if (v != NULL) {\n        if (msg_obj)\n            w = Py_BuildValue(\"(OO)\", msg_obj, v);\n        else\n            w = Py_BuildValue(\"(sO)\", msg, v);\n    } else\n        w = NULL;\n    Py_XDECREF(v);\n    PyErr_SetObject(errtype, w);\n    Py_XDECREF(w);\ncleanup:\n    Py_XDECREF(msg_obj);\n    if (err->text != NULL) {\n        PyObject_FREE(err->text);\n        err->text = NULL;\n    }\n}\n\n// from Python/pythonrun.c\nstatic void\nerr_free(perrdetail *err)\n{\n    Py_CLEAR(err->filename);\n}\n\n// from Python/pythonrun.c\nnode *\nTa3Parser_SimpleParseStringFlagsFilename(const char *str, const char *filename,\n                                         int start, int flags)\n{\n    perrdetail err;\n    node *n = Ta3Parser_ParseStringFlagsFilename(str, filename,\n                            &_Ta3Parser_Grammar, start, &err, flags);\n    if (n == NULL)\n        err_input(&err);\n    err_free(&err);\n    return n;\n}\n\n/* update compiler and parser flags based on feature version */\nvoid\n_Ta3Parser_UpdateFlags(PyCompilerFlags *flags, int *iflags, int feature_version)\n{\n    *iflags = PARSER_FLAGS(flags);\n    if (feature_version >= 7)\n        *iflags |= PyPARSE_ASYNC_ALWAYS;\n    flags->cf_flags |= *iflags & PyCF_MASK;\n}\n\n// copy of PyParser_ASTFromStringObject in Python/pythonrun.c\n/* Preferred access to parser is through AST. */\nstatic mod_ty\nstring_object_to_c_ast(const char *s, PyObject *filename, int start,\n                             PyCompilerFlags *flags, int feature_version,\n                             PyArena *arena)\n{\n    mod_ty mod;\n    PyCompilerFlags localflags;\n    perrdetail err;\n    node *n;\n    int iflags;\n\n    if (flags == NULL) {\n        localflags.cf_flags = 0;\n        flags = &localflags;\n    }\n    _Ta3Parser_UpdateFlags(flags, &iflags, feature_version);\n    n = Ta3Parser_ParseStringObject(s, filename,\n                                    &_Ta3Parser_Grammar, start, &err,\n                                    &iflags);\n    if (n) {\n        flags->cf_flags |= iflags & PyCF_MASK;\n        mod = Ta3AST_FromNodeObject(n, flags, filename, feature_version, arena);\n        Ta3Node_Free(n);\n    }\n    else {\n        err_input(&err);\n        mod = NULL;\n    }\n    err_free(&err);\n    return mod;\n}\n\n// adapted from Py_CompileStringObject in Python/pythonrun.c\nstatic PyObject *\nstring_object_to_py_ast(const char *str, PyObject *filename, int start,\n                       PyCompilerFlags *flags, int feature_version)\n{\n    mod_ty mod;\n    PyObject *result;\n    PyArena *arena = PyArena_New();\n    if (arena == NULL)\n        return NULL;\n\n    mod = string_object_to_c_ast(str, filename, start, flags, feature_version, arena);\n    if (mod == NULL) {\n        PyArena_Free(arena);\n        return NULL;\n    }\n\n    result = Ta3AST_mod2obj(mod);\n    PyArena_Free(arena);\n    return result;\n}\n\n// adapted from builtin_compile_impl in Python/bltinmodule.c\nstatic PyObject *\nast3_parse_impl(PyObject *source,\n                PyObject *filename,\n                const char *mode,\n                int feature_version)\n{\n    PyObject *source_copy;\n    const char *str;\n    int compile_mode = -1;\n    PyCompilerFlags cf;\n    int start[] = {file_input, eval_input, single_input, func_type_input};\n    PyObject *result;\n\n    cf.cf_flags = PyCF_ONLY_AST | PyCF_SOURCE_IS_UTF8;\n\n    if (strcmp(mode, \"exec\") == 0)\n        compile_mode = 0;\n    else if (strcmp(mode, \"eval\") == 0)\n        compile_mode = 1;\n    else if (strcmp(mode, \"single\") == 0)\n        compile_mode = 2;\n    else if (strcmp(mode, \"func_type\") == 0)\n        compile_mode = 3;\n    else {\n        PyErr_SetString(PyExc_ValueError,\n                        \"parse() mode must be 'exec', 'eval', 'single', for 'func_type'\");\n        goto error;\n    }\n\n    str = source_as_string(source, \"parse\", \"string or bytes\", &cf, &source_copy);\n    if (str == NULL)\n        goto error;\n\n    result = string_object_to_py_ast(str, filename, start[compile_mode], &cf, feature_version);\n    Py_XDECREF(source_copy);\n    goto finally;\n\nerror:\n    result = NULL;\nfinally:\n    Py_DECREF(filename);\n    return result;\n}\n\n// adapted from builtin_compile in Python/clinic/bltinmodule.c.h\nPyObject *\nast3_parse(PyObject *self, PyObject *args)\n{\n    PyObject *return_value = NULL;\n    PyObject *source;\n    PyObject *filename;\n    const char *mode;\n    int feature_version;\n\n    if (PyArg_ParseTuple(args, \"OO&si:parse\", &source, PyUnicode_FSDecoder, &filename, &mode, &feature_version))\n        return_value = ast3_parse_impl(source, filename, mode, feature_version);\n\n    return return_value;\n}\n"
  },
  {
    "path": "ast3/Grammar/Grammar",
    "content": "# Grammar for Python\n\n# NOTE WELL: You should also follow all the steps listed at\n# https://devguide.python.org/grammar/\n\n# Start symbols for the grammar:\n#       single_input is a single interactive statement;\n#       file_input is a module or sequence of commands read from an input file;\n#       eval_input is the input for the eval() functions.\n#       func_type_input is a PEP 484 Python 2 function type comment\n# NB: compound_stmt in single_input is followed by extra NEWLINE!\n# NB: due to the way TYPE_COMMENT is tokenized it will always be followed by a\n#      NEWLINE\nsingle_input: NEWLINE | simple_stmt | compound_stmt NEWLINE\nfile_input: (NEWLINE | stmt)* ENDMARKER\neval_input: testlist NEWLINE* ENDMARKER\n\ndecorator: '@' dotted_name [ '(' [arglist] ')' ] NEWLINE\ndecorators: decorator+\ndecorated: decorators (classdef | funcdef | async_funcdef)\n\nasync_funcdef: ASYNC funcdef\nfuncdef: 'def' NAME parameters ['->' test] ':' [TYPE_COMMENT] suite\n\nparameters: '(' [typedargslist] ')'\ntypedargslist: (tfpdef ['=' test] (',' [TYPE_COMMENT] tfpdef ['=' test])* (TYPE_COMMENT | [',' [TYPE_COMMENT] [\n        '*' [tfpdef] (',' [TYPE_COMMENT] tfpdef ['=' test])* (TYPE_COMMENT | [',' [TYPE_COMMENT] ['**' tfpdef [','] [TYPE_COMMENT]]])\n      | '**' tfpdef [','] [TYPE_COMMENT]]])\n  | '*' [tfpdef] (',' [TYPE_COMMENT] tfpdef ['=' test])* (TYPE_COMMENT | [',' [TYPE_COMMENT] ['**' tfpdef [','] [TYPE_COMMENT]]])\n  | '**' tfpdef [','] [TYPE_COMMENT])\ntfpdef: NAME [':' test]\nvarargslist: (vfpdef ['=' test] (',' vfpdef ['=' test])* [',' [\n        '*' [vfpdef] (',' vfpdef ['=' test])* [',' ['**' vfpdef [',']]]\n      | '**' vfpdef [',']]]\n  | '*' [vfpdef] (',' vfpdef ['=' test])* [',' ['**' vfpdef [',']]]\n  | '**' vfpdef [',']\n)\nvfpdef: NAME\n\nstmt: simple_stmt | compound_stmt\nsimple_stmt: small_stmt (';' small_stmt)* [';'] NEWLINE\nsmall_stmt: (expr_stmt | del_stmt | pass_stmt | flow_stmt |\n             import_stmt | global_stmt | nonlocal_stmt | assert_stmt)\nexpr_stmt: testlist_star_expr (annassign | augassign (yield_expr|testlist) |\n                     ('=' (yield_expr|testlist_star_expr))* [TYPE_COMMENT])\nannassign: ':' test ['=' test]\ntestlist_star_expr: (test|star_expr) (',' (test|star_expr))* [',']\naugassign: ('+=' | '-=' | '*=' | '@=' | '/=' | '%=' | '&=' | '|=' | '^=' |\n            '<<=' | '>>=' | '**=' | '//=')\n# For normal and annotated assignments, additional restrictions enforced by the interpreter\ndel_stmt: 'del' exprlist\npass_stmt: 'pass'\nflow_stmt: break_stmt | continue_stmt | return_stmt | raise_stmt | yield_stmt\nbreak_stmt: 'break'\ncontinue_stmt: 'continue'\nreturn_stmt: 'return' [testlist]\nyield_stmt: yield_expr\nraise_stmt: 'raise' [test ['from' test]]\nimport_stmt: import_name | import_from\nimport_name: 'import' dotted_as_names\n# note below: the ('.' | '...') is necessary because '...' is tokenized as ELLIPSIS\nimport_from: ('from' (('.' | '...')* dotted_name | ('.' | '...')+)\n              'import' ('*' | '(' import_as_names ')' | import_as_names))\nimport_as_name: NAME ['as' NAME]\ndotted_as_name: dotted_name ['as' NAME]\nimport_as_names: import_as_name (',' import_as_name)* [',']\ndotted_as_names: dotted_as_name (',' dotted_as_name)*\ndotted_name: NAME ('.' NAME)*\nglobal_stmt: 'global' NAME (',' NAME)*\nnonlocal_stmt: 'nonlocal' NAME (',' NAME)*\nassert_stmt: 'assert' test [',' test]\n\ncompound_stmt: if_stmt | while_stmt | for_stmt | try_stmt | with_stmt | funcdef | classdef | decorated | async_stmt\nasync_stmt: ASYNC (funcdef | with_stmt | for_stmt)\nif_stmt: 'if' test ':' suite ('elif' test ':' suite)* ['else' ':' suite]\nwhile_stmt: 'while' test ':' suite ['else' ':' suite]\nfor_stmt: 'for' exprlist 'in' testlist ':' [TYPE_COMMENT] suite ['else' ':' suite]\ntry_stmt: ('try' ':' suite\n           ((except_clause ':' suite)+\n            ['else' ':' suite]\n            ['finally' ':' suite] |\n           'finally' ':' suite))\nwith_stmt: 'with' with_item (',' with_item)*  ':' [TYPE_COMMENT] suite\nwith_item: test ['as' expr]\n# NB compile.c makes sure that the default except clause is last\nexcept_clause: 'except' [test ['as' NAME]]\n# the TYPE_COMMENT in suites is only parsed for funcdefs, but can't go elsewhere due to ambiguity\nsuite: simple_stmt | NEWLINE [TYPE_COMMENT NEWLINE] INDENT stmt+ DEDENT\n\ntest: or_test ['if' or_test 'else' test] | lambdef\ntest_nocond: or_test | lambdef_nocond\nlambdef: 'lambda' [varargslist] ':' test\nlambdef_nocond: 'lambda' [varargslist] ':' test_nocond\nor_test: and_test ('or' and_test)*\nand_test: not_test ('and' not_test)*\nnot_test: 'not' not_test | comparison\ncomparison: expr (comp_op expr)*\n# <> isn't actually a valid comparison operator in Python. It's here for the\n# sake of a __future__ import described in PEP 401 (which really works :-)\ncomp_op: '<'|'>'|'=='|'>='|'<='|'<>'|'!='|'in'|'not' 'in'|'is'|'is' 'not'\nstar_expr: '*' expr\nexpr: xor_expr ('|' xor_expr)*\nxor_expr: and_expr ('^' and_expr)*\nand_expr: shift_expr ('&' shift_expr)*\nshift_expr: arith_expr (('<<'|'>>') arith_expr)*\narith_expr: term (('+'|'-') term)*\nterm: factor (('*'|'@'|'/'|'%'|'//') factor)*\nfactor: ('+'|'-'|'~') factor | power\npower: atom_expr ['**' factor]\natom_expr: [AWAIT] atom trailer*\natom: ('(' [yield_expr|testlist_comp] ')' |\n       '[' [testlist_comp] ']' |\n       '{' [dictorsetmaker] '}' |\n       NAME | NUMBER | STRING+ | '...' | 'None' | 'True' | 'False')\ntestlist_comp: (test|star_expr) ( comp_for | (',' (test|star_expr))* [','] )\ntrailer: '(' [arglist] ')' | '[' subscriptlist ']' | '.' NAME\nsubscriptlist: subscript (',' subscript)* [',']\nsubscript: test | [test] ':' [test] [sliceop]\nsliceop: ':' [test]\nexprlist: (expr|star_expr) (',' (expr|star_expr))* [',']\ntestlist: test (',' test)* [',']\ndictorsetmaker: ( ((test ':' test | '**' expr)\n                   (comp_for | (',' (test ':' test | '**' expr))* [','])) |\n                  ((test | star_expr)\n                   (comp_for | (',' (test | star_expr))* [','])) )\n\nclassdef: 'class' NAME ['(' [arglist] ')'] ':' suite\n\narglist: argument (',' argument)*  [',']\n\n# The reason that keywords are test nodes instead of NAME is that using NAME\n# results in an ambiguity. ast.c makes sure it's a NAME.\n# \"test '=' test\" is really \"keyword '=' test\", but we have no such token.\n# These need to be in a single rule to avoid grammar that is ambiguous\n# to our LL(1) parser. Even though 'test' includes '*expr' in star_expr,\n# we explicitly match '*' here, too, to give it proper precedence.\n# Illegal combinations and orderings are blocked in ast.c:\n# multiple (test comp_for) arguments are blocked; keyword unpackings\n# that precede iterable unpackings are blocked; etc.\nargument: ( test [comp_for] |\n            test '=' test |\n            '**' test |\n            '*' test )\n\ncomp_iter: comp_for | comp_if\nsync_comp_for: 'for' exprlist 'in' or_test [comp_iter]\ncomp_for: [ASYNC] sync_comp_for\ncomp_if: 'if' test_nocond [comp_iter]\n\n# not used in grammar, but may appear in \"node\" passed from Parser to Compiler\nencoding_decl: NAME\n\nyield_expr: 'yield' [yield_arg]\nyield_arg: 'from' test | testlist\n\nfunc_type_input: func_type NEWLINE* ENDMARKER\nfunc_type: '(' [typelist] ')' '->' test\n# typelist is a modified typedargslist (see above)\ntypelist: (test (',' test)* [','\n       ['*' [test] (',' test)* [',' '**' test] | '**' test]]\n     |  '*' [test] (',' test)* [',' '**' test] | '**' test)\n"
  },
  {
    "path": "ast3/Include/Python-ast.h",
    "content": "/* File automatically generated by Parser/asdl_c.py. */\n\n#include \"../Include/asdl.h\"\n\ntypedef struct _mod *mod_ty;\n\ntypedef struct _stmt *stmt_ty;\n\ntypedef struct _expr *expr_ty;\n\ntypedef enum _expr_context { Load=1, Store=2, Del=3, AugLoad=4, AugStore=5,\n                             Param=6 } expr_context_ty;\n\ntypedef struct _slice *slice_ty;\n\ntypedef enum _boolop { And=1, Or=2 } boolop_ty;\n\ntypedef enum _operator { Add=1, Sub=2, Mult=3, MatMult=4, Div=5, Mod=6, Pow=7,\n                         LShift=8, RShift=9, BitOr=10, BitXor=11, BitAnd=12,\n                         FloorDiv=13 } operator_ty;\n\ntypedef enum _unaryop { Invert=1, Not=2, UAdd=3, USub=4 } unaryop_ty;\n\ntypedef enum _cmpop { Eq=1, NotEq=2, Lt=3, LtE=4, Gt=5, GtE=6, Is=7, IsNot=8,\n                      In=9, NotIn=10 } cmpop_ty;\n\ntypedef struct _comprehension *comprehension_ty;\n\ntypedef struct _excepthandler *excepthandler_ty;\n\ntypedef struct _arguments *arguments_ty;\n\ntypedef struct _arg *arg_ty;\n\ntypedef struct _keyword *keyword_ty;\n\ntypedef struct _alias *alias_ty;\n\ntypedef struct _withitem *withitem_ty;\n\ntypedef struct _type_ignore *type_ignore_ty;\n\n\nenum _mod_kind {Module_kind=1, Interactive_kind=2, Expression_kind=3,\n                 FunctionType_kind=4, Suite_kind=5};\nstruct _mod {\n    enum _mod_kind kind;\n    union {\n        struct {\n            asdl_seq *body;\n            asdl_seq *type_ignores;\n        } Module;\n\n        struct {\n            asdl_seq *body;\n        } Interactive;\n\n        struct {\n            expr_ty body;\n        } Expression;\n\n        struct {\n            asdl_seq *argtypes;\n            expr_ty returns;\n        } FunctionType;\n\n        struct {\n            asdl_seq *body;\n        } Suite;\n\n    } v;\n};\n\nenum _stmt_kind {FunctionDef_kind=1, AsyncFunctionDef_kind=2, ClassDef_kind=3,\n                  Return_kind=4, Delete_kind=5, Assign_kind=6,\n                  AugAssign_kind=7, AnnAssign_kind=8, For_kind=9,\n                  AsyncFor_kind=10, While_kind=11, If_kind=12, With_kind=13,\n                  AsyncWith_kind=14, Raise_kind=15, Try_kind=16,\n                  Assert_kind=17, Import_kind=18, ImportFrom_kind=19,\n                  Global_kind=20, Nonlocal_kind=21, Expr_kind=22, Pass_kind=23,\n                  Break_kind=24, Continue_kind=25};\nstruct _stmt {\n    enum _stmt_kind kind;\n    union {\n        struct {\n            identifier name;\n            arguments_ty args;\n            asdl_seq *body;\n            asdl_seq *decorator_list;\n            expr_ty returns;\n            string type_comment;\n        } FunctionDef;\n\n        struct {\n            identifier name;\n            arguments_ty args;\n            asdl_seq *body;\n            asdl_seq *decorator_list;\n            expr_ty returns;\n            string type_comment;\n        } AsyncFunctionDef;\n\n        struct {\n            identifier name;\n            asdl_seq *bases;\n            asdl_seq *keywords;\n            asdl_seq *body;\n            asdl_seq *decorator_list;\n        } ClassDef;\n\n        struct {\n            expr_ty value;\n        } Return;\n\n        struct {\n            asdl_seq *targets;\n        } Delete;\n\n        struct {\n            asdl_seq *targets;\n            expr_ty value;\n            string type_comment;\n        } Assign;\n\n        struct {\n            expr_ty target;\n            operator_ty op;\n            expr_ty value;\n        } AugAssign;\n\n        struct {\n            expr_ty target;\n            expr_ty annotation;\n            expr_ty value;\n            int simple;\n        } AnnAssign;\n\n        struct {\n            expr_ty target;\n            expr_ty iter;\n            asdl_seq *body;\n            asdl_seq *orelse;\n            string type_comment;\n        } For;\n\n        struct {\n            expr_ty target;\n            expr_ty iter;\n            asdl_seq *body;\n            asdl_seq *orelse;\n            string type_comment;\n        } AsyncFor;\n\n        struct {\n            expr_ty test;\n            asdl_seq *body;\n            asdl_seq *orelse;\n        } While;\n\n        struct {\n            expr_ty test;\n            asdl_seq *body;\n            asdl_seq *orelse;\n        } If;\n\n        struct {\n            asdl_seq *items;\n            asdl_seq *body;\n            string type_comment;\n        } With;\n\n        struct {\n            asdl_seq *items;\n            asdl_seq *body;\n            string type_comment;\n        } AsyncWith;\n\n        struct {\n            expr_ty exc;\n            expr_ty cause;\n        } Raise;\n\n        struct {\n            asdl_seq *body;\n            asdl_seq *handlers;\n            asdl_seq *orelse;\n            asdl_seq *finalbody;\n        } Try;\n\n        struct {\n            expr_ty test;\n            expr_ty msg;\n        } Assert;\n\n        struct {\n            asdl_seq *names;\n        } Import;\n\n        struct {\n            identifier module;\n            asdl_seq *names;\n            int level;\n        } ImportFrom;\n\n        struct {\n            asdl_seq *names;\n        } Global;\n\n        struct {\n            asdl_seq *names;\n        } Nonlocal;\n\n        struct {\n            expr_ty value;\n        } Expr;\n\n    } v;\n    int lineno;\n    int col_offset;\n};\n\nenum _expr_kind {BoolOp_kind=1, BinOp_kind=2, UnaryOp_kind=3, Lambda_kind=4,\n                  IfExp_kind=5, Dict_kind=6, Set_kind=7, ListComp_kind=8,\n                  SetComp_kind=9, DictComp_kind=10, GeneratorExp_kind=11,\n                  Await_kind=12, Yield_kind=13, YieldFrom_kind=14,\n                  Compare_kind=15, Call_kind=16, Num_kind=17, Str_kind=18,\n                  FormattedValue_kind=19, JoinedStr_kind=20, Bytes_kind=21,\n                  NameConstant_kind=22, Ellipsis_kind=23, Constant_kind=24,\n                  Attribute_kind=25, Subscript_kind=26, Starred_kind=27,\n                  Name_kind=28, List_kind=29, Tuple_kind=30};\nstruct _expr {\n    enum _expr_kind kind;\n    union {\n        struct {\n            boolop_ty op;\n            asdl_seq *values;\n        } BoolOp;\n\n        struct {\n            expr_ty left;\n            operator_ty op;\n            expr_ty right;\n        } BinOp;\n\n        struct {\n            unaryop_ty op;\n            expr_ty operand;\n        } UnaryOp;\n\n        struct {\n            arguments_ty args;\n            expr_ty body;\n        } Lambda;\n\n        struct {\n            expr_ty test;\n            expr_ty body;\n            expr_ty orelse;\n        } IfExp;\n\n        struct {\n            asdl_seq *keys;\n            asdl_seq *values;\n        } Dict;\n\n        struct {\n            asdl_seq *elts;\n        } Set;\n\n        struct {\n            expr_ty elt;\n            asdl_seq *generators;\n        } ListComp;\n\n        struct {\n            expr_ty elt;\n            asdl_seq *generators;\n        } SetComp;\n\n        struct {\n            expr_ty key;\n            expr_ty value;\n            asdl_seq *generators;\n        } DictComp;\n\n        struct {\n            expr_ty elt;\n            asdl_seq *generators;\n        } GeneratorExp;\n\n        struct {\n            expr_ty value;\n        } Await;\n\n        struct {\n            expr_ty value;\n        } Yield;\n\n        struct {\n            expr_ty value;\n        } YieldFrom;\n\n        struct {\n            expr_ty left;\n            asdl_int_seq *ops;\n            asdl_seq *comparators;\n        } Compare;\n\n        struct {\n            expr_ty func;\n            asdl_seq *args;\n            asdl_seq *keywords;\n        } Call;\n\n        struct {\n            object n;\n        } Num;\n\n        struct {\n            string s;\n            string kind;\n        } Str;\n\n        struct {\n            expr_ty value;\n            int conversion;\n            expr_ty format_spec;\n        } FormattedValue;\n\n        struct {\n            asdl_seq *values;\n        } JoinedStr;\n\n        struct {\n            bytes s;\n            string kind;\n        } Bytes;\n\n        struct {\n            singleton value;\n        } NameConstant;\n\n        struct {\n            constant value;\n        } Constant;\n\n        struct {\n            expr_ty value;\n            identifier attr;\n            expr_context_ty ctx;\n        } Attribute;\n\n        struct {\n            expr_ty value;\n            slice_ty slice;\n            expr_context_ty ctx;\n        } Subscript;\n\n        struct {\n            expr_ty value;\n            expr_context_ty ctx;\n        } Starred;\n\n        struct {\n            identifier id;\n            expr_context_ty ctx;\n        } Name;\n\n        struct {\n            asdl_seq *elts;\n            expr_context_ty ctx;\n        } List;\n\n        struct {\n            asdl_seq *elts;\n            expr_context_ty ctx;\n        } Tuple;\n\n    } v;\n    int lineno;\n    int col_offset;\n};\n\nenum _slice_kind {Slice_kind=1, ExtSlice_kind=2, Index_kind=3};\nstruct _slice {\n    enum _slice_kind kind;\n    union {\n        struct {\n            expr_ty lower;\n            expr_ty upper;\n            expr_ty step;\n        } Slice;\n\n        struct {\n            asdl_seq *dims;\n        } ExtSlice;\n\n        struct {\n            expr_ty value;\n        } Index;\n\n    } v;\n};\n\nstruct _comprehension {\n    expr_ty target;\n    expr_ty iter;\n    asdl_seq *ifs;\n    int is_async;\n};\n\nenum _excepthandler_kind {ExceptHandler_kind=1};\nstruct _excepthandler {\n    enum _excepthandler_kind kind;\n    union {\n        struct {\n            expr_ty type;\n            identifier name;\n            asdl_seq *body;\n        } ExceptHandler;\n\n    } v;\n    int lineno;\n    int col_offset;\n};\n\nstruct _arguments {\n    asdl_seq *args;\n    arg_ty vararg;\n    asdl_seq *kwonlyargs;\n    asdl_seq *kw_defaults;\n    arg_ty kwarg;\n    asdl_seq *defaults;\n};\n\nstruct _arg {\n    identifier arg;\n    expr_ty annotation;\n    string type_comment;\n    int lineno;\n    int col_offset;\n};\n\nstruct _keyword {\n    identifier arg;\n    expr_ty value;\n};\n\nstruct _alias {\n    identifier name;\n    identifier asname;\n};\n\nstruct _withitem {\n    expr_ty context_expr;\n    expr_ty optional_vars;\n};\n\nenum _type_ignore_kind {TypeIgnore_kind=1};\nstruct _type_ignore {\n    enum _type_ignore_kind kind;\n    union {\n        struct {\n            int lineno;\n            string tag;\n        } TypeIgnore;\n\n    } v;\n};\n\n\n#define Module(a0, a1, a2) _Ta3_Module(a0, a1, a2)\nmod_ty _Ta3_Module(asdl_seq * body, asdl_seq * type_ignores, PyArena *arena);\n#define Interactive(a0, a1) _Ta3_Interactive(a0, a1)\nmod_ty _Ta3_Interactive(asdl_seq * body, PyArena *arena);\n#define Expression(a0, a1) _Ta3_Expression(a0, a1)\nmod_ty _Ta3_Expression(expr_ty body, PyArena *arena);\n#define FunctionType(a0, a1, a2) _Ta3_FunctionType(a0, a1, a2)\nmod_ty _Ta3_FunctionType(asdl_seq * argtypes, expr_ty returns, PyArena *arena);\n#define Suite(a0, a1) _Ta3_Suite(a0, a1)\nmod_ty _Ta3_Suite(asdl_seq * body, PyArena *arena);\n#define FunctionDef(a0, a1, a2, a3, a4, a5, a6, a7, a8) _Ta3_FunctionDef(a0, a1, a2, a3, a4, a5, a6, a7, a8)\nstmt_ty _Ta3_FunctionDef(identifier name, arguments_ty args, asdl_seq * body,\n                         asdl_seq * decorator_list, expr_ty returns, string\n                         type_comment, int lineno, int col_offset, PyArena\n                         *arena);\n#define AsyncFunctionDef(a0, a1, a2, a3, a4, a5, a6, a7, a8) _Ta3_AsyncFunctionDef(a0, a1, a2, a3, a4, a5, a6, a7, a8)\nstmt_ty _Ta3_AsyncFunctionDef(identifier name, arguments_ty args, asdl_seq *\n                              body, asdl_seq * decorator_list, expr_ty returns,\n                              string type_comment, int lineno, int col_offset,\n                              PyArena *arena);\n#define ClassDef(a0, a1, a2, a3, a4, a5, a6, a7) _Ta3_ClassDef(a0, a1, a2, a3, a4, a5, a6, a7)\nstmt_ty _Ta3_ClassDef(identifier name, asdl_seq * bases, asdl_seq * keywords,\n                      asdl_seq * body, asdl_seq * decorator_list, int lineno,\n                      int col_offset, PyArena *arena);\n#define Return(a0, a1, a2, a3) _Ta3_Return(a0, a1, a2, a3)\nstmt_ty _Ta3_Return(expr_ty value, int lineno, int col_offset, PyArena *arena);\n#define Delete(a0, a1, a2, a3) _Ta3_Delete(a0, a1, a2, a3)\nstmt_ty _Ta3_Delete(asdl_seq * targets, int lineno, int col_offset, PyArena\n                    *arena);\n#define Assign(a0, a1, a2, a3, a4, a5) _Ta3_Assign(a0, a1, a2, a3, a4, a5)\nstmt_ty _Ta3_Assign(asdl_seq * targets, expr_ty value, string type_comment, int\n                    lineno, int col_offset, PyArena *arena);\n#define AugAssign(a0, a1, a2, a3, a4, a5) _Ta3_AugAssign(a0, a1, a2, a3, a4, a5)\nstmt_ty _Ta3_AugAssign(expr_ty target, operator_ty op, expr_ty value, int\n                       lineno, int col_offset, PyArena *arena);\n#define AnnAssign(a0, a1, a2, a3, a4, a5, a6) _Ta3_AnnAssign(a0, a1, a2, a3, a4, a5, a6)\nstmt_ty _Ta3_AnnAssign(expr_ty target, expr_ty annotation, expr_ty value, int\n                       simple, int lineno, int col_offset, PyArena *arena);\n#define For(a0, a1, a2, a3, a4, a5, a6, a7) _Ta3_For(a0, a1, a2, a3, a4, a5, a6, a7)\nstmt_ty _Ta3_For(expr_ty target, expr_ty iter, asdl_seq * body, asdl_seq *\n                 orelse, string type_comment, int lineno, int col_offset,\n                 PyArena *arena);\n#define AsyncFor(a0, a1, a2, a3, a4, a5, a6, a7) _Ta3_AsyncFor(a0, a1, a2, a3, a4, a5, a6, a7)\nstmt_ty _Ta3_AsyncFor(expr_ty target, expr_ty iter, asdl_seq * body, asdl_seq *\n                      orelse, string type_comment, int lineno, int col_offset,\n                      PyArena *arena);\n#define While(a0, a1, a2, a3, a4, a5) _Ta3_While(a0, a1, a2, a3, a4, a5)\nstmt_ty _Ta3_While(expr_ty test, asdl_seq * body, asdl_seq * orelse, int\n                   lineno, int col_offset, PyArena *arena);\n#define If(a0, a1, a2, a3, a4, a5) _Ta3_If(a0, a1, a2, a3, a4, a5)\nstmt_ty _Ta3_If(expr_ty test, asdl_seq * body, asdl_seq * orelse, int lineno,\n                int col_offset, PyArena *arena);\n#define With(a0, a1, a2, a3, a4, a5) _Ta3_With(a0, a1, a2, a3, a4, a5)\nstmt_ty _Ta3_With(asdl_seq * items, asdl_seq * body, string type_comment, int\n                  lineno, int col_offset, PyArena *arena);\n#define AsyncWith(a0, a1, a2, a3, a4, a5) _Ta3_AsyncWith(a0, a1, a2, a3, a4, a5)\nstmt_ty _Ta3_AsyncWith(asdl_seq * items, asdl_seq * body, string type_comment,\n                       int lineno, int col_offset, PyArena *arena);\n#define Raise(a0, a1, a2, a3, a4) _Ta3_Raise(a0, a1, a2, a3, a4)\nstmt_ty _Ta3_Raise(expr_ty exc, expr_ty cause, int lineno, int col_offset,\n                   PyArena *arena);\n#define Try(a0, a1, a2, a3, a4, a5, a6) _Ta3_Try(a0, a1, a2, a3, a4, a5, a6)\nstmt_ty _Ta3_Try(asdl_seq * body, asdl_seq * handlers, asdl_seq * orelse,\n                 asdl_seq * finalbody, int lineno, int col_offset, PyArena\n                 *arena);\n#define Assert(a0, a1, a2, a3, a4) _Ta3_Assert(a0, a1, a2, a3, a4)\nstmt_ty _Ta3_Assert(expr_ty test, expr_ty msg, int lineno, int col_offset,\n                    PyArena *arena);\n#define Import(a0, a1, a2, a3) _Ta3_Import(a0, a1, a2, a3)\nstmt_ty _Ta3_Import(asdl_seq * names, int lineno, int col_offset, PyArena\n                    *arena);\n#define ImportFrom(a0, a1, a2, a3, a4, a5) _Ta3_ImportFrom(a0, a1, a2, a3, a4, a5)\nstmt_ty _Ta3_ImportFrom(identifier module, asdl_seq * names, int level, int\n                        lineno, int col_offset, PyArena *arena);\n#define Global(a0, a1, a2, a3) _Ta3_Global(a0, a1, a2, a3)\nstmt_ty _Ta3_Global(asdl_seq * names, int lineno, int col_offset, PyArena\n                    *arena);\n#define Nonlocal(a0, a1, a2, a3) _Ta3_Nonlocal(a0, a1, a2, a3)\nstmt_ty _Ta3_Nonlocal(asdl_seq * names, int lineno, int col_offset, PyArena\n                      *arena);\n#define Expr(a0, a1, a2, a3) _Ta3_Expr(a0, a1, a2, a3)\nstmt_ty _Ta3_Expr(expr_ty value, int lineno, int col_offset, PyArena *arena);\n#define Pass(a0, a1, a2) _Ta3_Pass(a0, a1, a2)\nstmt_ty _Ta3_Pass(int lineno, int col_offset, PyArena *arena);\n#define Break(a0, a1, a2) _Ta3_Break(a0, a1, a2)\nstmt_ty _Ta3_Break(int lineno, int col_offset, PyArena *arena);\n#define Continue(a0, a1, a2) _Ta3_Continue(a0, a1, a2)\nstmt_ty _Ta3_Continue(int lineno, int col_offset, PyArena *arena);\n#define BoolOp(a0, a1, a2, a3, a4) _Ta3_BoolOp(a0, a1, a2, a3, a4)\nexpr_ty _Ta3_BoolOp(boolop_ty op, asdl_seq * values, int lineno, int\n                    col_offset, PyArena *arena);\n#define BinOp(a0, a1, a2, a3, a4, a5) _Ta3_BinOp(a0, a1, a2, a3, a4, a5)\nexpr_ty _Ta3_BinOp(expr_ty left, operator_ty op, expr_ty right, int lineno, int\n                   col_offset, PyArena *arena);\n#define UnaryOp(a0, a1, a2, a3, a4) _Ta3_UnaryOp(a0, a1, a2, a3, a4)\nexpr_ty _Ta3_UnaryOp(unaryop_ty op, expr_ty operand, int lineno, int\n                     col_offset, PyArena *arena);\n#define Lambda(a0, a1, a2, a3, a4) _Ta3_Lambda(a0, a1, a2, a3, a4)\nexpr_ty _Ta3_Lambda(arguments_ty args, expr_ty body, int lineno, int\n                    col_offset, PyArena *arena);\n#define IfExp(a0, a1, a2, a3, a4, a5) _Ta3_IfExp(a0, a1, a2, a3, a4, a5)\nexpr_ty _Ta3_IfExp(expr_ty test, expr_ty body, expr_ty orelse, int lineno, int\n                   col_offset, PyArena *arena);\n#define Dict(a0, a1, a2, a3, a4) _Ta3_Dict(a0, a1, a2, a3, a4)\nexpr_ty _Ta3_Dict(asdl_seq * keys, asdl_seq * values, int lineno, int\n                  col_offset, PyArena *arena);\n#define Set(a0, a1, a2, a3) _Ta3_Set(a0, a1, a2, a3)\nexpr_ty _Ta3_Set(asdl_seq * elts, int lineno, int col_offset, PyArena *arena);\n#define ListComp(a0, a1, a2, a3, a4) _Ta3_ListComp(a0, a1, a2, a3, a4)\nexpr_ty _Ta3_ListComp(expr_ty elt, asdl_seq * generators, int lineno, int\n                      col_offset, PyArena *arena);\n#define SetComp(a0, a1, a2, a3, a4) _Ta3_SetComp(a0, a1, a2, a3, a4)\nexpr_ty _Ta3_SetComp(expr_ty elt, asdl_seq * generators, int lineno, int\n                     col_offset, PyArena *arena);\n#define DictComp(a0, a1, a2, a3, a4, a5) _Ta3_DictComp(a0, a1, a2, a3, a4, a5)\nexpr_ty _Ta3_DictComp(expr_ty key, expr_ty value, asdl_seq * generators, int\n                      lineno, int col_offset, PyArena *arena);\n#define GeneratorExp(a0, a1, a2, a3, a4) _Ta3_GeneratorExp(a0, a1, a2, a3, a4)\nexpr_ty _Ta3_GeneratorExp(expr_ty elt, asdl_seq * generators, int lineno, int\n                          col_offset, PyArena *arena);\n#define Await(a0, a1, a2, a3) _Ta3_Await(a0, a1, a2, a3)\nexpr_ty _Ta3_Await(expr_ty value, int lineno, int col_offset, PyArena *arena);\n#define Yield(a0, a1, a2, a3) _Ta3_Yield(a0, a1, a2, a3)\nexpr_ty _Ta3_Yield(expr_ty value, int lineno, int col_offset, PyArena *arena);\n#define YieldFrom(a0, a1, a2, a3) _Ta3_YieldFrom(a0, a1, a2, a3)\nexpr_ty _Ta3_YieldFrom(expr_ty value, int lineno, int col_offset, PyArena\n                       *arena);\n#define Compare(a0, a1, a2, a3, a4, a5) _Ta3_Compare(a0, a1, a2, a3, a4, a5)\nexpr_ty _Ta3_Compare(expr_ty left, asdl_int_seq * ops, asdl_seq * comparators,\n                     int lineno, int col_offset, PyArena *arena);\n#define Call(a0, a1, a2, a3, a4, a5) _Ta3_Call(a0, a1, a2, a3, a4, a5)\nexpr_ty _Ta3_Call(expr_ty func, asdl_seq * args, asdl_seq * keywords, int\n                  lineno, int col_offset, PyArena *arena);\n#define Num(a0, a1, a2, a3) _Ta3_Num(a0, a1, a2, a3)\nexpr_ty _Ta3_Num(object n, int lineno, int col_offset, PyArena *arena);\n#define Str(a0, a1, a2, a3, a4) _Ta3_Str(a0, a1, a2, a3, a4)\nexpr_ty _Ta3_Str(string s, string kind, int lineno, int col_offset, PyArena\n                 *arena);\n#define FormattedValue(a0, a1, a2, a3, a4, a5) _Ta3_FormattedValue(a0, a1, a2, a3, a4, a5)\nexpr_ty _Ta3_FormattedValue(expr_ty value, int conversion, expr_ty format_spec,\n                            int lineno, int col_offset, PyArena *arena);\n#define JoinedStr(a0, a1, a2, a3) _Ta3_JoinedStr(a0, a1, a2, a3)\nexpr_ty _Ta3_JoinedStr(asdl_seq * values, int lineno, int col_offset, PyArena\n                       *arena);\n#define Bytes(a0, a1, a2, a3, a4) _Ta3_Bytes(a0, a1, a2, a3, a4)\nexpr_ty _Ta3_Bytes(bytes s, string kind, int lineno, int col_offset, PyArena\n                   *arena);\n#define NameConstant(a0, a1, a2, a3) _Ta3_NameConstant(a0, a1, a2, a3)\nexpr_ty _Ta3_NameConstant(singleton value, int lineno, int col_offset, PyArena\n                          *arena);\n#define Ellipsis(a0, a1, a2) _Ta3_Ellipsis(a0, a1, a2)\nexpr_ty _Ta3_Ellipsis(int lineno, int col_offset, PyArena *arena);\n#define Constant(a0, a1, a2, a3) _Ta3_Constant(a0, a1, a2, a3)\nexpr_ty _Ta3_Constant(constant value, int lineno, int col_offset, PyArena\n                      *arena);\n#define Attribute(a0, a1, a2, a3, a4, a5) _Ta3_Attribute(a0, a1, a2, a3, a4, a5)\nexpr_ty _Ta3_Attribute(expr_ty value, identifier attr, expr_context_ty ctx, int\n                       lineno, int col_offset, PyArena *arena);\n#define Subscript(a0, a1, a2, a3, a4, a5) _Ta3_Subscript(a0, a1, a2, a3, a4, a5)\nexpr_ty _Ta3_Subscript(expr_ty value, slice_ty slice, expr_context_ty ctx, int\n                       lineno, int col_offset, PyArena *arena);\n#define Starred(a0, a1, a2, a3, a4) _Ta3_Starred(a0, a1, a2, a3, a4)\nexpr_ty _Ta3_Starred(expr_ty value, expr_context_ty ctx, int lineno, int\n                     col_offset, PyArena *arena);\n#define Name(a0, a1, a2, a3, a4) _Ta3_Name(a0, a1, a2, a3, a4)\nexpr_ty _Ta3_Name(identifier id, expr_context_ty ctx, int lineno, int\n                  col_offset, PyArena *arena);\n#define List(a0, a1, a2, a3, a4) _Ta3_List(a0, a1, a2, a3, a4)\nexpr_ty _Ta3_List(asdl_seq * elts, expr_context_ty ctx, int lineno, int\n                  col_offset, PyArena *arena);\n#define Tuple(a0, a1, a2, a3, a4) _Ta3_Tuple(a0, a1, a2, a3, a4)\nexpr_ty _Ta3_Tuple(asdl_seq * elts, expr_context_ty ctx, int lineno, int\n                   col_offset, PyArena *arena);\n#define Slice(a0, a1, a2, a3) _Ta3_Slice(a0, a1, a2, a3)\nslice_ty _Ta3_Slice(expr_ty lower, expr_ty upper, expr_ty step, PyArena *arena);\n#define ExtSlice(a0, a1) _Ta3_ExtSlice(a0, a1)\nslice_ty _Ta3_ExtSlice(asdl_seq * dims, PyArena *arena);\n#define Index(a0, a1) _Ta3_Index(a0, a1)\nslice_ty _Ta3_Index(expr_ty value, PyArena *arena);\n#define comprehension(a0, a1, a2, a3, a4) _Ta3_comprehension(a0, a1, a2, a3, a4)\ncomprehension_ty _Ta3_comprehension(expr_ty target, expr_ty iter, asdl_seq *\n                                    ifs, int is_async, PyArena *arena);\n#define ExceptHandler(a0, a1, a2, a3, a4, a5) _Ta3_ExceptHandler(a0, a1, a2, a3, a4, a5)\nexcepthandler_ty _Ta3_ExceptHandler(expr_ty type, identifier name, asdl_seq *\n                                    body, int lineno, int col_offset, PyArena\n                                    *arena);\n#define arguments(a0, a1, a2, a3, a4, a5, a6) _Ta3_arguments(a0, a1, a2, a3, a4, a5, a6)\narguments_ty _Ta3_arguments(asdl_seq * args, arg_ty vararg, asdl_seq *\n                            kwonlyargs, asdl_seq * kw_defaults, arg_ty kwarg,\n                            asdl_seq * defaults, PyArena *arena);\n#define arg(a0, a1, a2, a3, a4, a5) _Ta3_arg(a0, a1, a2, a3, a4, a5)\narg_ty _Ta3_arg(identifier arg, expr_ty annotation, string type_comment, int\n                lineno, int col_offset, PyArena *arena);\n#define keyword(a0, a1, a2) _Ta3_keyword(a0, a1, a2)\nkeyword_ty _Ta3_keyword(identifier arg, expr_ty value, PyArena *arena);\n#define alias(a0, a1, a2) _Ta3_alias(a0, a1, a2)\nalias_ty _Ta3_alias(identifier name, identifier asname, PyArena *arena);\n#define withitem(a0, a1, a2) _Ta3_withitem(a0, a1, a2)\nwithitem_ty _Ta3_withitem(expr_ty context_expr, expr_ty optional_vars, PyArena\n                          *arena);\n#define TypeIgnore(a0, a1, a2) _Ta3_TypeIgnore(a0, a1, a2)\ntype_ignore_ty _Ta3_TypeIgnore(int lineno, string tag, PyArena *arena);\n\nPyObject* Ta3AST_mod2obj(mod_ty t);\nmod_ty Ta3AST_obj2mod(PyObject* ast, PyArena* arena, int mode);\nint Ta3AST_Check(PyObject* obj);\n"
  },
  {
    "path": "ast3/Include/asdl.h",
    "content": "#ifndef Ta3_ASDL_H\n#define Ta3_ASDL_H\n\n#include \"../Include/pyarena.h\"\n\ntypedef PyObject * identifier;\ntypedef PyObject * string;\ntypedef PyObject * bytes;\ntypedef PyObject * object;\ntypedef PyObject * singleton;\ntypedef PyObject * constant;\n\n/* It would be nice if the code generated by asdl_c.py was completely\n   independent of Python, but it is a goal the requires too much work\n   at this stage.  So, for example, I'll represent identifiers as\n   interned Python strings.\n*/\n\n/* XXX A sequence should be typed so that its use can be typechecked. */\n\ntypedef struct {\n    Py_ssize_t size;\n    void *elements[1];\n} asdl_seq;\n\ntypedef struct {\n    Py_ssize_t size;\n    int elements[1];\n} asdl_int_seq;\n\nasdl_seq *_Ta3_asdl_seq_new(Py_ssize_t size, PyArena *arena);\nasdl_int_seq *_Ta3_asdl_int_seq_new(Py_ssize_t size, PyArena *arena);\n\n#define asdl_seq_GET(S, I) (S)->elements[(I)]\n#define asdl_seq_LEN(S) ((S) == NULL ? 0 : (S)->size)\n#ifdef Py_DEBUG\n#define asdl_seq_SET(S, I, V) \\\n    do { \\\n        Py_ssize_t _asdl_i = (I); \\\n        assert((S) != NULL); \\\n        assert(_asdl_i < (S)->size); \\\n        (S)->elements[_asdl_i] = (V); \\\n    } while (0)\n#else\n#define asdl_seq_SET(S, I, V) (S)->elements[I] = (V)\n#endif\n\n#endif /* !Ta3_ASDL_H */\n"
  },
  {
    "path": "ast3/Include/ast.h",
    "content": "#ifndef Ta3_AST_H\n#define Ta3_AST_H\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\nextern int Ta3AST_Validate(mod_ty);\nextern mod_ty Ta3AST_FromNode(\n    const node *n,\n    PyCompilerFlags *flags,\n    const char *filename,       /* decoded from the filesystem encoding */\n    int feature_version,\n    PyArena *arena);\nextern mod_ty Ta3AST_FromNodeObject(\n    const node *n,\n    PyCompilerFlags *flags,\n    PyObject *filename,\n    int feature_version,\n    PyArena *arena);\n\n#ifndef Py_LIMITED_API\n\n/* _PyAST_ExprAsUnicode is defined in ast_unparse.c */\nextern PyObject * _PyAST_ExprAsUnicode(expr_ty);\n\n#endif /* !Py_LIMITED_API */\n\n#ifdef __cplusplus\n}\n#endif\n#endif /* !Ta3_AST_H */\n"
  },
  {
    "path": "ast3/Include/bitset.h",
    "content": "\n#ifndef Ta3_BITSET_H\n#define Ta3_BITSET_H\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n/* Bitset interface */\n\n#define BYTE            char\n\ntypedef BYTE *bitset;\n\nbitset newbitset(int nbits);\nvoid delbitset(bitset bs);\n#define testbit(ss, ibit) (((ss)[BIT2BYTE(ibit)] & BIT2MASK(ibit)) != 0)\nint addbit(bitset bs, int ibit); /* Returns 0 if already set */\nint samebitset(bitset bs1, bitset bs2, int nbits);\nvoid mergebitset(bitset bs1, bitset bs2, int nbits);\n\n#define BITSPERBYTE     (8*sizeof(BYTE))\n#define NBYTES(nbits)   (((nbits) + BITSPERBYTE - 1) / BITSPERBYTE)\n\n#define BIT2BYTE(ibit)  ((ibit) / BITSPERBYTE)\n#define BIT2SHIFT(ibit) ((ibit) % BITSPERBYTE)\n#define BIT2MASK(ibit)  (1 << BIT2SHIFT(ibit))\n#define BYTE2BIT(ibyte) ((ibyte) * BITSPERBYTE)\n\n#ifdef __cplusplus\n}\n#endif\n#endif /* !Ta3_BITSET_H */\n"
  },
  {
    "path": "ast3/Include/errcode.h",
    "content": "#ifndef Ta3_ERRCODE_H\n#define Ta3_ERRCODE_H\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n\n/* Error codes passed around between file input, tokenizer, parser and\n   interpreter.  This is necessary so we can turn them into Python\n   exceptions at a higher level.  Note that some errors have a\n   slightly different meaning when passed from the tokenizer to the\n   parser than when passed from the parser to the interpreter; e.g.\n   the parser only returns E_EOF when it hits EOF immediately, and it\n   never returns E_OK. */\n\n#define E_OK            10      /* No error */\n#define E_EOF           11      /* End Of File */\n#define E_INTR          12      /* Interrupted */\n#define E_TOKEN         13      /* Bad token */\n#define E_SYNTAX        14      /* Syntax error */\n#define E_NOMEM         15      /* Ran out of memory */\n#define E_DONE          16      /* Parsing complete */\n#define E_ERROR         17      /* Execution error */\n#define E_TABSPACE      18      /* Inconsistent mixing of tabs and spaces */\n#define E_OVERFLOW      19      /* Node had too many children */\n#define E_TOODEEP       20      /* Too many indentation levels */\n#define E_DEDENT        21      /* No matching outer block for dedent */\n#define E_DECODE        22      /* Error in decoding into Unicode */\n#define E_EOFS          23      /* EOF in triple-quoted string */\n#define E_EOLS          24      /* EOL in single-quoted string */\n#define E_LINECONT      25      /* Unexpected characters after a line continuation */\n#define E_IDENTIFIER    26      /* Invalid characters in identifier */\n#define E_BADSINGLE     27      /* Ill-formed single statement input */\n\n#ifdef __cplusplus\n}\n#endif\n#endif /* !Ta3_ERRCODE_H */\n"
  },
  {
    "path": "ast3/Include/graminit.h",
    "content": "/* Generated by Parser/pgen */\n\n#define single_input 256\n#define file_input 257\n#define eval_input 258\n#define decorator 259\n#define decorators 260\n#define decorated 261\n#define async_funcdef 262\n#define funcdef 263\n#define parameters 264\n#define typedargslist 265\n#define tfpdef 266\n#define varargslist 267\n#define vfpdef 268\n#define stmt 269\n#define simple_stmt 270\n#define small_stmt 271\n#define expr_stmt 272\n#define annassign 273\n#define testlist_star_expr 274\n#define augassign 275\n#define del_stmt 276\n#define pass_stmt 277\n#define flow_stmt 278\n#define break_stmt 279\n#define continue_stmt 280\n#define return_stmt 281\n#define yield_stmt 282\n#define raise_stmt 283\n#define import_stmt 284\n#define import_name 285\n#define import_from 286\n#define import_as_name 287\n#define dotted_as_name 288\n#define import_as_names 289\n#define dotted_as_names 290\n#define dotted_name 291\n#define global_stmt 292\n#define nonlocal_stmt 293\n#define assert_stmt 294\n#define compound_stmt 295\n#define async_stmt 296\n#define if_stmt 297\n#define while_stmt 298\n#define for_stmt 299\n#define try_stmt 300\n#define with_stmt 301\n#define with_item 302\n#define except_clause 303\n#define suite 304\n#define test 305\n#define test_nocond 306\n#define lambdef 307\n#define lambdef_nocond 308\n#define or_test 309\n#define and_test 310\n#define not_test 311\n#define comparison 312\n#define comp_op 313\n#define star_expr 314\n#define expr 315\n#define xor_expr 316\n#define and_expr 317\n#define shift_expr 318\n#define arith_expr 319\n#define term 320\n#define factor 321\n#define power 322\n#define atom_expr 323\n#define atom 324\n#define testlist_comp 325\n#define trailer 326\n#define subscriptlist 327\n#define subscript 328\n#define sliceop 329\n#define exprlist 330\n#define testlist 331\n#define dictorsetmaker 332\n#define classdef 333\n#define arglist 334\n#define argument 335\n#define comp_iter 336\n#define sync_comp_for 337\n#define comp_for 338\n#define comp_if 339\n#define encoding_decl 340\n#define yield_expr 341\n#define yield_arg 342\n#define func_type_input 343\n#define func_type 344\n#define typelist 345\n"
  },
  {
    "path": "ast3/Include/grammar.h",
    "content": "\n/* Grammar interface */\n\n#ifndef Ta3_GRAMMAR_H\n#define Ta3_GRAMMAR_H\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n#include \"../Include/bitset.h\"\n\n/* A label of an arc */\n\ntypedef struct {\n    int          lb_type;\n    char        *lb_str;\n} label;\n\n#define EMPTY 0         /* Label number 0 is by definition the empty label */\n\n/* A list of labels */\n\ntypedef struct {\n    int          ll_nlabels;\n    label       *ll_label;\n} labellist;\n\n/* An arc from one state to another */\n\ntypedef struct {\n    short       a_lbl;          /* Label of this arc */\n    short       a_arrow;        /* State where this arc goes to */\n} arc;\n\n/* A state in a DFA */\n\ntypedef struct {\n    int          s_narcs;\n    arc         *s_arc;         /* Array of arcs */\n\n    /* Optional accelerators */\n    int          s_lower;       /* Lowest label index */\n    int          s_upper;       /* Highest label index */\n    int         *s_accel;       /* Accelerator */\n    int          s_accept;      /* Nonzero for accepting state */\n} state;\n\n/* A DFA */\n\ntypedef struct {\n    int          d_type;        /* Non-terminal this represents */\n    char        *d_name;        /* For printing */\n    int          d_initial;     /* Initial state */\n    int          d_nstates;\n    state       *d_state;       /* Array of states */\n    bitset       d_first;\n} dfa;\n\n/* A grammar */\n\ntypedef struct {\n    int          g_ndfas;\n    dfa         *g_dfa;         /* Array of DFAs */\n    labellist    g_ll;\n    int          g_start;       /* Start symbol of the grammar */\n    int          g_accel;       /* Set if accelerators present */\n} grammar;\n\n/* FUNCTIONS */\n\ngrammar *newgrammar(int start);\nvoid freegrammar(grammar *g);\ndfa *adddfa(grammar *g, int type, const char *name);\nint addstate(dfa *d);\nvoid addarc(dfa *d, int from, int to, int lbl);\ndfa *Ta3Grammar_FindDFA(grammar *g, int type);\n\nint addlabel(labellist *ll, int type, const char *str);\nint findlabel(labellist *ll, int type, const char *str);\nconst char *Ta3Grammar_LabelRepr(label *lb);\nvoid translatelabels(grammar *g);\n\nvoid addfirstsets(grammar *g);\n\nvoid Ta3Grammar_AddAccelerators(grammar *g);\nvoid Ta3Grammar_RemoveAccelerators(grammar *);\n\nvoid printgrammar(grammar *g, FILE *fp);\nvoid printnonterminals(grammar *g, FILE *fp);\n\n#ifdef __cplusplus\n}\n#endif\n#endif /* !Ta3_GRAMMAR_H */\n"
  },
  {
    "path": "ast3/Include/node.h",
    "content": "\n/* Parse tree node interface */\n\n#ifndef Ta3_NODE_H\n#define Ta3_NODE_H\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\ntypedef struct _node {\n    short               n_type;\n    char                *n_str;\n    int                 n_lineno;\n    int                 n_col_offset;\n    int                 n_nchildren;\n    struct _node        *n_child;\n} node;\n\nextern node * Ta3Node_New(int type);\nextern int Ta3Node_AddChild(node *n, int type,\n                                      char *str, int lineno, int col_offset);\nextern void Ta3Node_Free(node *n);\n#ifndef Py_LIMITED_API\nextern Py_ssize_t _Ta3Node_SizeOf(node *n);\n#endif\n\n/* Node access functions */\n#define NCH(n)          ((n)->n_nchildren)\n\n#define CHILD(n, i)     (&(n)->n_child[i])\n#define RCHILD(n, i)    (CHILD(n, NCH(n) + i))\n#define TYPE(n)         ((n)->n_type)\n#define STR(n)          ((n)->n_str)\n#define LINENO(n)       ((n)->n_lineno)\n\n/* Assert that the type of a node is what we expect */\n#define REQ(n, type) assert(TYPE(n) == (type))\n\nextern void PyNode_ListTree(node *);\n\n#ifdef __cplusplus\n}\n#endif\n#endif /* !Ta3_NODE_H */\n"
  },
  {
    "path": "ast3/Include/parsetok.h",
    "content": "\n/* Parser-tokenizer link interface */\n#ifndef Py_LIMITED_API\n#ifndef Ta3_PARSETOK_H\n#define Ta3_PARSETOK_H\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\ntypedef struct {\n    int error;\n#ifndef PGEN\n    /* The filename is useless for pgen, see comment in tok_state structure */\n    PyObject *filename;\n#endif\n    int lineno;\n    int offset;\n    char *text;                 /* UTF-8-encoded string */\n    int token;\n    int expected;\n} perrdetail;\n\n#if 0\n#define PyPARSE_YIELD_IS_KEYWORD        0x0001\n#endif\n\n#define PyPARSE_DONT_IMPLY_DEDENT       0x0002\n\n#if 0\n#define PyPARSE_WITH_IS_KEYWORD         0x0003\n#define PyPARSE_PRINT_IS_FUNCTION       0x0004\n#define PyPARSE_UNICODE_LITERALS        0x0008\n#endif\n\n#define PyPARSE_IGNORE_COOKIE 0x0010\n#define PyPARSE_BARRY_AS_BDFL 0x0020\n#define PyPARSE_ASYNC_ALWAYS  0x8000\n\nextern node * Ta3Parser_ParseString(const char *, grammar *, int,\n                                              perrdetail *);\nextern node * Ta3Parser_ParseFile (FILE *, const char *, grammar *, int,\n                                             const char *, const char *,\n                                             perrdetail *);\n\nextern node * Ta3Parser_ParseStringFlags(const char *, grammar *, int,\n                                              perrdetail *, int);\nextern node * Ta3Parser_ParseFileFlags(\n    FILE *fp,\n    const char *filename,       /* decoded from the filesystem encoding */\n    const char *enc,\n    grammar *g,\n    int start,\n    const char *ps1,\n    const char *ps2,\n    perrdetail *err_ret,\n    int flags);\nextern node * Ta3Parser_ParseFileFlagsEx(\n    FILE *fp,\n    const char *filename,       /* decoded from the filesystem encoding */\n    const char *enc,\n    grammar *g,\n    int start,\n    const char *ps1,\n    const char *ps2,\n    perrdetail *err_ret,\n    int *flags);\nextern node * Ta3Parser_ParseFileObject(\n    FILE *fp,\n    PyObject *filename,\n    const char *enc,\n    grammar *g,\n    int start,\n    const char *ps1,\n    const char *ps2,\n    perrdetail *err_ret,\n    int *flags);\n\nextern node * Ta3Parser_ParseStringFlagsFilename(\n    const char *s,\n    const char *filename,       /* decoded from the filesystem encoding */\n    grammar *g,\n    int start,\n    perrdetail *err_ret,\n    int flags);\nextern node * Ta3Parser_ParseStringFlagsFilenameEx(\n    const char *s,\n    const char *filename,       /* decoded from the filesystem encoding */\n    grammar *g,\n    int start,\n    perrdetail *err_ret,\n    int *flags);\nextern node * Ta3Parser_ParseStringObject(\n    const char *s,\n    PyObject *filename,\n    grammar *g,\n    int start,\n    perrdetail *err_ret,\n    int *flags);\n\n/* Note that the following functions are defined in pythonrun.c,\n   not in parsetok.c */\nextern void PyParser_SetError(perrdetail *);\nextern void PyParser_ClearError(perrdetail *);\n\n#ifdef __cplusplus\n}\n#endif\n#endif /* !Ta3_PARSETOK_H */\n#endif /* !Py_LIMITED_API */\n"
  },
  {
    "path": "ast3/Include/pgenheaders.h",
    "content": "#ifndef DUMMY_Py_PGENHEADERS_H\n#define DUMMY_Py_PGENHEADERS_H\n\n/* pgenheaders.h is included by a bunch of files but nothing in it is\n * used except for the Python.h import, and it was removed in Python\n * 3.8. Since some of those files are generated we provide a dummy\n * pgenheaders.h. */\n#include \"Python.h\"\n\n#endif /* !DUMMY_Py_PGENHEADERS_H */\n"
  },
  {
    "path": "ast3/Include/pyarena.h",
    "content": "/* An arena-like memory interface for the compiler.\n */\n\n#ifndef Ta3_PYARENA_H\n#define Ta3_PYARENA_H\n\n#if PY_MINOR_VERSION >= 10\n#include \"../Include/pycore_pyarena.h\"\n\n#define PyArena_New _PyArena_New\n#define PyArena_Free _PyArena_Free\n#define PyArena_Malloc _PyArena_Malloc\n#define PyArena_AddPyObject _PyArena_AddPyObject\n#endif\n\n#endif /* !Ta3_PYARENA_H */\n"
  },
  {
    "path": "ast3/Include/pycore_pyarena.h",
    "content": "/* An arena-like memory interface for the compiler.\n */\n\n#ifndef Ta3_INTERNAL_PYARENA_H\n#define Ta3_INTERNAL_PYARENA_H\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\ntypedef struct _arena PyArena;\n\n/* _PyArena_New() and _PyArena_Free() create a new arena and free it,\n   respectively.  Once an arena has been created, it can be used\n   to allocate memory via _PyArena_Malloc().  Pointers to PyObject can\n   also be registered with the arena via _PyArena_AddPyObject(), and the\n   arena will ensure that the PyObjects stay alive at least until\n   _PyArena_Free() is called.  When an arena is freed, all the memory it\n   allocated is freed, the arena releases internal references to registered\n   PyObject*, and none of its pointers are valid.\n   XXX (tim) What does \"none of its pointers are valid\" mean?  Does it\n   XXX mean that pointers previously obtained via _PyArena_Malloc() are\n   XXX no longer valid?  (That's clearly true, but not sure that's what\n   XXX the text is trying to say.)\n\n   _PyArena_New() returns an arena pointer.  On error, it\n   returns a negative number and sets an exception.\n   XXX (tim):  Not true.  On error, _PyArena_New() actually returns NULL,\n   XXX and looks like it may or may not set an exception (e.g., if the\n   XXX internal PyList_New(0) returns NULL, _PyArena_New() passes that on\n   XXX and an exception is set; OTOH, if the internal\n   XXX block_new(DEFAULT_BLOCK_SIZE) returns NULL, that's passed on but\n   XXX an exception is not set in that case).\n*/\nPyAPI_FUNC(PyArena*) _PyArena_New(void);\nPyAPI_FUNC(void) _PyArena_Free(PyArena *);\n\n/* Mostly like malloc(), return the address of a block of memory spanning\n * `size` bytes, or return NULL (without setting an exception) if enough\n * new memory can't be obtained.  Unlike malloc(0), _PyArena_Malloc() with\n * size=0 does not guarantee to return a unique pointer (the pointer\n * returned may equal one or more other pointers obtained from\n * _PyArena_Malloc()).\n * Note that pointers obtained via _PyArena_Malloc() must never be passed to\n * the system free() or realloc(), or to any of Python's similar memory-\n * management functions.  _PyArena_Malloc()-obtained pointers remain valid\n * until _PyArena_Free(ar) is called, at which point all pointers obtained\n * from the arena `ar` become invalid simultaneously.\n */\nPyAPI_FUNC(void*) _PyArena_Malloc(PyArena *, size_t size);\n\n/* This routine isn't a proper arena allocation routine.  It takes\n * a PyObject* and records it so that it can be DECREFed when the\n * arena is freed.\n */\nPyAPI_FUNC(int) _PyArena_AddPyObject(PyArena *, PyObject *);\n\n#ifdef __cplusplus\n}\n#endif\n#endif /* !Ta3_INTERNAL_PYARENA_H */\n"
  },
  {
    "path": "ast3/Include/token.h",
    "content": "\n/* Token types */\n#ifndef Py_LIMITED_API\n#ifndef Ta3_TOKEN_H\n#define Ta3_TOKEN_H\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n#undef TILDE   /* Prevent clash of our definition with system macro. Ex AIX, ioctl.h */\n\n#define ENDMARKER       0\n#define NAME            1\n#define NUMBER          2\n#define STRING          3\n#define NEWLINE         4\n#define INDENT          5\n#define DEDENT          6\n#define LPAR            7\n#define RPAR            8\n#define LSQB            9\n#define RSQB            10\n#define COLON           11\n#define COMMA           12\n#define SEMI            13\n#define PLUS            14\n#define MINUS           15\n#define STAR            16\n#define SLASH           17\n#define VBAR            18\n#define AMPER           19\n#define LESS            20\n#define GREATER         21\n#define EQUAL           22\n#define DOT             23\n#define PERCENT         24\n#define LBRACE          25\n#define RBRACE          26\n#define EQEQUAL         27\n#define NOTEQUAL        28\n#define LESSEQUAL       29\n#define GREATEREQUAL    30\n#define TILDE           31\n#define CIRCUMFLEX      32\n#define LEFTSHIFT       33\n#define RIGHTSHIFT      34\n#define DOUBLESTAR      35\n#define PLUSEQUAL       36\n#define MINEQUAL        37\n#define STAREQUAL       38\n#define SLASHEQUAL      39\n#define PERCENTEQUAL    40\n#define AMPEREQUAL      41\n#define VBAREQUAL       42\n#define CIRCUMFLEXEQUAL 43\n#define LEFTSHIFTEQUAL  44\n#define RIGHTSHIFTEQUAL 45\n#define DOUBLESTAREQUAL 46\n#define DOUBLESLASH     47\n#define DOUBLESLASHEQUAL 48\n#define AT              49\n#define ATEQUAL         50\n#define RARROW          51\n#define ELLIPSIS        52\n/* Don't forget to update the table _Ta3Parser_TokenNames in tokenizer.c! */\n#define OP              53\n#define AWAIT           54\n#define ASYNC           55\n#define TYPE_IGNORE\t56\n#define TYPE_COMMENT\t57\n#define ERRORTOKEN      58\n/* These aren't used by the C tokenizer but are needed for tokenize.py */\n#define COMMENT         59\n#define NL              60\n#define ENCODING                61\n#define N_TOKENS        62\n\n/* Special definitions for cooperation with parser */\n\n#define NT_OFFSET               256\n\n#define ISTERMINAL(x)           ((x) < NT_OFFSET)\n#define ISNONTERMINAL(x)        ((x) >= NT_OFFSET)\n#define ISEOF(x)                ((x) == ENDMARKER)\n\n\nextern const char * _Ta3Parser_TokenNames[]; /* Token names */\nextern int Ta3Token_OneChar(int);\nextern int Ta3Token_TwoChars(int, int);\nextern int Ta3Token_ThreeChars(int, int, int);\n\n#ifdef __cplusplus\n}\n#endif\n#endif /* !Ta3_TOKEN_H */\n#endif /* Py_LIMITED_API */\n"
  },
  {
    "path": "ast3/Parser/Python.asdl",
    "content": "-- ASDL's 7 builtin types are:\n-- identifier, int, string, bytes, object, singleton, constant\n--\n-- singleton: None, True or False\n-- constant can be None, whereas None means \"no value\" for object.\n\nmodule Python\n{\n    mod = Module(stmt* body, type_ignore *type_ignores)\n        | Interactive(stmt* body)\n        | Expression(expr body)\n        | FunctionType(expr* argtypes, expr returns)\n\n        -- not really an actual node but useful in Jython's typesystem.\n        | Suite(stmt* body)\n\n    stmt = FunctionDef(identifier name, arguments args,\n                       stmt* body, expr* decorator_list, expr? returns, string? type_comment)\n          | AsyncFunctionDef(identifier name, arguments args,\n                             stmt* body, expr* decorator_list, expr? returns, string? type_comment)\n\n          | ClassDef(identifier name,\n             expr* bases,\n             keyword* keywords,\n             stmt* body,\n             expr* decorator_list)\n          | Return(expr? value)\n\n          | Delete(expr* targets)\n          | Assign(expr* targets, expr value, string? type_comment)\n          | AugAssign(expr target, operator op, expr value)\n          -- 'simple' indicates that we annotate simple name without parens\n          | AnnAssign(expr target, expr annotation, expr? value, int simple)\n\n          -- use 'orelse' because else is a keyword in target languages\n          | For(expr target, expr iter, stmt* body, stmt* orelse, string? type_comment)\n          | AsyncFor(expr target, expr iter, stmt* body, stmt* orelse, string? type_comment)\n          | While(expr test, stmt* body, stmt* orelse)\n          | If(expr test, stmt* body, stmt* orelse)\n          | With(withitem* items, stmt* body, string? type_comment)\n          | AsyncWith(withitem* items, stmt* body, string? type_comment)\n\n          | Raise(expr? exc, expr? cause)\n          | Try(stmt* body, excepthandler* handlers, stmt* orelse, stmt* finalbody)\n          | Assert(expr test, expr? msg)\n\n          | Import(alias* names)\n          | ImportFrom(identifier? module, alias* names, int? level)\n\n          | Global(identifier* names)\n          | Nonlocal(identifier* names)\n          | Expr(expr value)\n          | Pass | Break | Continue\n\n          -- XXX Jython will be different\n          -- col_offset is the byte offset in the utf8 string the parser uses\n          attributes (int lineno, int col_offset)\n\n          -- BoolOp() can use left & right?\n    expr = BoolOp(boolop op, expr* values)\n         | BinOp(expr left, operator op, expr right)\n         | UnaryOp(unaryop op, expr operand)\n         | Lambda(arguments args, expr body)\n         | IfExp(expr test, expr body, expr orelse)\n         | Dict(expr* keys, expr* values)\n         | Set(expr* elts)\n         | ListComp(expr elt, comprehension* generators)\n         | SetComp(expr elt, comprehension* generators)\n         | DictComp(expr key, expr value, comprehension* generators)\n         | GeneratorExp(expr elt, comprehension* generators)\n         -- the grammar constrains where yield expressions can occur\n         | Await(expr value)\n         | Yield(expr? value)\n         | YieldFrom(expr value)\n         -- need sequences for compare to distinguish between\n         -- x < 4 < 3 and (x < 4) < 3\n         | Compare(expr left, cmpop* ops, expr* comparators)\n         | Call(expr func, expr* args, keyword* keywords)\n         | Num(object n) -- a number as a PyObject.\n         | Str(string s, string kind)\n         | FormattedValue(expr value, int? conversion, expr? format_spec)\n         | JoinedStr(expr* values)\n         | Bytes(bytes s, string kind)\n         | NameConstant(singleton value)\n         | Ellipsis\n         | Constant(constant value)\n\n         -- the following expression can appear in assignment context\n         | Attribute(expr value, identifier attr, expr_context ctx)\n         | Subscript(expr value, slice slice, expr_context ctx)\n         | Starred(expr value, expr_context ctx)\n         | Name(identifier id, expr_context ctx)\n         | List(expr* elts, expr_context ctx)\n         | Tuple(expr* elts, expr_context ctx)\n\n          -- col_offset is the byte offset in the utf8 string the parser uses\n          attributes (int lineno, int col_offset)\n\n    expr_context = Load | Store | Del | AugLoad | AugStore | Param\n\n    slice = Slice(expr? lower, expr? upper, expr? step)\n          | ExtSlice(slice* dims)\n          | Index(expr value)\n\n    boolop = And | Or\n\n    operator = Add | Sub | Mult | MatMult | Div | Mod | Pow | LShift\n                 | RShift | BitOr | BitXor | BitAnd | FloorDiv\n\n    unaryop = Invert | Not | UAdd | USub\n\n    cmpop = Eq | NotEq | Lt | LtE | Gt | GtE | Is | IsNot | In | NotIn\n\n    comprehension = (expr target, expr iter, expr* ifs, int is_async)\n\n    excepthandler = ExceptHandler(expr? type, identifier? name, stmt* body)\n                    attributes (int lineno, int col_offset)\n\n    arguments = (arg* args, arg? vararg, arg* kwonlyargs, expr* kw_defaults,\n                 arg? kwarg, expr* defaults)\n\n    arg = (identifier arg, expr? annotation, string? type_comment)\n           attributes (int lineno, int col_offset)\n\n    -- keyword arguments supplied to call (NULL identifier for **kwargs)\n    keyword = (identifier? arg, expr value)\n\n    -- import name with optional 'as' alias.\n    alias = (identifier name, identifier? asname)\n\n    withitem = (expr context_expr, expr? optional_vars)\n\n    type_ignore = TypeIgnore(int lineno, string tag)\n}\n"
  },
  {
    "path": "ast3/Parser/acceler.c",
    "content": "\n/* Parser accelerator module */\n\n/* The parser as originally conceived had disappointing performance.\n   This module does some precomputation that speeds up the selection\n   of a DFA based upon a token, turning a search through an array\n   into a simple indexing operation.  The parser now cannot work\n   without the accelerators installed.  Note that the accelerators\n   are installed dynamically when the parser is initialized, they\n   are not part of the static data structure written on graminit.[ch]\n   by the parser generator. */\n\n#include \"../Include/pgenheaders.h\"\n#include \"../Include/grammar.h\"\n#include \"../Include/node.h\"\n#include \"../Include/token.h\"\n#include \"parser.h\"\n\n/* Forward references */\nstatic void fixdfa(grammar *, dfa *);\nstatic void fixstate(grammar *, state *);\n\nvoid\nTa3Grammar_AddAccelerators(grammar *g)\n{\n    dfa *d;\n    int i;\n    d = g->g_dfa;\n    for (i = g->g_ndfas; --i >= 0; d++)\n        fixdfa(g, d);\n    g->g_accel = 1;\n}\n\nvoid\nTa3Grammar_RemoveAccelerators(grammar *g)\n{\n    dfa *d;\n    int i;\n    g->g_accel = 0;\n    d = g->g_dfa;\n    for (i = g->g_ndfas; --i >= 0; d++) {\n        state *s;\n        int j;\n        s = d->d_state;\n        for (j = 0; j < d->d_nstates; j++, s++) {\n            if (s->s_accel)\n                PyObject_FREE(s->s_accel);\n            s->s_accel = NULL;\n        }\n    }\n}\n\nstatic void\nfixdfa(grammar *g, dfa *d)\n{\n    state *s;\n    int j;\n    s = d->d_state;\n    for (j = 0; j < d->d_nstates; j++, s++)\n        fixstate(g, s);\n}\n\nstatic void\nfixstate(grammar *g, state *s)\n{\n    arc *a;\n    int k;\n    int *accel;\n    int nl = g->g_ll.ll_nlabels;\n    s->s_accept = 0;\n    accel = (int *) PyObject_MALLOC(nl * sizeof(int));\n    if (accel == NULL) {\n        fprintf(stderr, \"no mem to build parser accelerators\\n\");\n        exit(1);\n    }\n    for (k = 0; k < nl; k++)\n        accel[k] = -1;\n    a = s->s_arc;\n    for (k = s->s_narcs; --k >= 0; a++) {\n        int lbl = a->a_lbl;\n        label *l = &g->g_ll.ll_label[lbl];\n        int type = l->lb_type;\n        if (a->a_arrow >= (1 << 7)) {\n            printf(\"XXX too many states!\\n\");\n            continue;\n        }\n        if (ISNONTERMINAL(type)) {\n            dfa *d1 = Ta3Grammar_FindDFA(g, type);\n            int ibit;\n            if (type - NT_OFFSET >= (1 << 7)) {\n                printf(\"XXX too high nonterminal number!\\n\");\n                continue;\n            }\n            for (ibit = 0; ibit < g->g_ll.ll_nlabels; ibit++) {\n                if (testbit(d1->d_first, ibit)) {\n                    if (accel[ibit] != -1)\n                        printf(\"XXX ambiguity!\\n\");\n                    accel[ibit] = a->a_arrow | (1 << 7) |\n                        ((type - NT_OFFSET) << 8);\n                }\n            }\n        }\n        else if (lbl == EMPTY)\n            s->s_accept = 1;\n        else if (lbl >= 0 && lbl < nl)\n            accel[lbl] = a->a_arrow;\n    }\n    while (nl > 0 && accel[nl-1] == -1)\n        nl--;\n    for (k = 0; k < nl && accel[k] == -1;)\n        k++;\n    if (k < nl) {\n        int i;\n        s->s_accel = (int *) PyObject_MALLOC((nl-k) * sizeof(int));\n        if (s->s_accel == NULL) {\n            fprintf(stderr, \"no mem to add parser accelerators\\n\");\n            exit(1);\n        }\n        s->s_lower = k;\n        s->s_upper = nl;\n        for (i = 0; k < nl; i++, k++)\n            s->s_accel[i] = accel[k];\n    }\n    PyObject_FREE(accel);\n}\n"
  },
  {
    "path": "ast3/Parser/asdl.py",
    "content": "#-------------------------------------------------------------------------------\n# Parser for ASDL [1] definition files. Reads in an ASDL description and parses\n# it into an AST that describes it.\n#\n# The EBNF we're parsing here: Figure 1 of the paper [1]. Extended to support\n# modules and attributes after a product. Words starting with Capital letters\n# are terminals. Literal tokens are in \"double quotes\". Others are\n# non-terminals. Id is either TokenId or ConstructorId.\n#\n# module        ::= \"module\" Id \"{\" [definitions] \"}\"\n# definitions   ::= { TypeId \"=\" type }\n# type          ::= product | sum\n# product       ::= fields [\"attributes\" fields]\n# fields        ::= \"(\" { field, \",\" } field \")\"\n# field         ::= TypeId [\"?\" | \"*\"] [Id]\n# sum           ::= constructor { \"|\" constructor } [\"attributes\" fields]\n# constructor   ::= ConstructorId [fields]\n#\n# [1] \"The Zephyr Abstract Syntax Description Language\" by Wang, et. al. See\n#     http://asdl.sourceforge.net/\n#-------------------------------------------------------------------------------\nfrom collections import namedtuple\nimport re\n\n__all__ = [\n    'builtin_types', 'parse', 'AST', 'Module', 'Type', 'Constructor',\n    'Field', 'Sum', 'Product', 'VisitorBase', 'Check', 'check']\n\n# The following classes define nodes into which the ASDL description is parsed.\n# Note: this is a \"meta-AST\". ASDL files (such as Python.asdl) describe the AST\n# structure used by a programming language. But ASDL files themselves need to be\n# parsed. This module parses ASDL files and uses a simple AST to represent them.\n# See the EBNF at the top of the file to understand the logical connection\n# between the various node types.\n\nbuiltin_types = {'identifier', 'string', 'bytes', 'int', 'object', 'singleton',\n                 'constant'}\n\nclass AST:\n    def __repr__(self):\n        raise NotImplementedError\n\nclass Module(AST):\n    def __init__(self, name, dfns):\n        self.name = name\n        self.dfns = dfns\n        self.types = {type.name: type.value for type in dfns}\n\n    def __repr__(self):\n        return 'Module({0.name}, {0.dfns})'.format(self)\n\nclass Type(AST):\n    def __init__(self, name, value):\n        self.name = name\n        self.value = value\n\n    def __repr__(self):\n        return 'Type({0.name}, {0.value})'.format(self)\n\nclass Constructor(AST):\n    def __init__(self, name, fields=None):\n        self.name = name\n        self.fields = fields or []\n\n    def __repr__(self):\n        return 'Constructor({0.name}, {0.fields})'.format(self)\n\nclass Field(AST):\n    def __init__(self, type, name=None, seq=False, opt=False):\n        self.type = type\n        self.name = name\n        self.seq = seq\n        self.opt = opt\n\n    def __repr__(self):\n        if self.seq:\n            extra = \", seq=True\"\n        elif self.opt:\n            extra = \", opt=True\"\n        else:\n            extra = \"\"\n        if self.name is None:\n            return 'Field({0.type}{1})'.format(self, extra)\n        else:\n            return 'Field({0.type}, {0.name}{1})'.format(self, extra)\n\nclass Sum(AST):\n    def __init__(self, types, attributes=None):\n        self.types = types\n        self.attributes = attributes or []\n\n    def __repr__(self):\n        if self.attributes:\n            return 'Sum({0.types}, {0.attributes})'.format(self)\n        else:\n            return 'Sum({0.types})'.format(self)\n\nclass Product(AST):\n    def __init__(self, fields, attributes=None):\n        self.fields = fields\n        self.attributes = attributes or []\n\n    def __repr__(self):\n        if self.attributes:\n            return 'Product({0.fields}, {0.attributes})'.format(self)\n        else:\n            return 'Product({0.fields})'.format(self)\n\n# A generic visitor for the meta-AST that describes ASDL. This can be used by\n# emitters. Note that this visitor does not provide a generic visit method, so a\n# subclass needs to define visit methods from visitModule to as deep as the\n# interesting node.\n# We also define a Check visitor that makes sure the parsed ASDL is well-formed.\n\nclass VisitorBase(object):\n    \"\"\"Generic tree visitor for ASTs.\"\"\"\n    def __init__(self):\n        self.cache = {}\n\n    def visit(self, obj, *args):\n        klass = obj.__class__\n        meth = self.cache.get(klass)\n        if meth is None:\n            methname = \"visit\" + klass.__name__\n            meth = getattr(self, methname, None)\n            self.cache[klass] = meth\n        if meth:\n            try:\n                meth(obj, *args)\n            except Exception as e:\n                print(\"Error visiting %r: %s\" % (obj, e))\n                raise\n\nclass Check(VisitorBase):\n    \"\"\"A visitor that checks a parsed ASDL tree for correctness.\n\n    Errors are printed and accumulated.\n    \"\"\"\n    def __init__(self):\n        super(Check, self).__init__()\n        self.cons = {}\n        self.errors = 0\n        self.types = {}\n\n    def visitModule(self, mod):\n        for dfn in mod.dfns:\n            self.visit(dfn)\n\n    def visitType(self, type):\n        self.visit(type.value, str(type.name))\n\n    def visitSum(self, sum, name):\n        for t in sum.types:\n            self.visit(t, name)\n\n    def visitConstructor(self, cons, name):\n        key = str(cons.name)\n        conflict = self.cons.get(key)\n        if conflict is None:\n            self.cons[key] = name\n        else:\n            print('Redefinition of constructor {}'.format(key))\n            print('Defined in {} and {}'.format(conflict, name))\n            self.errors += 1\n        for f in cons.fields:\n            self.visit(f, key)\n\n    def visitField(self, field, name):\n        key = str(field.type)\n        l = self.types.setdefault(key, [])\n        l.append(name)\n\n    def visitProduct(self, prod, name):\n        for f in prod.fields:\n            self.visit(f, name)\n\ndef check(mod):\n    \"\"\"Check the parsed ASDL tree for correctness.\n\n    Return True if success. For failure, the errors are printed out and False\n    is returned.\n    \"\"\"\n    v = Check()\n    v.visit(mod)\n\n    for t in v.types:\n        if t not in mod.types and not t in builtin_types:\n            v.errors += 1\n            uses = \", \".join(v.types[t])\n            print('Undefined type {}, used in {}'.format(t, uses))\n    return not v.errors\n\n# The ASDL parser itself comes next. The only interesting external interface\n# here is the top-level parse function.\n\ndef parse(filename):\n    \"\"\"Parse ASDL from the given file and return a Module node describing it.\"\"\"\n    with open(filename) as f:\n        parser = ASDLParser()\n        return parser.parse(f.read())\n\n# Types for describing tokens in an ASDL specification.\nclass TokenKind:\n    \"\"\"TokenKind is provides a scope for enumerated token kinds.\"\"\"\n    (ConstructorId, TypeId, Equals, Comma, Question, Pipe, Asterisk,\n     LParen, RParen, LBrace, RBrace) = range(11)\n\n    operator_table = {\n        '=': Equals, ',': Comma,    '?': Question, '|': Pipe,    '(': LParen,\n        ')': RParen, '*': Asterisk, '{': LBrace,   '}': RBrace}\n\nToken = namedtuple('Token', 'kind value lineno')\n\nclass ASDLSyntaxError(Exception):\n    def __init__(self, msg, lineno=None):\n        self.msg = msg\n        self.lineno = lineno or '<unknown>'\n\n    def __str__(self):\n        return 'Syntax error on line {0.lineno}: {0.msg}'.format(self)\n\ndef tokenize_asdl(buf):\n    \"\"\"Tokenize the given buffer. Yield Token objects.\"\"\"\n    for lineno, line in enumerate(buf.splitlines(), 1):\n        for m in re.finditer(r'\\s*(\\w+|--.*|.)', line.strip()):\n            c = m.group(1)\n            if c[0].isalpha():\n                # Some kind of identifier\n                if c[0].isupper():\n                    yield Token(TokenKind.ConstructorId, c, lineno)\n                else:\n                    yield Token(TokenKind.TypeId, c, lineno)\n            elif c[:2] == '--':\n                # Comment\n                break\n            else:\n                # Operators\n                try:\n                    op_kind = TokenKind.operator_table[c]\n                except KeyError:\n                    raise ASDLSyntaxError('Invalid operator %s' % c, lineno)\n                yield Token(op_kind, c, lineno)\n\nclass ASDLParser:\n    \"\"\"Parser for ASDL files.\n\n    Create, then call the parse method on a buffer containing ASDL.\n    This is a simple recursive descent parser that uses tokenize_asdl for the\n    lexing.\n    \"\"\"\n    def __init__(self):\n        self._tokenizer = None\n        self.cur_token = None\n\n    def parse(self, buf):\n        \"\"\"Parse the ASDL in the buffer and return an AST with a Module root.\n        \"\"\"\n        self._tokenizer = tokenize_asdl(buf)\n        self._advance()\n        return self._parse_module()\n\n    def _parse_module(self):\n        if self._at_keyword('module'):\n            self._advance()\n        else:\n            raise ASDLSyntaxError(\n                'Expected \"module\" (found {})'.format(self.cur_token.value),\n                self.cur_token.lineno)\n        name = self._match(self._id_kinds)\n        self._match(TokenKind.LBrace)\n        defs = self._parse_definitions()\n        self._match(TokenKind.RBrace)\n        return Module(name, defs)\n\n    def _parse_definitions(self):\n        defs = []\n        while self.cur_token.kind == TokenKind.TypeId:\n            typename = self._advance()\n            self._match(TokenKind.Equals)\n            type = self._parse_type()\n            defs.append(Type(typename, type))\n        return defs\n\n    def _parse_type(self):\n        if self.cur_token.kind == TokenKind.LParen:\n            # If we see a (, it's a product\n            return self._parse_product()\n        else:\n            # Otherwise it's a sum. Look for ConstructorId\n            sumlist = [Constructor(self._match(TokenKind.ConstructorId),\n                                   self._parse_optional_fields())]\n            while self.cur_token.kind  == TokenKind.Pipe:\n                # More constructors\n                self._advance()\n                sumlist.append(Constructor(\n                                self._match(TokenKind.ConstructorId),\n                                self._parse_optional_fields()))\n            return Sum(sumlist, self._parse_optional_attributes())\n\n    def _parse_product(self):\n        return Product(self._parse_fields(), self._parse_optional_attributes())\n\n    def _parse_fields(self):\n        fields = []\n        self._match(TokenKind.LParen)\n        while self.cur_token.kind == TokenKind.TypeId:\n            typename = self._advance()\n            is_seq, is_opt = self._parse_optional_field_quantifier()\n            id = (self._advance() if self.cur_token.kind in self._id_kinds\n                                  else None)\n            fields.append(Field(typename, id, seq=is_seq, opt=is_opt))\n            if self.cur_token.kind == TokenKind.RParen:\n                break\n            elif self.cur_token.kind == TokenKind.Comma:\n                self._advance()\n        self._match(TokenKind.RParen)\n        return fields\n\n    def _parse_optional_fields(self):\n        if self.cur_token.kind == TokenKind.LParen:\n            return self._parse_fields()\n        else:\n            return None\n\n    def _parse_optional_attributes(self):\n        if self._at_keyword('attributes'):\n            self._advance()\n            return self._parse_fields()\n        else:\n            return None\n\n    def _parse_optional_field_quantifier(self):\n        is_seq, is_opt = False, False\n        if self.cur_token.kind == TokenKind.Asterisk:\n            is_seq = True\n            self._advance()\n        elif self.cur_token.kind == TokenKind.Question:\n            is_opt = True\n            self._advance()\n        return is_seq, is_opt\n\n    def _advance(self):\n        \"\"\" Return the value of the current token and read the next one into\n            self.cur_token.\n        \"\"\"\n        cur_val = None if self.cur_token is None else self.cur_token.value\n        try:\n            self.cur_token = next(self._tokenizer)\n        except StopIteration:\n            self.cur_token = None\n        return cur_val\n\n    _id_kinds = (TokenKind.ConstructorId, TokenKind.TypeId)\n\n    def _match(self, kind):\n        \"\"\"The 'match' primitive of RD parsers.\n\n        * Verifies that the current token is of the given kind (kind can\n          be a tuple, in which the kind must match one of its members).\n        * Returns the value of the current token\n        * Reads in the next token\n        \"\"\"\n        if (isinstance(kind, tuple) and self.cur_token.kind in kind or\n            self.cur_token.kind == kind\n            ):\n            value = self.cur_token.value\n            self._advance()\n            return value\n        else:\n            raise ASDLSyntaxError(\n                'Unmatched {} (found {})'.format(kind, self.cur_token.kind),\n                self.cur_token.lineno)\n\n    def _at_keyword(self, keyword):\n        return (self.cur_token.kind == TokenKind.TypeId and\n                self.cur_token.value == keyword)\n"
  },
  {
    "path": "ast3/Parser/asdl_c.py",
    "content": "#! /usr/bin/env python\n\"\"\"Generate C code from an ASDL description.\"\"\"\n\nimport os, sys\n\nimport asdl\n\nTABSIZE = 4\nMAX_COL = 80\n\ndef get_c_type(name):\n    \"\"\"Return a string for the C name of the type.\n\n    This function special cases the default types provided by asdl.\n    \"\"\"\n    if name in asdl.builtin_types:\n        return name\n    else:\n        return \"%s_ty\" % name\n\ndef reflow_lines(s, depth):\n    \"\"\"Reflow the line s indented depth tabs.\n\n    Return a sequence of lines where no line extends beyond MAX_COL\n    when properly indented.  The first line is properly indented based\n    exclusively on depth * TABSIZE.  All following lines -- these are\n    the reflowed lines generated by this function -- start at the same\n    column as the first character beyond the opening { in the first\n    line.\n    \"\"\"\n    size = MAX_COL - depth * TABSIZE\n    if len(s) < size:\n        return [s]\n\n    lines = []\n    cur = s\n    padding = \"\"\n    while len(cur) > size:\n        i = cur.rfind(' ', 0, size)\n        # XXX this should be fixed for real\n        if i == -1 and 'GeneratorExp' in cur:\n            i = size + 3\n        assert i != -1, \"Impossible line %d to reflow: %r\" % (size, s)\n        lines.append(padding + cur[:i])\n        if len(lines) == 1:\n            # find new size based on brace\n            j = cur.find('{', 0, i)\n            if j >= 0:\n                j += 2 # account for the brace and the space after it\n                size -= j\n                padding = \" \" * j\n            else:\n                j = cur.find('(', 0, i)\n                if j >= 0:\n                    j += 1 # account for the paren (no space after it)\n                    size -= j\n                    padding = \" \" * j\n        cur = cur[i+1:]\n    else:\n        lines.append(padding + cur)\n    return lines\n\ndef is_simple(sum):\n    \"\"\"Return True if a sum is a simple.\n\n    A sum is simple if its types have no fields, e.g.\n    unaryop = Invert | Not | UAdd | USub\n    \"\"\"\n    for t in sum.types:\n        if t.fields:\n            return False\n    return True\n\n\nclass EmitVisitor(asdl.VisitorBase):\n    \"\"\"Visit that emits lines\"\"\"\n\n    def __init__(self, file):\n        self.file = file\n        self.identifiers = set()\n        super(EmitVisitor, self).__init__()\n\n    def emit_identifier(self, name):\n        name = str(name)\n        if name in self.identifiers:\n            return\n        self.emit(\"_Py_IDENTIFIER(%s);\" % name, 0)\n        self.identifiers.add(name)\n\n    def emit(self, s, depth, reflow=True):\n        # XXX reflow long lines?\n        if reflow:\n            lines = reflow_lines(s, depth)\n        else:\n            lines = [s]\n        for line in lines:\n            if line:\n                line = (\" \" * TABSIZE * depth) + line\n            self.file.write(line + \"\\n\")\n\n\nclass TypeDefVisitor(EmitVisitor):\n    def visitModule(self, mod):\n        for dfn in mod.dfns:\n            self.visit(dfn)\n\n    def visitType(self, type, depth=0):\n        self.visit(type.value, type.name, depth)\n\n    def visitSum(self, sum, name, depth):\n        if is_simple(sum):\n            self.simple_sum(sum, name, depth)\n        else:\n            self.sum_with_constructors(sum, name, depth)\n\n    def simple_sum(self, sum, name, depth):\n        enum = []\n        for i in range(len(sum.types)):\n            type = sum.types[i]\n            enum.append(\"%s=%d\" % (type.name, i + 1))\n        enums = \", \".join(enum)\n        ctype = get_c_type(name)\n        s = \"typedef enum _%s { %s } %s;\" % (name, enums, ctype)\n        self.emit(s, depth)\n        self.emit(\"\", depth)\n\n    def sum_with_constructors(self, sum, name, depth):\n        ctype = get_c_type(name)\n        s = \"typedef struct _%(name)s *%(ctype)s;\" % locals()\n        self.emit(s, depth)\n        self.emit(\"\", depth)\n\n    def visitProduct(self, product, name, depth):\n        ctype = get_c_type(name)\n        s = \"typedef struct _%(name)s *%(ctype)s;\" % locals()\n        self.emit(s, depth)\n        self.emit(\"\", depth)\n\n\nclass StructVisitor(EmitVisitor):\n    \"\"\"Visitor to generate typedefs for AST.\"\"\"\n\n    def visitModule(self, mod):\n        for dfn in mod.dfns:\n            self.visit(dfn)\n\n    def visitType(self, type, depth=0):\n        self.visit(type.value, type.name, depth)\n\n    def visitSum(self, sum, name, depth):\n        if not is_simple(sum):\n            self.sum_with_constructors(sum, name, depth)\n\n    def sum_with_constructors(self, sum, name, depth):\n        def emit(s, depth=depth):\n            self.emit(s % sys._getframe(1).f_locals, depth)\n        enum = []\n        for i in range(len(sum.types)):\n            type = sum.types[i]\n            enum.append(\"%s_kind=%d\" % (type.name, i + 1))\n\n        emit(\"enum _%(name)s_kind {\" + \", \".join(enum) + \"};\")\n\n        emit(\"struct _%(name)s {\")\n        emit(\"enum _%(name)s_kind kind;\", depth + 1)\n        emit(\"union {\", depth + 1)\n        for t in sum.types:\n            self.visit(t, depth + 2)\n        emit(\"} v;\", depth + 1)\n        for field in sum.attributes:\n            # rudimentary attribute handling\n            type = str(field.type)\n            assert type in asdl.builtin_types, type\n            emit(\"%s %s;\" % (type, field.name), depth + 1);\n        emit(\"};\")\n        emit(\"\")\n\n    def visitConstructor(self, cons, depth):\n        if cons.fields:\n            self.emit(\"struct {\", depth)\n            for f in cons.fields:\n                self.visit(f, depth + 1)\n            self.emit(\"} %s;\" % cons.name, depth)\n            self.emit(\"\", depth)\n\n    def visitField(self, field, depth):\n        # XXX need to lookup field.type, because it might be something\n        # like a builtin...\n        ctype = get_c_type(field.type)\n        name = field.name\n        if field.seq:\n            if field.type == 'cmpop':\n                self.emit(\"asdl_int_seq *%(name)s;\" % locals(), depth)\n            else:\n                self.emit(\"asdl_seq *%(name)s;\" % locals(), depth)\n        else:\n            self.emit(\"%(ctype)s %(name)s;\" % locals(), depth)\n\n    def visitProduct(self, product, name, depth):\n        self.emit(\"struct _%(name)s {\" % locals(), depth)\n        for f in product.fields:\n            self.visit(f, depth + 1)\n        for field in product.attributes:\n            # rudimentary attribute handling\n            type = str(field.type)\n            assert type in asdl.builtin_types, type\n            self.emit(\"%s %s;\" % (type, field.name), depth + 1);\n        self.emit(\"};\", depth)\n        self.emit(\"\", depth)\n\n\nclass PrototypeVisitor(EmitVisitor):\n    \"\"\"Generate function prototypes for the .h file\"\"\"\n\n    def visitModule(self, mod):\n        for dfn in mod.dfns:\n            self.visit(dfn)\n\n    def visitType(self, type):\n        self.visit(type.value, type.name)\n\n    def visitSum(self, sum, name):\n        if is_simple(sum):\n            pass # XXX\n        else:\n            for t in sum.types:\n                self.visit(t, name, sum.attributes)\n\n    def get_args(self, fields):\n        \"\"\"Return list of C argument into, one for each field.\n\n        Argument info is 3-tuple of a C type, variable name, and flag\n        that is true if type can be NULL.\n        \"\"\"\n        args = []\n        unnamed = {}\n        for f in fields:\n            if f.name is None:\n                name = f.type\n                c = unnamed[name] = unnamed.get(name, 0) + 1\n                if c > 1:\n                    name = \"name%d\" % (c - 1)\n            else:\n                name = f.name\n            # XXX should extend get_c_type() to handle this\n            if f.seq:\n                if f.type == 'cmpop':\n                    ctype = \"asdl_int_seq *\"\n                else:\n                    ctype = \"asdl_seq *\"\n            else:\n                ctype = get_c_type(f.type)\n            args.append((ctype, name, f.opt or f.seq))\n        return args\n\n    def visitConstructor(self, cons, type, attrs):\n        args = self.get_args(cons.fields)\n        attrs = self.get_args(attrs)\n        ctype = get_c_type(type)\n        self.emit_function(cons.name, ctype, args, attrs)\n\n    def emit_function(self, name, ctype, args, attrs, union=True):\n        args = args + attrs\n        if args:\n            argstr = \", \".join([\"%s %s\" % (atype, aname)\n                                for atype, aname, opt in args])\n            argstr += \", PyArena *arena\"\n        else:\n            argstr = \"PyArena *arena\"\n        margs = \"a0\"\n        for i in range(1, len(args)+1):\n            margs += \", a%d\" % i\n        self.emit(\"#define %s(%s) _Ta3_%s(%s)\" % (name, margs, name, margs), 0,\n                reflow=False)\n        self.emit(\"%s _Ta3_%s(%s);\" % (ctype, name, argstr), False)\n\n    def visitProduct(self, prod, name):\n        self.emit_function(name, get_c_type(name),\n                           self.get_args(prod.fields),\n                           self.get_args(prod.attributes),\n                           union=False)\n\n\nclass FunctionVisitor(PrototypeVisitor):\n    \"\"\"Visitor to generate constructor functions for AST.\"\"\"\n\n    def emit_function(self, name, ctype, args, attrs, union=True):\n        def emit(s, depth=0, reflow=True):\n            self.emit(s, depth, reflow)\n        argstr = \", \".join([\"%s %s\" % (atype, aname)\n                            for atype, aname, opt in args + attrs])\n        if argstr:\n            argstr += \", PyArena *arena\"\n        else:\n            argstr = \"PyArena *arena\"\n        self.emit(\"%s\" % ctype, 0)\n        emit(\"%s(%s)\" % (name, argstr))\n        emit(\"{\")\n        emit(\"%s p;\" % ctype, 1)\n        for argtype, argname, opt in args:\n            if not opt and argtype != \"int\":\n                emit(\"if (!%s) {\" % argname, 1)\n                emit(\"PyErr_SetString(PyExc_ValueError,\", 2)\n                msg = \"field %s is required for %s\" % (argname, name)\n                emit('                \"%s\");' % msg,\n                     2, reflow=False)\n                emit('return NULL;', 2)\n                emit('}', 1)\n\n        emit(\"p = (%s)PyArena_Malloc(arena, sizeof(*p));\" % ctype, 1);\n        emit(\"if (!p)\", 1)\n        emit(\"return NULL;\", 2)\n        if union:\n            self.emit_body_union(name, args, attrs)\n        else:\n            self.emit_body_struct(name, args, attrs)\n        emit(\"return p;\", 1)\n        emit(\"}\")\n        emit(\"\")\n\n    def emit_body_union(self, name, args, attrs):\n        def emit(s, depth=0, reflow=True):\n            self.emit(s, depth, reflow)\n        emit(\"p->kind = %s_kind;\" % name, 1)\n        for argtype, argname, opt in args:\n            emit(\"p->v.%s.%s = %s;\" % (name, argname, argname), 1)\n        for argtype, argname, opt in attrs:\n            emit(\"p->%s = %s;\" % (argname, argname), 1)\n\n    def emit_body_struct(self, name, args, attrs):\n        def emit(s, depth=0, reflow=True):\n            self.emit(s, depth, reflow)\n        for argtype, argname, opt in args:\n            emit(\"p->%s = %s;\" % (argname, argname), 1)\n        for argtype, argname, opt in attrs:\n            emit(\"p->%s = %s;\" % (argname, argname), 1)\n\n\nclass PickleVisitor(EmitVisitor):\n\n    def visitModule(self, mod):\n        for dfn in mod.dfns:\n            self.visit(dfn)\n\n    def visitType(self, type):\n        self.visit(type.value, type.name)\n\n    def visitSum(self, sum, name):\n        pass\n\n    def visitProduct(self, sum, name):\n        pass\n\n    def visitConstructor(self, cons, name):\n        pass\n\n    def visitField(self, sum):\n        pass\n\n\nclass Obj2ModPrototypeVisitor(PickleVisitor):\n    def visitProduct(self, prod, name):\n        code = \"static int obj2ast_%s(PyObject* obj, %s* out, PyArena* arena);\"\n        self.emit(code % (name, get_c_type(name)), 0)\n\n    visitSum = visitProduct\n\n\nclass Obj2ModVisitor(PickleVisitor):\n    def funcHeader(self, name):\n        ctype = get_c_type(name)\n        self.emit(\"int\", 0)\n        self.emit(\"obj2ast_%s(PyObject* obj, %s* out, PyArena* arena)\" % (name, ctype), 0)\n        self.emit(\"{\", 0)\n        self.emit(\"int isinstance;\", 1)\n        self.emit(\"\", 0)\n\n    def sumTrailer(self, name, add_label=False):\n        self.emit(\"\", 0)\n        # there's really nothing more we can do if this fails ...\n        error = \"expected some sort of %s, but got %%R\" % name\n        format = \"PyErr_Format(PyExc_TypeError, \\\"%s\\\", obj);\"\n        self.emit(format % error, 1, reflow=False)\n        if add_label:\n            self.emit(\"failed:\", 1)\n            self.emit(\"Py_XDECREF(tmp);\", 1)\n        self.emit(\"return 1;\", 1)\n        self.emit(\"}\", 0)\n        self.emit(\"\", 0)\n\n    def simpleSum(self, sum, name):\n        self.funcHeader(name)\n        for t in sum.types:\n            line = (\"isinstance = PyObject_IsInstance(obj, \"\n                    \"(PyObject *)%s_type);\")\n            self.emit(line % (t.name,), 1)\n            self.emit(\"if (isinstance == -1) {\", 1)\n            self.emit(\"return 1;\", 2)\n            self.emit(\"}\", 1)\n            self.emit(\"if (isinstance) {\", 1)\n            self.emit(\"*out = %s;\" % t.name, 2)\n            self.emit(\"return 0;\", 2)\n            self.emit(\"}\", 1)\n        self.sumTrailer(name)\n\n    def buildArgs(self, fields):\n        return \", \".join(fields + [\"arena\"])\n\n    def complexSum(self, sum, name):\n        self.funcHeader(name)\n        self.emit(\"PyObject *tmp = NULL;\", 1)\n        for a in sum.attributes:\n            self.visitAttributeDeclaration(a, name, sum=sum)\n        self.emit(\"\", 0)\n        # XXX: should we only do this for 'expr'?\n        self.emit(\"if (obj == Py_None) {\", 1)\n        self.emit(\"*out = NULL;\", 2)\n        self.emit(\"return 0;\", 2)\n        self.emit(\"}\", 1)\n        for a in sum.attributes:\n            self.visitField(a, name, sum=sum, depth=1)\n        for t in sum.types:\n            line = \"isinstance = PyObject_IsInstance(obj, (PyObject*)%s_type);\"\n            self.emit(line % (t.name,), 1)\n            self.emit(\"if (isinstance == -1) {\", 1)\n            self.emit(\"return 1;\", 2)\n            self.emit(\"}\", 1)\n            self.emit(\"if (isinstance) {\", 1)\n            for f in t.fields:\n                self.visitFieldDeclaration(f, t.name, sum=sum, depth=2)\n            self.emit(\"\", 0)\n            for f in t.fields:\n                self.visitField(f, t.name, sum=sum, depth=2)\n            args = [f.name for f in t.fields] + [a.name for a in sum.attributes]\n            self.emit(\"*out = %s(%s);\" % (t.name, self.buildArgs(args)), 2)\n            self.emit(\"if (*out == NULL) goto failed;\", 2)\n            self.emit(\"return 0;\", 2)\n            self.emit(\"}\", 1)\n        self.sumTrailer(name, True)\n\n    def visitAttributeDeclaration(self, a, name, sum=sum):\n        ctype = get_c_type(a.type)\n        self.emit(\"%s %s;\" % (ctype, a.name), 1)\n\n    def visitSum(self, sum, name):\n        if is_simple(sum):\n            self.simpleSum(sum, name)\n        else:\n            self.complexSum(sum, name)\n\n    def visitProduct(self, prod, name):\n        ctype = get_c_type(name)\n        self.emit(\"int\", 0)\n        self.emit(\"obj2ast_%s(PyObject* obj, %s* out, PyArena* arena)\" % (name, ctype), 0)\n        self.emit(\"{\", 0)\n        self.emit(\"PyObject* tmp = NULL;\", 1)\n        for f in prod.fields:\n            self.visitFieldDeclaration(f, name, prod=prod, depth=1)\n        for a in prod.attributes:\n            self.visitFieldDeclaration(a, name, prod=prod, depth=1)\n        self.emit(\"\", 0)\n        for f in prod.fields:\n            self.visitField(f, name, prod=prod, depth=1)\n        for a in prod.attributes:\n            self.visitField(a, name, prod=prod, depth=1)\n        args = [f.name for f in prod.fields]\n        args.extend([a.name for a in prod.attributes])\n        self.emit(\"*out = %s(%s);\" % (name, self.buildArgs(args)), 1)\n        self.emit(\"return 0;\", 1)\n        self.emit(\"failed:\", 0)\n        self.emit(\"Py_XDECREF(tmp);\", 1)\n        self.emit(\"return 1;\", 1)\n        self.emit(\"}\", 0)\n        self.emit(\"\", 0)\n\n    def visitFieldDeclaration(self, field, name, sum=None, prod=None, depth=0):\n        ctype = get_c_type(field.type)\n        if field.seq:\n            if self.isSimpleType(field):\n                self.emit(\"asdl_int_seq* %s;\" % field.name, depth)\n            else:\n                self.emit(\"asdl_seq* %s;\" % field.name, depth)\n        else:\n            ctype = get_c_type(field.type)\n            self.emit(\"%s %s;\" % (ctype, field.name), depth)\n\n    def isSimpleSum(self, field):\n        # XXX can the members of this list be determined automatically?\n        return field.type in ('expr_context', 'boolop', 'operator',\n                              'unaryop', 'cmpop')\n\n    def isNumeric(self, field):\n        return get_c_type(field.type) in (\"int\", \"bool\")\n\n    def isSimpleType(self, field):\n        return self.isSimpleSum(field) or self.isNumeric(field)\n\n    def visitField(self, field, name, sum=None, prod=None, depth=0):\n        ctype = get_c_type(field.type)\n        self.emit(\"if (lookup_attr_id(obj, &PyId_%s, &tmp) < 0) {\" % field.name, depth)\n        self.emit(\"return 1;\", depth+1)\n        self.emit(\"}\", depth)\n        if not field.opt:\n            self.emit(\"if (tmp == NULL) {\", depth)\n            message = \"required field \\\\\\\"%s\\\\\\\" missing from %s\" % (field.name, name)\n            format = \"PyErr_SetString(PyExc_TypeError, \\\"%s\\\");\"\n            self.emit(format % message, depth+1, reflow=False)\n            self.emit(\"return 1;\", depth+1)\n        else:\n            self.emit(\"if (tmp == NULL || tmp == Py_None) {\", depth)\n            self.emit(\"Py_CLEAR(tmp);\", depth+1)\n            if self.isNumeric(field):\n                self.emit(\"%s = 0;\" % field.name, depth+1)\n            elif not self.isSimpleType(field):\n                self.emit(\"%s = NULL;\" % field.name, depth+1)\n            else:\n                raise TypeError(\"could not determine the default value for %s\" % field.name)\n        self.emit(\"}\", depth)\n        self.emit(\"else {\", depth)\n\n        self.emit(\"int res;\", depth+1)\n        if field.seq:\n            self.emit(\"Py_ssize_t len;\", depth+1)\n            self.emit(\"Py_ssize_t i;\", depth+1)\n            self.emit(\"if (!PyList_Check(tmp)) {\", depth+1)\n            self.emit(\"PyErr_Format(PyExc_TypeError, \\\"%s field \\\\\\\"%s\\\\\\\" must \"\n                      \"be a list, not a %%.200s\\\", tmp->ob_type->tp_name);\" %\n                      (name, field.name),\n                      depth+2, reflow=False)\n            self.emit(\"goto failed;\", depth+2)\n            self.emit(\"}\", depth+1)\n            self.emit(\"len = PyList_GET_SIZE(tmp);\", depth+1)\n            if self.isSimpleType(field):\n                self.emit(\"%s = _Ta3_asdl_int_seq_new(len, arena);\" % field.name, depth+1)\n            else:\n                self.emit(\"%s = _Ta3_asdl_seq_new(len, arena);\" % field.name, depth+1)\n            self.emit(\"if (%s == NULL) goto failed;\" % field.name, depth+1)\n            self.emit(\"for (i = 0; i < len; i++) {\", depth+1)\n            self.emit(\"%s val;\" % ctype, depth+2)\n            self.emit(\"res = obj2ast_%s(PyList_GET_ITEM(tmp, i), &val, arena);\" %\n                      field.type, depth+2, reflow=False)\n            self.emit(\"if (res != 0) goto failed;\", depth+2)\n            self.emit(\"if (len != PyList_GET_SIZE(tmp)) {\", depth+2)\n            self.emit(\"PyErr_SetString(PyExc_RuntimeError, \\\"%s field \\\\\\\"%s\\\\\\\" \"\n                      \"changed size during iteration\\\");\" %\n                      (name, field.name),\n                      depth+3, reflow=False)\n            self.emit(\"goto failed;\", depth+3)\n            self.emit(\"}\", depth+2)\n            self.emit(\"asdl_seq_SET(%s, i, val);\" % field.name, depth+2)\n            self.emit(\"}\", depth+1)\n        else:\n            self.emit(\"res = obj2ast_%s(tmp, &%s, arena);\" %\n                      (field.type, field.name), depth+1)\n            self.emit(\"if (res != 0) goto failed;\", depth+1)\n\n        self.emit(\"Py_CLEAR(tmp);\", depth+1)\n        self.emit(\"}\", depth)\n\n\nclass MarshalPrototypeVisitor(PickleVisitor):\n\n    def prototype(self, sum, name):\n        ctype = get_c_type(name)\n        self.emit(\"static int marshal_write_%s(PyObject **, int *, %s);\"\n                  % (name, ctype), 0)\n\n    visitProduct = visitSum = prototype\n\n\nclass PyTypesDeclareVisitor(PickleVisitor):\n\n    def visitProduct(self, prod, name):\n        self.emit(\"static PyTypeObject *%s_type;\" % name, 0)\n        self.emit(\"static PyObject* ast2obj_%s(void*);\" % name, 0)\n        if prod.attributes:\n            for a in prod.attributes:\n                self.emit_identifier(a.name)\n            self.emit(\"static char *%s_attributes[] = {\" % name, 0)\n            for a in prod.attributes:\n                self.emit('\"%s\",' % a.name, 1)\n            self.emit(\"};\", 0)\n        if prod.fields:\n            for f in prod.fields:\n                self.emit_identifier(f.name)\n            self.emit(\"static char *%s_fields[]={\" % name,0)\n            for f in prod.fields:\n                self.emit('\"%s\",' % f.name, 1)\n            self.emit(\"};\", 0)\n\n    def visitSum(self, sum, name):\n        self.emit(\"static PyTypeObject *%s_type;\" % name, 0)\n        if sum.attributes:\n            for a in sum.attributes:\n                self.emit_identifier(a.name)\n            self.emit(\"static char *%s_attributes[] = {\" % name, 0)\n            for a in sum.attributes:\n                self.emit('\"%s\",' % a.name, 1)\n            self.emit(\"};\", 0)\n        ptype = \"void*\"\n        if is_simple(sum):\n            ptype = get_c_type(name)\n            tnames = []\n            for t in sum.types:\n                tnames.append(str(t.name)+\"_singleton\")\n            tnames = \", *\".join(tnames)\n            self.emit(\"static PyObject *%s;\" % tnames, 0)\n        self.emit(\"static PyObject* ast2obj_%s(%s);\" % (name, ptype), 0)\n        for t in sum.types:\n            self.visitConstructor(t, name)\n\n    def visitConstructor(self, cons, name):\n        self.emit(\"static PyTypeObject *%s_type;\" % cons.name, 0)\n        if cons.fields:\n            for t in cons.fields:\n                self.emit_identifier(t.name)\n            self.emit(\"static char *%s_fields[]={\" % cons.name, 0)\n            for t in cons.fields:\n                self.emit('\"%s\",' % t.name, 1)\n            self.emit(\"};\",0)\n\nclass PyTypesVisitor(PickleVisitor):\n\n    def visitModule(self, mod):\n        self.emit(\"\"\"\n_Py_IDENTIFIER(_fields);\n_Py_IDENTIFIER(_attributes);\n\ntypedef struct {\n    PyObject_HEAD\n    PyObject *dict;\n} AST_object;\n\nstatic void\nast_dealloc(AST_object *self)\n{\n    /* bpo-31095: UnTrack is needed before calling any callbacks */\n    PyObject_GC_UnTrack(self);\n    Py_CLEAR(self->dict);\n    Py_TYPE(self)->tp_free(self);\n}\n\nstatic int\nast_traverse(AST_object *self, visitproc visit, void *arg)\n{\n    Py_VISIT(self->dict);\n    return 0;\n}\n\nstatic int\nast_clear(AST_object *self)\n{\n    Py_CLEAR(self->dict);\n    return 0;\n}\n\nstatic int lookup_attr_id(PyObject *v, _Py_Identifier *name, PyObject **result)\n{\n    PyObject *oname = _PyUnicode_FromId(name); /* borrowed */\n    if (!oname) {\n        *result = NULL;\n        return -1;\n    }\n    *result = PyObject_GetAttr(v, oname);\n    if (*result == NULL) {\n        if (!PyErr_ExceptionMatches(PyExc_AttributeError)) {\n            return -1;\n        }\n        PyErr_Clear();\n    }\n    return 0;\n}\n\nstatic int\nast_type_init(PyObject *self, PyObject *args, PyObject *kw)\n{\n    Py_ssize_t i, numfields = 0;\n    int res = -1;\n    PyObject *key, *value, *fields;\n    if (lookup_attr_id((PyObject*)Py_TYPE(self), &PyId__fields, &fields) < 0) {\n        goto cleanup;\n    }\n    if (fields) {\n        numfields = PySequence_Size(fields);\n        if (numfields == -1)\n            goto cleanup;\n    }\n\n    res = 0; /* if no error occurs, this stays 0 to the end */\n    if (numfields < PyTuple_GET_SIZE(args)) {\n        PyErr_Format(PyExc_TypeError, \"%.400s constructor takes at most \"\n                     \"%zd positional argument%s\",\n                     Py_TYPE(self)->tp_name,\n                     numfields, numfields == 1 ? \"\" : \"s\");\n        res = -1;\n        goto cleanup;\n    }\n    for (i = 0; i < PyTuple_GET_SIZE(args); i++) {\n        /* cannot be reached when fields is NULL */\n        PyObject *name = PySequence_GetItem(fields, i);\n        if (!name) {\n            res = -1;\n            goto cleanup;\n        }\n        res = PyObject_SetAttr(self, name, PyTuple_GET_ITEM(args, i));\n        Py_DECREF(name);\n        if (res < 0)\n            goto cleanup;\n    }\n    if (kw) {\n        i = 0;  /* needed by PyDict_Next */\n        while (PyDict_Next(kw, &i, &key, &value)) {\n            res = PyObject_SetAttr(self, key, value);\n            if (res < 0)\n                goto cleanup;\n        }\n    }\n  cleanup:\n    Py_XDECREF(fields);\n    return res;\n}\n\n/* Pickling support */\nstatic PyObject *\nast_type_reduce(PyObject *self, PyObject *unused)\n{\n    _Py_IDENTIFIER(__dict__);\n    PyObject *dict;\n    if (lookup_attr_id(self, &PyId___dict__, &dict) < 0) {\n        return NULL;\n    }\n    if (dict) {\n        return Py_BuildValue(\"O()N\", Py_TYPE(self), dict);\n    }\n    return Py_BuildValue(\"O()\", Py_TYPE(self));\n}\n\nstatic PyMethodDef ast_type_methods[] = {\n    {\"__reduce__\", ast_type_reduce, METH_NOARGS, NULL},\n    {NULL}\n};\n\nstatic PyGetSetDef ast_type_getsets[] = {\n    {\"__dict__\", PyObject_GenericGetDict, PyObject_GenericSetDict},\n    {NULL}\n};\n\nstatic PyTypeObject AST_type = {\n    PyVarObject_HEAD_INIT(NULL, 0)\n    \"typed_ast._ast3.AST\",\n    sizeof(AST_object),\n    0,\n    (destructor)ast_dealloc, /* tp_dealloc */\n    0,                       /* tp_print */\n    0,                       /* tp_getattr */\n    0,                       /* tp_setattr */\n    0,                       /* tp_reserved */\n    0,                       /* tp_repr */\n    0,                       /* tp_as_number */\n    0,                       /* tp_as_sequence */\n    0,                       /* tp_as_mapping */\n    0,                       /* tp_hash */\n    0,                       /* tp_call */\n    0,                       /* tp_str */\n    PyObject_GenericGetAttr, /* tp_getattro */\n    PyObject_GenericSetAttr, /* tp_setattro */\n    0,                       /* tp_as_buffer */\n    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, /* tp_flags */\n    0,                       /* tp_doc */\n    (traverseproc)ast_traverse, /* tp_traverse */\n    (inquiry)ast_clear,      /* tp_clear */\n    0,                       /* tp_richcompare */\n    0,                       /* tp_weaklistoffset */\n    0,                       /* tp_iter */\n    0,                       /* tp_iternext */\n    ast_type_methods,        /* tp_methods */\n    0,                       /* tp_members */\n    ast_type_getsets,        /* tp_getset */\n    0,                       /* tp_base */\n    0,                       /* tp_dict */\n    0,                       /* tp_descr_get */\n    0,                       /* tp_descr_set */\n    offsetof(AST_object, dict),/* tp_dictoffset */\n    (initproc)ast_type_init, /* tp_init */\n    PyType_GenericAlloc,     /* tp_alloc */\n    PyType_GenericNew,       /* tp_new */\n    PyObject_GC_Del,         /* tp_free */\n};\n\n\nstatic PyTypeObject* make_type(char *type, PyTypeObject* base, char**fields, int num_fields)\n{\n    _Py_IDENTIFIER(__module__);\n    _Py_static_string(PyId_typed_ast_ast3, \"typed_ast._ast3\");\n    PyObject *fnames, *result;\n    int i;\n    fnames = PyTuple_New(num_fields);\n    if (!fnames) return NULL;\n    for (i = 0; i < num_fields; i++) {\n        PyObject *field = PyUnicode_FromString(fields[i]);\n        if (!field) {\n            Py_DECREF(fnames);\n            return NULL;\n        }\n        PyTuple_SET_ITEM(fnames, i, field);\n    }\n    result = PyObject_CallFunction((PyObject*)&PyType_Type, \"s(O){OOOO}\",\n                    type, base,\n                    _PyUnicode_FromId(&PyId__fields), fnames,\n                    _PyUnicode_FromId(&PyId___module__),\n                    _PyUnicode_FromId(&PyId_typed_ast_ast3));\n    Py_DECREF(fnames);\n    return (PyTypeObject*)result;\n}\n\nstatic int add_attributes(PyTypeObject* type, char**attrs, int num_fields)\n{\n    int i, result;\n    PyObject *s, *l = PyTuple_New(num_fields);\n    if (!l)\n        return 0;\n    for (i = 0; i < num_fields; i++) {\n        s = PyUnicode_FromString(attrs[i]);\n        if (!s) {\n            Py_DECREF(l);\n            return 0;\n        }\n        PyTuple_SET_ITEM(l, i, s);\n    }\n    result = _PyObject_SetAttrId((PyObject*)type, &PyId__attributes, l) >= 0;\n    Py_DECREF(l);\n    return result;\n}\n\n/* Conversion AST -> Python */\n\nstatic PyObject* ast2obj_list(asdl_seq *seq, PyObject* (*func)(void*))\n{\n    Py_ssize_t i, n = asdl_seq_LEN(seq);\n    PyObject *result = PyList_New(n);\n    PyObject *value;\n    if (!result)\n        return NULL;\n    for (i = 0; i < n; i++) {\n        value = func(asdl_seq_GET(seq, i));\n        if (!value) {\n            Py_DECREF(result);\n            return NULL;\n        }\n        PyList_SET_ITEM(result, i, value);\n    }\n    return result;\n}\n\nstatic PyObject* ast2obj_object(void *o)\n{\n    if (!o)\n        o = Py_None;\n    Py_INCREF((PyObject*)o);\n    return (PyObject*)o;\n}\n#define ast2obj_singleton ast2obj_object\n#define ast2obj_constant ast2obj_object\n#define ast2obj_identifier ast2obj_object\n#define ast2obj_string ast2obj_object\n#define ast2obj_bytes ast2obj_object\n\nstatic PyObject* ast2obj_int(long b)\n{\n    return PyLong_FromLong(b);\n}\n\n/* Conversion Python -> AST */\n\nstatic int obj2ast_singleton(PyObject *obj, PyObject** out, PyArena* arena)\n{\n    if (obj != Py_None && obj != Py_True && obj != Py_False) {\n        PyErr_SetString(PyExc_ValueError,\n                        \"AST singleton must be True, False, or None\");\n        return 1;\n    }\n    *out = obj;\n    return 0;\n}\n\nstatic int obj2ast_object(PyObject* obj, PyObject** out, PyArena* arena)\n{\n    if (obj == Py_None)\n        obj = NULL;\n    if (obj) {\n        if (PyArena_AddPyObject(arena, obj) < 0) {\n            *out = NULL;\n            return -1;\n        }\n        Py_INCREF(obj);\n    }\n    *out = obj;\n    return 0;\n}\n\nstatic int obj2ast_constant(PyObject* obj, PyObject** out, PyArena* arena)\n{\n    if (obj) {\n        if (PyArena_AddPyObject(arena, obj) < 0) {\n            *out = NULL;\n            return -1;\n        }\n        Py_INCREF(obj);\n    }\n    *out = obj;\n    return 0;\n}\n\nstatic int obj2ast_identifier(PyObject* obj, PyObject** out, PyArena* arena)\n{\n    if (!PyUnicode_CheckExact(obj) && obj != Py_None) {\n        PyErr_SetString(PyExc_TypeError, \"AST identifier must be of type str\");\n        return 1;\n    }\n    return obj2ast_object(obj, out, arena);\n}\n\nstatic int obj2ast_string(PyObject* obj, PyObject** out, PyArena* arena)\n{\n    if (!PyUnicode_CheckExact(obj) && !PyBytes_CheckExact(obj)) {\n        PyErr_SetString(PyExc_TypeError, \"AST string must be of type str\");\n        return 1;\n    }\n    return obj2ast_object(obj, out, arena);\n}\n\nstatic int obj2ast_bytes(PyObject* obj, PyObject** out, PyArena* arena)\n{\n    if (!PyBytes_CheckExact(obj)) {\n        PyErr_SetString(PyExc_TypeError, \"AST bytes must be of type bytes\");\n        return 1;\n    }\n    return obj2ast_object(obj, out, arena);\n}\n\nstatic int obj2ast_int(PyObject* obj, int* out, PyArena* arena)\n{\n    int i;\n    if (!PyLong_Check(obj)) {\n        PyErr_Format(PyExc_ValueError, \"invalid integer value: %R\", obj);\n        return 1;\n    }\n\n    i = _PyLong_AsInt(obj);\n    if (i == -1 && PyErr_Occurred())\n        return 1;\n    *out = i;\n    return 0;\n}\n\nstatic int add_ast_fields(void)\n{\n    PyObject *empty_tuple, *d;\n    if (PyType_Ready(&AST_type) < 0)\n        return -1;\n    d = AST_type.tp_dict;\n    empty_tuple = PyTuple_New(0);\n    if (!empty_tuple ||\n        _PyDict_SetItemId(d, &PyId__fields, empty_tuple) < 0 ||\n        _PyDict_SetItemId(d, &PyId__attributes, empty_tuple) < 0) {\n        Py_XDECREF(empty_tuple);\n        return -1;\n    }\n    Py_DECREF(empty_tuple);\n    return 0;\n}\n\n\"\"\", 0, reflow=False)\n\n        self.emit(\"static int init_types(void)\",0)\n        self.emit(\"{\", 0)\n        self.emit(\"static int initialized;\", 1)\n        self.emit(\"if (initialized) return 1;\", 1)\n        self.emit(\"if (add_ast_fields() < 0) return 0;\", 1)\n        for dfn in mod.dfns:\n            self.visit(dfn)\n        self.emit(\"initialized = 1;\", 1)\n        self.emit(\"return 1;\", 1);\n        self.emit(\"}\", 0)\n\n    def visitProduct(self, prod, name):\n        if prod.fields:\n            fields = name+\"_fields\"\n        else:\n            fields = \"NULL\"\n        self.emit('%s_type = make_type(\"%s\", &AST_type, %s, %d);' %\n                        (name, name, fields, len(prod.fields)), 1)\n        self.emit(\"if (!%s_type) return 0;\" % name, 1)\n        if prod.attributes:\n            self.emit(\"if (!add_attributes(%s_type, %s_attributes, %d)) return 0;\" %\n                            (name, name, len(prod.attributes)), 1)\n        else:\n            self.emit(\"if (!add_attributes(%s_type, NULL, 0)) return 0;\" % name, 1)\n\n    def visitSum(self, sum, name):\n        self.emit('%s_type = make_type(\"%s\", &AST_type, NULL, 0);' %\n                  (name, name), 1)\n        self.emit(\"if (!%s_type) return 0;\" % name, 1)\n        if sum.attributes:\n            self.emit(\"if (!add_attributes(%s_type, %s_attributes, %d)) return 0;\" %\n                            (name, name, len(sum.attributes)), 1)\n        else:\n            self.emit(\"if (!add_attributes(%s_type, NULL, 0)) return 0;\" % name, 1)\n        simple = is_simple(sum)\n        for t in sum.types:\n            self.visitConstructor(t, name, simple)\n\n    def visitConstructor(self, cons, name, simple):\n        if cons.fields:\n            fields = cons.name+\"_fields\"\n        else:\n            fields = \"NULL\"\n        self.emit('%s_type = make_type(\"%s\", %s_type, %s, %d);' %\n                            (cons.name, cons.name, name, fields, len(cons.fields)), 1)\n        self.emit(\"if (!%s_type) return 0;\" % cons.name, 1)\n        if simple:\n            self.emit(\"%s_singleton = PyType_GenericNew(%s_type, NULL, NULL);\" %\n                             (cons.name, cons.name), 1)\n            self.emit(\"if (!%s_singleton) return 0;\" % cons.name, 1)\n\n\nclass ASTModuleVisitor(PickleVisitor):\n\n    def visitModule(self, mod):\n        self.emit(\"PyObject *ast3_parse(PyObject *self, PyObject *args);\", 0)\n        self.emit(\"static PyMethodDef ast3_methods[] = {\", 0)\n        self.emit('    {\"_parse\",  ast3_parse, METH_VARARGS, \"Parse string into typed AST.\"},', 0)\n        self.emit(\"    {NULL, NULL, 0, NULL}\", 0)\n        self.emit(\"};\", 0)\n        self.emit(\"static struct PyModuleDef _astmodule = {\", 0)\n        self.emit('    PyModuleDef_HEAD_INIT, \"_ast3\", NULL, 0, ast3_methods', 0)\n        self.emit(\"};\", 0)\n        self.emit(\"PyMODINIT_FUNC\", 0)\n        self.emit(\"PyInit__ast3(void)\", 0)\n        self.emit(\"{\", 0)\n        self.emit(\"PyObject *m, *d;\", 1)\n        self.emit(\"if (!init_types()) return NULL;\", 1)\n        self.emit('m = PyModule_Create(&_astmodule);', 1)\n        self.emit(\"if (!m) return NULL;\", 1)\n        self.emit(\"d = PyModule_GetDict(m);\", 1)\n        self.emit('if (PyDict_SetItemString(d, \"AST\", (PyObject*)&AST_type) < 0) return NULL;', 1)\n        self.emit('if (PyModule_AddIntMacro(m, PyCF_ONLY_AST) < 0)', 1)\n        self.emit(\"return NULL;\", 2)\n        for dfn in mod.dfns:\n            self.visit(dfn)\n        self.emit(\"return m;\", 1)\n        self.emit(\"}\", 0)\n\n    def visitProduct(self, prod, name):\n        self.addObj(name)\n\n    def visitSum(self, sum, name):\n        self.addObj(name)\n        for t in sum.types:\n            self.visitConstructor(t, name)\n\n    def visitConstructor(self, cons, name):\n        self.addObj(cons.name)\n\n    def addObj(self, name):\n        self.emit('if (PyDict_SetItemString(d, \"%s\", (PyObject*)%s_type) < 0) return NULL;' % (name, name), 1)\n\n\n_SPECIALIZED_SEQUENCES = ('stmt', 'expr')\n\ndef find_sequence(fields, doing_specialization):\n    \"\"\"Return True if any field uses a sequence.\"\"\"\n    for f in fields:\n        if f.seq:\n            if not doing_specialization:\n                return True\n            if str(f.type) not in _SPECIALIZED_SEQUENCES:\n                return True\n    return False\n\ndef has_sequence(types, doing_specialization):\n    for t in types:\n        if find_sequence(t.fields, doing_specialization):\n            return True\n    return False\n\n\nclass StaticVisitor(PickleVisitor):\n    CODE = '''Very simple, always emit this static code.  Override CODE'''\n\n    def visit(self, object):\n        self.emit(self.CODE, 0, reflow=False)\n\n\nclass ObjVisitor(PickleVisitor):\n\n    def func_begin(self, name):\n        ctype = get_c_type(name)\n        self.emit(\"PyObject*\", 0)\n        self.emit(\"ast2obj_%s(void* _o)\" % (name), 0)\n        self.emit(\"{\", 0)\n        self.emit(\"%s o = (%s)_o;\" % (ctype, ctype), 1)\n        self.emit(\"PyObject *result = NULL, *value = NULL;\", 1)\n        self.emit('if (!o) {', 1)\n        self.emit(\"Py_RETURN_NONE;\", 2)\n        self.emit(\"}\", 1)\n        self.emit('', 0)\n\n    def func_end(self):\n        self.emit(\"return result;\", 1)\n        self.emit(\"failed:\", 0)\n        self.emit(\"Py_XDECREF(value);\", 1)\n        self.emit(\"Py_XDECREF(result);\", 1)\n        self.emit(\"return NULL;\", 1)\n        self.emit(\"}\", 0)\n        self.emit(\"\", 0)\n\n    def visitSum(self, sum, name):\n        if is_simple(sum):\n            self.simpleSum(sum, name)\n            return\n        self.func_begin(name)\n        self.emit(\"switch (o->kind) {\", 1)\n        for i in range(len(sum.types)):\n            t = sum.types[i]\n            self.visitConstructor(t, i + 1, name)\n        self.emit(\"}\", 1)\n        for a in sum.attributes:\n            self.emit(\"value = ast2obj_%s(o->%s);\" % (a.type, a.name), 1)\n            self.emit(\"if (!value) goto failed;\", 1)\n            self.emit('if (_PyObject_SetAttrId(result, &PyId_%s, value) < 0)' % a.name, 1)\n            self.emit('goto failed;', 2)\n            self.emit('Py_DECREF(value);', 1)\n        self.func_end()\n\n    def simpleSum(self, sum, name):\n        self.emit(\"PyObject* ast2obj_%s(%s_ty o)\" % (name, name), 0)\n        self.emit(\"{\", 0)\n        self.emit(\"switch(o) {\", 1)\n        for t in sum.types:\n            self.emit(\"case %s:\" % t.name, 2)\n            self.emit(\"Py_INCREF(%s_singleton);\" % t.name, 3)\n            self.emit(\"return %s_singleton;\" % t.name, 3)\n        self.emit(\"default:\", 2)\n        self.emit('/* should never happen, but just in case ... */', 3)\n        code = \"PyErr_Format(PyExc_SystemError, \\\"unknown %s found\\\");\" % name\n        self.emit(code, 3, reflow=False)\n        self.emit(\"return NULL;\", 3)\n        self.emit(\"}\", 1)\n        self.emit(\"}\", 0)\n\n    def visitProduct(self, prod, name):\n        self.func_begin(name)\n        self.emit(\"result = PyType_GenericNew(%s_type, NULL, NULL);\" % name, 1);\n        self.emit(\"if (!result) return NULL;\", 1)\n        for field in prod.fields:\n            self.visitField(field, name, 1, True)\n        for a in prod.attributes:\n            self.emit(\"value = ast2obj_%s(o->%s);\" % (a.type, a.name), 1)\n            self.emit(\"if (!value) goto failed;\", 1)\n            self.emit('if (_PyObject_SetAttrId(result, &PyId_%s, value) < 0)' % a.name, 1)\n            self.emit('goto failed;', 2)\n            self.emit('Py_DECREF(value);', 1)\n        self.func_end()\n\n    def visitConstructor(self, cons, enum, name):\n        self.emit(\"case %s_kind:\" % cons.name, 1)\n        self.emit(\"result = PyType_GenericNew(%s_type, NULL, NULL);\" % cons.name, 2);\n        self.emit(\"if (!result) goto failed;\", 2)\n        for f in cons.fields:\n            self.visitField(f, cons.name, 2, False)\n        self.emit(\"break;\", 2)\n\n    def visitField(self, field, name, depth, product):\n        def emit(s, d):\n            self.emit(s, depth + d)\n        if product:\n            value = \"o->%s\" % field.name\n        else:\n            value = \"o->v.%s.%s\" % (name, field.name)\n        self.set(field, value, depth)\n        emit(\"if (!value) goto failed;\", 0)\n        emit('if (_PyObject_SetAttrId(result, &PyId_%s, value) == -1)' % field.name, 0)\n        emit(\"goto failed;\", 1)\n        emit(\"Py_DECREF(value);\", 0)\n\n    def emitSeq(self, field, value, depth, emit):\n        emit(\"seq = %s;\" % value, 0)\n        emit(\"n = asdl_seq_LEN(seq);\", 0)\n        emit(\"value = PyList_New(n);\", 0)\n        emit(\"if (!value) goto failed;\", 0)\n        emit(\"for (i = 0; i < n; i++) {\", 0)\n        self.set(\"value\", field, \"asdl_seq_GET(seq, i)\", depth + 1)\n        emit(\"if (!value1) goto failed;\", 1)\n        emit(\"PyList_SET_ITEM(value, i, value1);\", 1)\n        emit(\"value1 = NULL;\", 1)\n        emit(\"}\", 0)\n\n    def set(self, field, value, depth):\n        if field.seq:\n            # XXX should really check for is_simple, but that requires a symbol table\n            if field.type == \"cmpop\":\n                # While the sequence elements are stored as void*,\n                # ast2obj_cmpop expects an enum\n                self.emit(\"{\", depth)\n                self.emit(\"Py_ssize_t i, n = asdl_seq_LEN(%s);\" % value, depth+1)\n                self.emit(\"value = PyList_New(n);\", depth+1)\n                self.emit(\"if (!value) goto failed;\", depth+1)\n                self.emit(\"for(i = 0; i < n; i++)\", depth+1)\n                # This cannot fail, so no need for error handling\n                self.emit(\"PyList_SET_ITEM(value, i, ast2obj_cmpop((cmpop_ty)asdl_seq_GET(%s, i)));\" % value,\n                          depth+2, reflow=False)\n                self.emit(\"}\", depth)\n            else:\n                self.emit(\"value = ast2obj_list(%s, ast2obj_%s);\" % (value, field.type), depth)\n        else:\n            ctype = get_c_type(field.type)\n            self.emit(\"value = ast2obj_%s(%s);\" % (field.type, value), depth, reflow=False)\n\n\nclass PartingShots(StaticVisitor):\n\n    CODE = \"\"\"\nPyObject* Ta3AST_mod2obj(mod_ty t)\n{\n    if (!init_types())\n        return NULL;\n    return ast2obj_mod(t);\n}\n\n/* mode is 0 for \"exec\", 1 for \"eval\" and 2 for \"single\" input */\nmod_ty Ta3AST_obj2mod(PyObject* ast, PyArena* arena, int mode)\n{\n    mod_ty res;\n    PyObject *req_type[3];\n    char *req_name[] = {\"Module\", \"Expression\", \"Interactive\"};\n    int isinstance;\n\n    req_type[0] = (PyObject*)Module_type;\n    req_type[1] = (PyObject*)Expression_type;\n    req_type[2] = (PyObject*)Interactive_type;\n\n    assert(0 <= mode && mode <= 2);\n\n    if (!init_types())\n        return NULL;\n\n    isinstance = PyObject_IsInstance(ast, req_type[mode]);\n    if (isinstance == -1)\n        return NULL;\n    if (!isinstance) {\n        PyErr_Format(PyExc_TypeError, \"expected %s node, got %.400s\",\n                     req_name[mode], Py_TYPE(ast)->tp_name);\n        return NULL;\n    }\n    if (obj2ast_mod(ast, &res, arena) != 0)\n        return NULL;\n    else\n        return res;\n}\n\nint Ta3AST_Check(PyObject* obj)\n{\n    if (!init_types())\n        return -1;\n    return PyObject_IsInstance(obj, (PyObject*)&AST_type);\n}\n\"\"\"\n\nclass ChainOfVisitors:\n    def __init__(self, *visitors):\n        self.visitors = visitors\n\n    def visit(self, object):\n        for v in self.visitors:\n            v.visit(object)\n            v.emit(\"\", 0)\n\ncommon_msg = \"/* File automatically generated by %s. */\\n\\n\"\n\ndef main(srcfile, dump_module=False):\n    argv0 = sys.argv[0]\n    components = argv0.split(os.sep)\n    argv0 = os.sep.join(components[-2:])\n    auto_gen_msg = common_msg % argv0\n    mod = asdl.parse(srcfile)\n    if dump_module:\n        print('Parsed Module:')\n        print(mod)\n    if not asdl.check(mod):\n        sys.exit(1)\n    if H_FILE:\n        with open(H_FILE, \"w\") as f:\n            f.write(auto_gen_msg)\n            f.write('#include \"asdl.h\"\\n\\n')\n            c = ChainOfVisitors(TypeDefVisitor(f),\n                                StructVisitor(f),\n                                PrototypeVisitor(f),\n                                )\n            c.visit(mod)\n            f.write(\"PyObject* Ta3AST_mod2obj(mod_ty t);\\n\")\n            f.write(\"mod_ty Ta3AST_obj2mod(PyObject* ast, PyArena* arena, int mode);\\n\")\n            f.write(\"int Ta3AST_Check(PyObject* obj);\\n\")\n\n    if C_FILE:\n        with open(C_FILE, \"w\") as f:\n            f.write(auto_gen_msg)\n            f.write('#include <stddef.h>\\n')\n            f.write('\\n')\n            f.write('#include \"Python.h\"\\n')\n            f.write('#include \"%s-ast.h\"\\n' % mod.name)\n            f.write('\\n')\n            f.write(\"static PyTypeObject AST_type;\\n\")\n            v = ChainOfVisitors(\n                PyTypesDeclareVisitor(f),\n                PyTypesVisitor(f),\n                Obj2ModPrototypeVisitor(f),\n                FunctionVisitor(f),\n                ObjVisitor(f),\n                Obj2ModVisitor(f),\n                ASTModuleVisitor(f),\n                PartingShots(f),\n                )\n            v.visit(mod)\n\nif __name__ == \"__main__\":\n    import getopt\n\n    H_FILE = ''\n    C_FILE = ''\n    dump_module = False\n    opts, args = getopt.getopt(sys.argv[1:], \"dh:c:\")\n    for o, v in opts:\n        if o == '-h':\n            H_FILE = v\n        if o == '-c':\n            C_FILE = v\n        if o == '-d':\n            dump_module = True\n    if H_FILE and C_FILE:\n        print('Must specify exactly one output file')\n        sys.exit(1)\n    elif len(args) != 1:\n        print('Must specify single input file')\n        sys.exit(1)\n    main(args[0], dump_module)\n"
  },
  {
    "path": "ast3/Parser/bitset.c",
    "content": "\n/* Bitset primitives used by the parser generator */\n\n#include \"../Include/pgenheaders.h\"\n#include \"../Include/bitset.h\"\n\nbitset\nnewbitset(int nbits)\n{\n    int nbytes = NBYTES(nbits);\n    bitset ss = (char *)PyObject_MALLOC(sizeof(BYTE) *  nbytes);\n\n    if (ss == NULL)\n        Py_FatalError(\"no mem for bitset\");\n\n    ss += nbytes;\n    while (--nbytes >= 0)\n        *--ss = 0;\n    return ss;\n}\n\nvoid\ndelbitset(bitset ss)\n{\n    PyObject_FREE(ss);\n}\n\nint\naddbit(bitset ss, int ibit)\n{\n    int ibyte = BIT2BYTE(ibit);\n    BYTE mask = BIT2MASK(ibit);\n\n    if (ss[ibyte] & mask)\n        return 0; /* Bit already set */\n    ss[ibyte] |= mask;\n    return 1;\n}\n\n#if 0 /* Now a macro */\nint\ntestbit(bitset ss, int ibit)\n{\n    return (ss[BIT2BYTE(ibit)] & BIT2MASK(ibit)) != 0;\n}\n#endif\n\nint\nsamebitset(bitset ss1, bitset ss2, int nbits)\n{\n    int i;\n\n    for (i = NBYTES(nbits); --i >= 0; )\n        if (*ss1++ != *ss2++)\n            return 0;\n    return 1;\n}\n\nvoid\nmergebitset(bitset ss1, bitset ss2, int nbits)\n{\n    int i;\n\n    for (i = NBYTES(nbits); --i >= 0; )\n        *ss1++ |= *ss2++;\n}\n"
  },
  {
    "path": "ast3/Parser/grammar.c",
    "content": "\n/* Grammar implementation */\n\n#include \"Python.h\"\n#include \"../Include/pgenheaders.h\"\n\n#include <ctype.h>\n\n#include \"../Include/token.h\"\n#include \"../Include/grammar.h\"\n\nPyAPI_DATA(int) Py_DebugFlag;\n\ngrammar *\nnewgrammar(int start)\n{\n    grammar *g;\n\n    g = (grammar *)PyObject_MALLOC(sizeof(grammar));\n    if (g == NULL)\n        Py_FatalError(\"no mem for new grammar\");\n    g->g_ndfas = 0;\n    g->g_dfa = NULL;\n    g->g_start = start;\n    g->g_ll.ll_nlabels = 0;\n    g->g_ll.ll_label = NULL;\n    g->g_accel = 0;\n    return g;\n}\n\nvoid\nfreegrammar(grammar *g)\n{\n    int i, j;\n    for (i = 0; i < g->g_ndfas; i++) {\n        free(g->g_dfa[i].d_name);\n        for (j = 0; j < g->g_dfa[i].d_nstates; j++)\n            PyObject_FREE(g->g_dfa[i].d_state[j].s_arc);\n        PyObject_FREE(g->g_dfa[i].d_state);\n    }\n    PyObject_FREE(g->g_dfa);\n    for (i = 0; i < g->g_ll.ll_nlabels; i++)\n        free(g->g_ll.ll_label[i].lb_str);\n    PyObject_FREE(g->g_ll.ll_label);\n    PyObject_FREE(g);\n}\n\ndfa *\nadddfa(grammar *g, int type, const char *name)\n{\n    dfa *d;\n\n    g->g_dfa = (dfa *)PyObject_REALLOC(g->g_dfa,\n                                        sizeof(dfa) * (g->g_ndfas + 1));\n    if (g->g_dfa == NULL)\n        Py_FatalError(\"no mem to resize dfa in adddfa\");\n    d = &g->g_dfa[g->g_ndfas++];\n    d->d_type = type;\n    d->d_name = strdup(name);\n    d->d_nstates = 0;\n    d->d_state = NULL;\n    d->d_initial = -1;\n    d->d_first = NULL;\n    return d; /* Only use while fresh! */\n}\n\nint\naddstate(dfa *d)\n{\n    state *s;\n\n    d->d_state = (state *)PyObject_REALLOC(d->d_state,\n                                  sizeof(state) * (d->d_nstates + 1));\n    if (d->d_state == NULL)\n        Py_FatalError(\"no mem to resize state in addstate\");\n    s = &d->d_state[d->d_nstates++];\n    s->s_narcs = 0;\n    s->s_arc = NULL;\n    s->s_lower = 0;\n    s->s_upper = 0;\n    s->s_accel = NULL;\n    s->s_accept = 0;\n    return Py_SAFE_DOWNCAST(s - d->d_state, intptr_t, int);\n}\n\nvoid\naddarc(dfa *d, int from, int to, int lbl)\n{\n    state *s;\n    arc *a;\n\n    assert(0 <= from && from < d->d_nstates);\n    assert(0 <= to && to < d->d_nstates);\n\n    s = &d->d_state[from];\n    s->s_arc = (arc *)PyObject_REALLOC(s->s_arc, sizeof(arc) * (s->s_narcs + 1));\n    if (s->s_arc == NULL)\n        Py_FatalError(\"no mem to resize arc list in addarc\");\n    a = &s->s_arc[s->s_narcs++];\n    a->a_lbl = lbl;\n    a->a_arrow = to;\n}\n\nint\naddlabel(labellist *ll, int type, const char *str)\n{\n    int i;\n    label *lb;\n\n    for (i = 0; i < ll->ll_nlabels; i++) {\n        if (ll->ll_label[i].lb_type == type &&\n            strcmp(ll->ll_label[i].lb_str, str) == 0)\n            return i;\n    }\n    ll->ll_label = (label *)PyObject_REALLOC(ll->ll_label,\n                                    sizeof(label) * (ll->ll_nlabels + 1));\n    if (ll->ll_label == NULL)\n        Py_FatalError(\"no mem to resize labellist in addlabel\");\n    lb = &ll->ll_label[ll->ll_nlabels++];\n    lb->lb_type = type;\n    lb->lb_str = strdup(str);\n    if (Py_DebugFlag)\n        printf(\"Label @ %8p, %d: %s\\n\", ll, ll->ll_nlabels,\n               Ta3Grammar_LabelRepr(lb));\n    return Py_SAFE_DOWNCAST(lb - ll->ll_label, intptr_t, int);\n}\n\n/* Same, but rather dies than adds */\n\nint\nfindlabel(labellist *ll, int type, const char *str)\n{\n    int i;\n\n    for (i = 0; i < ll->ll_nlabels; i++) {\n        if (ll->ll_label[i].lb_type == type /*&&\n            strcmp(ll->ll_label[i].lb_str, str) == 0*/)\n            return i;\n    }\n    fprintf(stderr, \"Label %d/'%s' not found\\n\", type, str);\n    Py_FatalError(\"grammar.c:findlabel()\");\n\n    /* Py_FatalError() is declared with __attribute__((__noreturn__)).\n       GCC emits a warning without \"return 0;\" (compiler bug!), but Clang is\n       smarter and emits a warning on the return... */\n#ifndef __clang__\n    return 0; /* Make gcc -Wall happy */\n#endif\n}\n\n/* Forward */\nstatic void translabel(grammar *, label *);\n\nvoid\ntranslatelabels(grammar *g)\n{\n    int i;\n\n#ifdef Py_DEBUG\n    printf(\"Translating labels ...\\n\");\n#endif\n    /* Don't translate EMPTY */\n    for (i = EMPTY+1; i < g->g_ll.ll_nlabels; i++)\n        translabel(g, &g->g_ll.ll_label[i]);\n}\n\nstatic void\ntranslabel(grammar *g, label *lb)\n{\n    int i;\n\n    if (Py_DebugFlag)\n        printf(\"Translating label %s ...\\n\", Ta3Grammar_LabelRepr(lb));\n\n    if (lb->lb_type == NAME) {\n        for (i = 0; i < g->g_ndfas; i++) {\n            if (strcmp(lb->lb_str, g->g_dfa[i].d_name) == 0) {\n                if (Py_DebugFlag)\n                    printf(\n                        \"Label %s is non-terminal %d.\\n\",\n                        lb->lb_str,\n                        g->g_dfa[i].d_type);\n                lb->lb_type = g->g_dfa[i].d_type;\n                free(lb->lb_str);\n                lb->lb_str = NULL;\n                return;\n            }\n        }\n        for (i = 0; i < (int)N_TOKENS; i++) {\n            if (strcmp(lb->lb_str, _Ta3Parser_TokenNames[i]) == 0) {\n                if (Py_DebugFlag)\n                    printf(\"Label %s is terminal %d.\\n\",\n                        lb->lb_str, i);\n                lb->lb_type = i;\n                free(lb->lb_str);\n                lb->lb_str = NULL;\n                return;\n            }\n        }\n        printf(\"Can't translate NAME label '%s'\\n\", lb->lb_str);\n        return;\n    }\n\n    if (lb->lb_type == STRING) {\n        if (isalpha(Py_CHARMASK(lb->lb_str[1])) ||\n            lb->lb_str[1] == '_') {\n            char *p;\n            char *src;\n            char *dest;\n            size_t name_len;\n            if (Py_DebugFlag)\n                printf(\"Label %s is a keyword\\n\", lb->lb_str);\n            lb->lb_type = NAME;\n            src = lb->lb_str + 1;\n            p = strchr(src, '\\'');\n            if (p)\n                name_len = p - src;\n            else\n                name_len = strlen(src);\n            dest = (char *)malloc(name_len + 1);\n            if (!dest) {\n                printf(\"Can't alloc dest '%s'\\n\", src);\n                return;\n            }\n            strncpy(dest, src, name_len);\n            dest[name_len] = '\\0';\n            free(lb->lb_str);\n            lb->lb_str = dest;\n        }\n        else if (lb->lb_str[2] == lb->lb_str[0]) {\n            int type = (int) Ta3Token_OneChar(lb->lb_str[1]);\n            if (type != OP) {\n                lb->lb_type = type;\n                free(lb->lb_str);\n                lb->lb_str = NULL;\n            }\n            else\n                printf(\"Unknown OP label %s\\n\",\n                    lb->lb_str);\n        }\n        else if (lb->lb_str[2] && lb->lb_str[3] == lb->lb_str[0]) {\n            int type = (int) Ta3Token_TwoChars(lb->lb_str[1],\n                                       lb->lb_str[2]);\n            if (type != OP) {\n                lb->lb_type = type;\n                free(lb->lb_str);\n                lb->lb_str = NULL;\n            }\n            else\n                printf(\"Unknown OP label %s\\n\",\n                    lb->lb_str);\n        }\n        else if (lb->lb_str[2] && lb->lb_str[3] && lb->lb_str[4] == lb->lb_str[0]) {\n            int type = (int) Ta3Token_ThreeChars(lb->lb_str[1],\n                                                lb->lb_str[2],\n                                                lb->lb_str[3]);\n            if (type != OP) {\n                lb->lb_type = type;\n                free(lb->lb_str);\n                lb->lb_str = NULL;\n            }\n            else\n                printf(\"Unknown OP label %s\\n\",\n                    lb->lb_str);\n        }\n        else\n            printf(\"Can't translate STRING label %s\\n\",\n                lb->lb_str);\n    }\n    else\n        printf(\"Can't translate label '%s'\\n\",\n               Ta3Grammar_LabelRepr(lb));\n}\n"
  },
  {
    "path": "ast3/Parser/grammar1.c",
    "content": "\n/* Grammar subroutines needed by parser */\n\n#include \"Python.h\"\n#include \"../Include/pgenheaders.h\"\n#include \"../Include/grammar.h\"\n#include \"../Include/token.h\"\n\n/* Return the DFA for the given type */\n\ndfa *\nTa3Grammar_FindDFA(grammar *g, int type)\n{\n    dfa *d;\n#if 1\n    /* Massive speed-up */\n    d = &g->g_dfa[type - NT_OFFSET];\n    assert(d->d_type == type);\n    return d;\n#else\n    /* Old, slow version */\n    int i;\n\n    for (i = g->g_ndfas, d = g->g_dfa; --i >= 0; d++) {\n        if (d->d_type == type)\n            return d;\n    }\n    abort();\n#endif\n}\n\nconst char *\nTa3Grammar_LabelRepr(label *lb)\n{\n    static char buf[100];\n\n    if (lb->lb_type == ENDMARKER)\n        return \"EMPTY\";\n    else if (ISNONTERMINAL(lb->lb_type)) {\n        if (lb->lb_str == NULL) {\n            PyOS_snprintf(buf, sizeof(buf), \"NT%d\", lb->lb_type);\n            return buf;\n        }\n        else\n            return lb->lb_str;\n    }\n    else if (lb->lb_type < N_TOKENS) {\n        if (lb->lb_str == NULL)\n            return _Ta3Parser_TokenNames[lb->lb_type];\n        else {\n            PyOS_snprintf(buf, sizeof(buf), \"%.32s(%.32s)\",\n                _Ta3Parser_TokenNames[lb->lb_type], lb->lb_str);\n            return buf;\n        }\n    }\n    else {\n        Py_FatalError(\"invalid label\");\n        return NULL;\n    }\n}\n"
  },
  {
    "path": "ast3/Parser/node.c",
    "content": "/* Parse tree node implementation */\n\n#include \"Python.h\"\n#include \"../Include/node.h\"\n#include \"../Include/errcode.h\"\n\nnode *\nTa3Node_New(int type)\n{\n    node *n = (node *) PyObject_MALLOC(1 * sizeof(node));\n    if (n == NULL)\n        return NULL;\n    n->n_type = type;\n    n->n_str = NULL;\n    n->n_lineno = 0;\n    n->n_nchildren = 0;\n    n->n_child = NULL;\n    return n;\n}\n\n/* See comments at XXXROUNDUP below.  Returns -1 on overflow. */\nstatic int\nfancy_roundup(int n)\n{\n    /* Round up to the closest power of 2 >= n. */\n    int result = 256;\n    assert(n > 128);\n    while (result < n) {\n        result <<= 1;\n        if (result <= 0)\n            return -1;\n    }\n    return result;\n}\n\n/* A gimmick to make massive numbers of reallocs quicker.  The result is\n * a number >= the input.  In Ta3Node_AddChild, it's used like so, when\n * we're about to add child number current_size + 1:\n *\n *     if XXXROUNDUP(current_size) < XXXROUNDUP(current_size + 1):\n *         allocate space for XXXROUNDUP(current_size + 1) total children\n *     else:\n *         we already have enough space\n *\n * Since a node starts out empty, we must have\n *\n *     XXXROUNDUP(0) < XXXROUNDUP(1)\n *\n * so that we allocate space for the first child.  One-child nodes are very\n * common (presumably that would change if we used a more abstract form\n * of syntax tree), so to avoid wasting memory it's desirable that\n * XXXROUNDUP(1) == 1.  That in turn forces XXXROUNDUP(0) == 0.\n *\n * Else for 2 <= n <= 128, we round up to the closest multiple of 4.  Why 4?\n * Rounding up to a multiple of an exact power of 2 is very efficient, and\n * most nodes with more than one child have <= 4 kids.\n *\n * Else we call fancy_roundup() to grow proportionately to n.  We've got an\n * extreme case then (like test_longexp.py), and on many platforms doing\n * anything less than proportional growth leads to exorbitant runtime\n * (e.g., MacPython), or extreme fragmentation of user address space (e.g.,\n * Win98).\n *\n * In a run of compileall across the 2.3a0 Lib directory, Andrew MacIntyre\n * reported that, with this scheme, 89% of PyObject_REALLOC calls in\n * Ta3Node_AddChild passed 1 for the size, and 9% passed 4.  So this usually\n * wastes very little memory, but is very effective at sidestepping\n * platform-realloc disasters on vulnerable platforms.\n *\n * Note that this would be straightforward if a node stored its current\n * capacity.  The code is tricky to avoid that.\n */\n#define XXXROUNDUP(n) ((n) <= 1 ? (n) :                         \\\n               (n) <= 128 ? (int)_Py_SIZE_ROUND_UP((n), 4) :    \\\n               fancy_roundup(n))\n\n\nint\nTa3Node_AddChild(node *n1, int type, char *str, int lineno, int col_offset)\n{\n    const int nch = n1->n_nchildren;\n    int current_capacity;\n    int required_capacity;\n    node *n;\n\n    if (nch == INT_MAX || nch < 0)\n        return E_OVERFLOW;\n\n    current_capacity = XXXROUNDUP(nch);\n    required_capacity = XXXROUNDUP(nch + 1);\n    if (current_capacity < 0 || required_capacity < 0)\n        return E_OVERFLOW;\n    if (current_capacity < required_capacity) {\n        if ((size_t)required_capacity > SIZE_MAX / sizeof(node)) {\n            return E_NOMEM;\n        }\n        n = n1->n_child;\n        n = (node *) PyObject_REALLOC(n,\n                                      required_capacity * sizeof(node));\n        if (n == NULL)\n            return E_NOMEM;\n        n1->n_child = n;\n    }\n\n    n = &n1->n_child[n1->n_nchildren++];\n    n->n_type = type;\n    n->n_str = str;\n    n->n_lineno = lineno;\n    n->n_col_offset = col_offset;\n    n->n_nchildren = 0;\n    n->n_child = NULL;\n    return 0;\n}\n\n/* Forward */\nstatic void freechildren(node *);\nstatic Py_ssize_t sizeofchildren(node *n);\n\n\nvoid\nTa3Node_Free(node *n)\n{\n    if (n != NULL) {\n        freechildren(n);\n        PyObject_FREE(n);\n    }\n}\n\nPy_ssize_t\n_Ta3Node_SizeOf(node *n)\n{\n    Py_ssize_t res = 0;\n\n    if (n != NULL)\n        res = sizeof(node) + sizeofchildren(n);\n    return res;\n}\n\nstatic void\nfreechildren(node *n)\n{\n    int i;\n    for (i = NCH(n); --i >= 0; )\n        freechildren(CHILD(n, i));\n    if (n->n_child != NULL)\n        PyObject_FREE(n->n_child);\n    if (STR(n) != NULL)\n        PyObject_FREE(STR(n));\n}\n\nstatic Py_ssize_t\nsizeofchildren(node *n)\n{\n    Py_ssize_t res = 0;\n    int i;\n    for (i = NCH(n); --i >= 0; )\n        res += sizeofchildren(CHILD(n, i));\n    if (n->n_child != NULL)\n        /* allocated size of n->n_child array */\n        res += XXXROUNDUP(NCH(n)) * sizeof(node);\n    if (STR(n) != NULL)\n        res += strlen(STR(n)) + 1;\n    return res;\n}\n"
  },
  {
    "path": "ast3/Parser/parser.c",
    "content": "\n/* Parser implementation */\n\n/* For a description, see the comments at end of this file */\n\n/* XXX To do: error recovery */\n\n#include \"Python.h\"\n#include \"../Include/pgenheaders.h\"\n#include \"../Include/token.h\"\n#include \"../Include/grammar.h\"\n#include \"../Include/node.h\"\n#include \"parser.h\"\n#include \"../Include/errcode.h\"\n\n\n#ifdef Py_DEBUG\nPyAPI_DATA(int) Py_DebugFlag;\n#define D(x) if (!Py_DebugFlag); else x\n#else\n#define D(x)\n#endif\n\n\n/* STACK DATA TYPE */\n\nstatic void s_reset(stack *);\n\nstatic void\ns_reset(stack *s)\n{\n    s->s_top = &s->s_base[MAXSTACK];\n}\n\n#define s_empty(s) ((s)->s_top == &(s)->s_base[MAXSTACK])\n\nstatic int\ns_push(stack *s, dfa *d, node *parent)\n{\n    stackentry *top;\n    if (s->s_top == s->s_base) {\n        fprintf(stderr, \"s_push: parser stack overflow\\n\");\n        return E_NOMEM;\n    }\n    top = --s->s_top;\n    top->s_dfa = d;\n    top->s_parent = parent;\n    top->s_state = 0;\n    return 0;\n}\n\n#ifdef Py_DEBUG\n\nstatic void\ns_pop(stack *s)\n{\n    if (s_empty(s))\n        Py_FatalError(\"s_pop: parser stack underflow -- FATAL\");\n    s->s_top++;\n}\n\n#else /* !Py_DEBUG */\n\n#define s_pop(s) (s)->s_top++\n\n#endif\n\n\n/* PARSER CREATION */\n\nparser_state *\nTa3Parser_New(grammar *g, int start)\n{\n    parser_state *ps;\n\n    if (!g->g_accel)\n        Ta3Grammar_AddAccelerators(g);\n    ps = (parser_state *)PyMem_MALLOC(sizeof(parser_state));\n    if (ps == NULL)\n        return NULL;\n    ps->p_grammar = g;\n#ifdef PY_PARSER_REQUIRES_FUTURE_KEYWORD\n    ps->p_flags = 0;\n#endif\n    ps->p_tree = Ta3Node_New(start);\n    if (ps->p_tree == NULL) {\n        PyMem_FREE(ps);\n        return NULL;\n    }\n    s_reset(&ps->p_stack);\n    (void) s_push(&ps->p_stack, Ta3Grammar_FindDFA(g, start), ps->p_tree);\n    return ps;\n}\n\nvoid\nTa3Parser_Delete(parser_state *ps)\n{\n    /* NB If you want to save the parse tree,\n       you must set p_tree to NULL before calling delparser! */\n    Ta3Node_Free(ps->p_tree);\n    PyMem_FREE(ps);\n}\n\n\n/* PARSER STACK OPERATIONS */\n\nstatic int\nshift(stack *s, int type, char *str, int newstate, int lineno, int col_offset)\n{\n    int err;\n    assert(!s_empty(s));\n    err = Ta3Node_AddChild(s->s_top->s_parent, type, str, lineno, col_offset);\n    if (err)\n        return err;\n    s->s_top->s_state = newstate;\n    return 0;\n}\n\nstatic int\npush(stack *s, int type, dfa *d, int newstate, int lineno, int col_offset)\n{\n    int err;\n    node *n;\n    n = s->s_top->s_parent;\n    assert(!s_empty(s));\n    err = Ta3Node_AddChild(n, type, (char *)NULL, lineno, col_offset);\n    if (err)\n        return err;\n    s->s_top->s_state = newstate;\n    return s_push(s, d, CHILD(n, NCH(n)-1));\n}\n\n\n/* PARSER PROPER */\n\nstatic int\nclassify(parser_state *ps, int type, const char *str)\n{\n    grammar *g = ps->p_grammar;\n    int n = g->g_ll.ll_nlabels;\n\n    if (type == NAME) {\n        label *l = g->g_ll.ll_label;\n        int i;\n        for (i = n; i > 0; i--, l++) {\n            if (l->lb_type != NAME || l->lb_str == NULL ||\n                l->lb_str[0] != str[0] ||\n                strcmp(l->lb_str, str) != 0)\n                continue;\n#ifdef PY_PARSER_REQUIRES_FUTURE_KEYWORD\n#if 0\n            /* Leaving this in as an example */\n            if (!(ps->p_flags & CO_FUTURE_WITH_STATEMENT)) {\n                if (str[0] == 'w' && strcmp(str, \"with\") == 0)\n                    break; /* not a keyword yet */\n                else if (str[0] == 'a' && strcmp(str, \"as\") == 0)\n                    break; /* not a keyword yet */\n            }\n#endif\n#endif\n            D(printf(\"It's a keyword\\n\"));\n            return n - i;\n        }\n    }\n\n    {\n        label *l = g->g_ll.ll_label;\n        int i;\n        for (i = n; i > 0; i--, l++) {\n            if (l->lb_type == type && l->lb_str == NULL) {\n                D(printf(\"It's a token we know\\n\"));\n                return n - i;\n            }\n        }\n    }\n\n    D(printf(\"Illegal token\\n\"));\n    return -1;\n}\n\n#ifdef PY_PARSER_REQUIRES_FUTURE_KEYWORD\n#if 0\n/* Leaving this in as an example */\nstatic void\nfuture_hack(parser_state *ps)\n{\n    node *n = ps->p_stack.s_top->s_parent;\n    node *ch, *cch;\n    int i;\n\n    /* from __future__ import ..., must have at least 4 children */\n    n = CHILD(n, 0);\n    if (NCH(n) < 4)\n        return;\n    ch = CHILD(n, 0);\n    if (STR(ch) == NULL || strcmp(STR(ch), \"from\") != 0)\n        return;\n    ch = CHILD(n, 1);\n    if (NCH(ch) == 1 && STR(CHILD(ch, 0)) &&\n        strcmp(STR(CHILD(ch, 0)), \"__future__\") != 0)\n        return;\n    ch = CHILD(n, 3);\n    /* ch can be a star, a parenthesis or import_as_names */\n    if (TYPE(ch) == STAR)\n        return;\n    if (TYPE(ch) == LPAR)\n        ch = CHILD(n, 4);\n\n    for (i = 0; i < NCH(ch); i += 2) {\n        cch = CHILD(ch, i);\n        if (NCH(cch) >= 1 && TYPE(CHILD(cch, 0)) == NAME) {\n            char *str_ch = STR(CHILD(cch, 0));\n            if (strcmp(str_ch, FUTURE_WITH_STATEMENT) == 0) {\n                ps->p_flags |= CO_FUTURE_WITH_STATEMENT;\n            } else if (strcmp(str_ch, FUTURE_PRINT_FUNCTION) == 0) {\n                ps->p_flags |= CO_FUTURE_PRINT_FUNCTION;\n            } else if (strcmp(str_ch, FUTURE_UNICODE_LITERALS) == 0) {\n                ps->p_flags |= CO_FUTURE_UNICODE_LITERALS;\n            }\n        }\n    }\n}\n#endif\n#endif /* future keyword */\n\nint\nTa3Parser_AddToken(parser_state *ps, int type, char *str,\n                  int lineno, int col_offset, int *expected_ret)\n{\n    int ilabel;\n    int err;\n\n    D(printf(\"Token %s/'%s' ... \", _Ta3Parser_TokenNames[type], str));\n\n    /* Find out which label this token is */\n    ilabel = classify(ps, type, str);\n    if (ilabel < 0)\n        return E_SYNTAX;\n\n    /* Loop until the token is shifted or an error occurred */\n    for (;;) {\n        /* Fetch the current dfa and state */\n        dfa *d = ps->p_stack.s_top->s_dfa;\n        state *s = &d->d_state[ps->p_stack.s_top->s_state];\n\n        D(printf(\" DFA '%s', state %d:\",\n            d->d_name, ps->p_stack.s_top->s_state));\n\n        /* Check accelerator */\n        if (s->s_lower <= ilabel && ilabel < s->s_upper) {\n            int x = s->s_accel[ilabel - s->s_lower];\n            if (x != -1) {\n                if (x & (1<<7)) {\n                    /* Push non-terminal */\n                    int nt = (x >> 8) + NT_OFFSET;\n                    int arrow = x & ((1<<7)-1);\n                    dfa *d1 = Ta3Grammar_FindDFA(\n                        ps->p_grammar, nt);\n                    if ((err = push(&ps->p_stack, nt, d1,\n                        arrow, lineno, col_offset)) > 0) {\n                        D(printf(\" MemError: push\\n\"));\n                        return err;\n                    }\n                    D(printf(\" Push ...\\n\"));\n                    continue;\n                }\n\n                /* Shift the token */\n                if ((err = shift(&ps->p_stack, type, str,\n                                x, lineno, col_offset)) > 0) {\n                    D(printf(\" MemError: shift.\\n\"));\n                    return err;\n                }\n                D(printf(\" Shift.\\n\"));\n                /* Pop while we are in an accept-only state */\n                while (s = &d->d_state\n                                [ps->p_stack.s_top->s_state],\n                    s->s_accept && s->s_narcs == 1) {\n                    D(printf(\"  DFA '%s', state %d: \"\n                             \"Direct pop.\\n\",\n                             d->d_name,\n                             ps->p_stack.s_top->s_state));\n#ifdef PY_PARSER_REQUIRES_FUTURE_KEYWORD\n#if 0\n                    if (d->d_name[0] == 'i' &&\n                        strcmp(d->d_name,\n                           \"import_stmt\") == 0)\n                        future_hack(ps);\n#endif\n#endif\n                    s_pop(&ps->p_stack);\n                    if (s_empty(&ps->p_stack)) {\n                        D(printf(\"  ACCEPT.\\n\"));\n                        return E_DONE;\n                    }\n                    d = ps->p_stack.s_top->s_dfa;\n                }\n                return E_OK;\n            }\n        }\n\n        if (s->s_accept) {\n#ifdef PY_PARSER_REQUIRES_FUTURE_KEYWORD\n#if 0\n            if (d->d_name[0] == 'i' &&\n                strcmp(d->d_name, \"import_stmt\") == 0)\n                future_hack(ps);\n#endif\n#endif\n            /* Pop this dfa and try again */\n            s_pop(&ps->p_stack);\n            D(printf(\" Pop ...\\n\"));\n            if (s_empty(&ps->p_stack)) {\n                D(printf(\" Error: bottom of stack.\\n\"));\n                return E_SYNTAX;\n            }\n            continue;\n        }\n\n        /* Stuck, report syntax error */\n        D(printf(\" Error.\\n\"));\n        if (expected_ret) {\n            if (s->s_lower == s->s_upper - 1) {\n                /* Only one possible expected token */\n                *expected_ret = ps->p_grammar->\n                    g_ll.ll_label[s->s_lower].lb_type;\n            }\n            else\n                *expected_ret = -1;\n        }\n        return E_SYNTAX;\n    }\n}\n\n\n#ifdef Py_DEBUG\n\n/* DEBUG OUTPUT */\n\nvoid\ndumptree(grammar *g, node *n)\n{\n    int i;\n\n    if (n == NULL)\n        printf(\"NIL\");\n    else {\n        label l;\n        l.lb_type = TYPE(n);\n        l.lb_str = STR(n);\n        printf(\"%s\", Ta3Grammar_LabelRepr(&l));\n        if (ISNONTERMINAL(TYPE(n))) {\n            printf(\"(\");\n            for (i = 0; i < NCH(n); i++) {\n                if (i > 0)\n                    printf(\",\");\n                dumptree(g, CHILD(n, i));\n            }\n            printf(\")\");\n        }\n    }\n}\n\nvoid\nshowtree(grammar *g, node *n)\n{\n    int i;\n\n    if (n == NULL)\n        return;\n    if (ISNONTERMINAL(TYPE(n))) {\n        for (i = 0; i < NCH(n); i++)\n            showtree(g, CHILD(n, i));\n    }\n    else if (ISTERMINAL(TYPE(n))) {\n        printf(\"%s\", _Ta3Parser_TokenNames[TYPE(n)]);\n        if (TYPE(n) == NUMBER || TYPE(n) == NAME)\n            printf(\"(%s)\", STR(n));\n        printf(\" \");\n    }\n    else\n        printf(\"? \");\n}\n\n#endif /* Py_DEBUG */\n\n/*\n\nDescription\n-----------\n\nThe parser's interface is different than usual: the function addtoken()\nmust be called for each token in the input.  This makes it possible to\nturn it into an incremental parsing system later.  The parsing system\nconstructs a parse tree as it goes.\n\nA parsing rule is represented as a Deterministic Finite-state Automaton\n(DFA).  A node in a DFA represents a state of the parser; an arc represents\na transition.  Transitions are either labeled with terminal symbols or\nwith non-terminals.  When the parser decides to follow an arc labeled\nwith a non-terminal, it is invoked recursively with the DFA representing\nthe parsing rule for that as its initial state; when that DFA accepts,\nthe parser that invoked it continues.  The parse tree constructed by the\nrecursively called parser is inserted as a child in the current parse tree.\n\nThe DFA's can be constructed automatically from a more conventional\nlanguage description.  An extended LL(1) grammar (ELL(1)) is suitable.\nCertain restrictions make the parser's life easier: rules that can produce\nthe empty string should be outlawed (there are other ways to put loops\nor optional parts in the language).  To avoid the need to construct\nFIRST sets, we can require that all but the last alternative of a rule\n(really: arc going out of a DFA's state) must begin with a terminal\nsymbol.\n\nAs an example, consider this grammar:\n\nexpr:   term (OP term)*\nterm:   CONSTANT | '(' expr ')'\n\nThe DFA corresponding to the rule for expr is:\n\n------->.---term-->.------->\n    ^          |\n    |          |\n    \\----OP----/\n\nThe parse tree generated for the input a+b is:\n\n(expr: (term: (NAME: a)), (OP: +), (term: (NAME: b)))\n\n*/\n"
  },
  {
    "path": "ast3/Parser/parser.h",
    "content": "#ifndef Ta3_PARSER_H\n#define Ta3_PARSER_H\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n\n/* Parser interface */\n\n#define MAXSTACK 1500\n\ntypedef struct {\n    int              s_state;       /* State in current DFA */\n    dfa             *s_dfa;         /* Current DFA */\n    struct _node    *s_parent;      /* Where to add next node */\n} stackentry;\n\ntypedef struct {\n    stackentry      *s_top;         /* Top entry */\n    stackentry       s_base[MAXSTACK];/* Array of stack entries */\n                                    /* NB The stack grows down */\n} stack;\n\ntypedef struct {\n    stack           p_stack;        /* Stack of parser states */\n    grammar         *p_grammar;     /* Grammar to use */\n    node            *p_tree;        /* Top of parse tree */\n#ifdef PY_PARSER_REQUIRES_FUTURE_KEYWORD\n    unsigned long   p_flags;        /* see co_flags in Include/code.h */\n#endif\n} parser_state;\n\nparser_state *Ta3Parser_New(grammar *g, int start);\nvoid Ta3Parser_Delete(parser_state *ps);\nint Ta3Parser_AddToken(parser_state *ps, int type, char *str, int lineno, int col_offset,\n                      int *expected_ret);\nvoid Ta3Grammar_AddAccelerators(grammar *g);\n\n#ifdef __cplusplus\n}\n#endif\n#endif /* !Ta3_PARSER_H */\n"
  },
  {
    "path": "ast3/Parser/parsetok.c",
    "content": "\n/* Parser-tokenizer link implementation */\n\n#include \"../Include/pgenheaders.h\"\n#include \"tokenizer.h\"\n#include \"../Include/node.h\"\n#include \"../Include/grammar.h\"\n#include \"parser.h\"\n#include \"../Include/parsetok.h\"\n#include \"../Include/errcode.h\"\n#include \"../Include/graminit.h\"\n\n\n/* Forward */\nstatic node *parsetok(struct tok_state *, grammar *, int, perrdetail *, int *);\nstatic int initerr(perrdetail *err_ret, PyObject * filename);\n\n/* Parse input coming from a string.  Return error code, print some errors. */\nnode *\nTa3Parser_ParseString(const char *s, grammar *g, int start, perrdetail *err_ret)\n{\n    return Ta3Parser_ParseStringFlagsFilename(s, NULL, g, start, err_ret, 0);\n}\n\nnode *\nTa3Parser_ParseStringFlags(const char *s, grammar *g, int start,\n                          perrdetail *err_ret, int flags)\n{\n    return Ta3Parser_ParseStringFlagsFilename(s, NULL,\n                                             g, start, err_ret, flags);\n}\n\nnode *\nTa3Parser_ParseStringFlagsFilename(const char *s, const char *filename,\n                          grammar *g, int start,\n                          perrdetail *err_ret, int flags)\n{\n    int iflags = flags;\n    return Ta3Parser_ParseStringFlagsFilenameEx(s, filename, g, start,\n                                               err_ret, &iflags);\n}\n\nnode *\nTa3Parser_ParseStringObject(const char *s, PyObject *filename,\n                           grammar *g, int start,\n                           perrdetail *err_ret, int *flags)\n{\n    struct tok_state *tok;\n    int exec_input = start == file_input;\n\n    if (initerr(err_ret, filename) < 0)\n        return NULL;\n\n    if (*flags & PyPARSE_IGNORE_COOKIE)\n        tok = Ta3Tokenizer_FromUTF8(s, exec_input);\n    else\n        tok = Ta3Tokenizer_FromString(s, exec_input);\n    if (tok == NULL) {\n        err_ret->error = PyErr_Occurred() ? E_DECODE : E_NOMEM;\n        return NULL;\n    }\n\n#ifndef PGEN\n    Py_INCREF(err_ret->filename);\n    tok->filename = err_ret->filename;\n#endif\n    if (*flags & PyPARSE_ASYNC_ALWAYS)\n        tok->async_always = 1;\n    return parsetok(tok, g, start, err_ret, flags);\n}\n\nnode *\nTa3Parser_ParseStringFlagsFilenameEx(const char *s, const char *filename_str,\n                          grammar *g, int start,\n                          perrdetail *err_ret, int *flags)\n{\n    node *n;\n    PyObject *filename = NULL;\n#ifndef PGEN\n    if (filename_str != NULL) {\n        filename = PyUnicode_DecodeFSDefault(filename_str);\n        if (filename == NULL) {\n            err_ret->error = E_ERROR;\n            return NULL;\n        }\n    }\n#endif\n    n = Ta3Parser_ParseStringObject(s, filename, g, start, err_ret, flags);\n#ifndef PGEN\n    Py_XDECREF(filename);\n#endif\n    return n;\n}\n\n/* Parse input coming from a file.  Return error code, print some errors. */\n\nnode *\nTa3Parser_ParseFile(FILE *fp, const char *filename, grammar *g, int start,\n                   const char *ps1, const char *ps2,\n                   perrdetail *err_ret)\n{\n    return Ta3Parser_ParseFileFlags(fp, filename, NULL,\n                                   g, start, ps1, ps2, err_ret, 0);\n}\n\nnode *\nTa3Parser_ParseFileFlags(FILE *fp, const char *filename, const char *enc,\n                        grammar *g, int start,\n                        const char *ps1, const char *ps2,\n                        perrdetail *err_ret, int flags)\n{\n    int iflags = flags;\n    return Ta3Parser_ParseFileFlagsEx(fp, filename, enc, g, start, ps1,\n                                     ps2, err_ret, &iflags);\n}\n\nnode *\nTa3Parser_ParseFileObject(FILE *fp, PyObject *filename,\n                         const char *enc, grammar *g, int start,\n                         const char *ps1, const char *ps2,\n                         perrdetail *err_ret, int *flags)\n{\n    struct tok_state *tok;\n\n    if (initerr(err_ret, filename) < 0)\n        return NULL;\n\n    if ((tok = Ta3Tokenizer_FromFile(fp, enc, ps1, ps2)) == NULL) {\n        err_ret->error = E_NOMEM;\n        return NULL;\n    }\n#ifndef PGEN\n    Py_INCREF(err_ret->filename);\n    tok->filename = err_ret->filename;\n#endif\n    return parsetok(tok, g, start, err_ret, flags);\n}\n\nnode *\nTa3Parser_ParseFileFlagsEx(FILE *fp, const char *filename,\n                          const char *enc, grammar *g, int start,\n                          const char *ps1, const char *ps2,\n                          perrdetail *err_ret, int *flags)\n{\n    node *n;\n    PyObject *fileobj = NULL;\n#ifndef PGEN\n    if (filename != NULL) {\n        fileobj = PyUnicode_DecodeFSDefault(filename);\n        if (fileobj == NULL) {\n            err_ret->error = E_ERROR;\n            return NULL;\n        }\n    }\n#endif\n    n = Ta3Parser_ParseFileObject(fp, fileobj, enc, g,\n                                 start, ps1, ps2, err_ret, flags);\n#ifndef PGEN\n    Py_XDECREF(fileobj);\n#endif\n    return n;\n}\n\n#ifdef PY_PARSER_REQUIRES_FUTURE_KEYWORD\n#if 0\nstatic const char with_msg[] =\n\"%s:%d: Warning: 'with' will become a reserved keyword in Python 2.6\\n\";\n\nstatic const char as_msg[] =\n\"%s:%d: Warning: 'as' will become a reserved keyword in Python 2.6\\n\";\n\nstatic void\nwarn(const char *msg, const char *filename, int lineno)\n{\n    if (filename == NULL)\n        filename = \"<string>\";\n    PySys_WriteStderr(msg, filename, lineno);\n}\n#endif\n#endif\n\ntypedef struct {\n    struct {\n        int lineno;\n        char *comment;\n    } *items;\n    size_t size;\n    size_t num_items;\n} growable_comment_array;\n\nstatic int\ngrowable_comment_array_init(growable_comment_array *arr, size_t initial_size) {\n    assert(initial_size > 0);\n    arr->items = malloc(initial_size * sizeof(*arr->items));\n    arr->size = initial_size;\n    arr->num_items = 0;\n\n    return arr->items != NULL;\n}\n\nstatic int\ngrowable_comment_array_add(growable_comment_array *arr, int lineno, char *comment) {\n    if (arr->num_items >= arr->size) {\n        arr->size *= 2;\n        arr->items = realloc(arr->items, arr->size * sizeof(*arr->items));\n        if (!arr->items) {\n            return 0;\n        }\n    }\n\n    arr->items[arr->num_items].lineno = lineno;\n    arr->items[arr->num_items].comment = comment;\n    arr->num_items++;\n    return 1;\n}\n\nstatic void\ngrowable_comment_array_deallocate(growable_comment_array *arr) {\n    unsigned i;\n    for (i = 0; i < arr->num_items; i++) {\n        PyObject_FREE(arr->items[i].comment);\n    }\n    free(arr->items);\n}\n\n/* Parse input coming from the given tokenizer structure.\n   Return error code. */\n\nstatic node *\nparsetok(struct tok_state *tok, grammar *g, int start, perrdetail *err_ret,\n         int *flags)\n{\n    parser_state *ps;\n    node *n;\n    int started = 0;\n\n    growable_comment_array type_ignores;\n    if (!growable_comment_array_init(&type_ignores, 10)) {\n        err_ret->error = E_NOMEM;\n        Ta3Tokenizer_Free(tok);\n        return NULL;\n    }\n\n    if ((ps = Ta3Parser_New(g, start)) == NULL) {\n        err_ret->error = E_NOMEM;\n        Ta3Tokenizer_Free(tok);\n        return NULL;\n    }\n#ifdef PY_PARSER_REQUIRES_FUTURE_KEYWORD\n    if (*flags & PyPARSE_BARRY_AS_BDFL)\n        ps->p_flags |= CO_FUTURE_BARRY_AS_BDFL;\n#endif\n\n    for (;;) {\n        char *a, *b;\n        int type;\n        size_t len;\n        char *str;\n        int col_offset;\n\n        type = Ta3Tokenizer_Get(tok, &a, &b);\n        if (type == ERRORTOKEN) {\n            err_ret->error = tok->done;\n            break;\n        }\n        if (type == ENDMARKER && started) {\n            type = NEWLINE; /* Add an extra newline */\n            started = 0;\n            /* Add the right number of dedent tokens,\n               except if a certain flag is given --\n               codeop.py uses this. */\n            if (tok->indent &&\n                !(*flags & PyPARSE_DONT_IMPLY_DEDENT))\n            {\n                tok->pendin = -tok->indent;\n                tok->indent = 0;\n            }\n        }\n        else\n            started = 1;\n        len = (a != NULL && b != NULL) ? b - a : 0;\n        str = (char *) PyObject_MALLOC(len + 1);\n        if (str == NULL) {\n            err_ret->error = E_NOMEM;\n            break;\n        }\n        if (len > 0)\n            strncpy(str, a, len);\n        str[len] = '\\0';\n\n#ifdef PY_PARSER_REQUIRES_FUTURE_KEYWORD\n        if (type == NOTEQUAL) {\n            if (!(ps->p_flags & CO_FUTURE_BARRY_AS_BDFL) &&\n                            strcmp(str, \"!=\")) {\n                PyObject_FREE(str);\n                err_ret->error = E_SYNTAX;\n                break;\n            }\n            else if ((ps->p_flags & CO_FUTURE_BARRY_AS_BDFL) &&\n                            strcmp(str, \"<>\")) {\n                PyObject_FREE(str);\n                err_ret->expected = NOTEQUAL;\n                err_ret->error = E_SYNTAX;\n                break;\n            }\n        }\n#endif\n        if (a != NULL && a >= tok->line_start) {\n            col_offset = Py_SAFE_DOWNCAST(a - tok->line_start,\n                                          intptr_t, int);\n        }\n        else {\n            col_offset = -1;\n        }\n\n        if (type == TYPE_IGNORE) {\n            if (!growable_comment_array_add(&type_ignores, tok->lineno, str)) {\n                err_ret->error = E_NOMEM;\n                break;\n            }\n            continue;\n        }\n\n        if ((err_ret->error =\n             Ta3Parser_AddToken(ps, (int)type, str,\n                               tok->lineno, col_offset,\n                               &(err_ret->expected))) != E_OK) {\n            if (err_ret->error != E_DONE) {\n                PyObject_FREE(str);\n                err_ret->token = type;\n            }\n            break;\n        }\n    }\n\n    if (err_ret->error == E_DONE) {\n        n = ps->p_tree;\n        ps->p_tree = NULL;\n\n        if (n->n_type == file_input) {\n            /* Put type_ignore nodes in the ENDMARKER of file_input. */\n            int num;\n            node *ch;\n            size_t i;\n\n            num = NCH(n);\n            ch = CHILD(n, num - 1);\n            REQ(ch, ENDMARKER);\n\n            for (i = 0; i < type_ignores.num_items; i++) {\n                int res = Ta3Node_AddChild(ch, TYPE_IGNORE, type_ignores.items[i].comment,\n                                           type_ignores.items[i].lineno, 0);\n                if (res != 0) {\n                    err_ret->error = res;\n                    Ta3Node_Free(n);\n                    n = NULL;\n                    break;\n                }\n                type_ignores.items[i].comment = NULL;\n            }\n        }\n\n#ifndef PGEN\n        /* Check that the source for a single input statement really\n           is a single statement by looking at what is left in the\n           buffer after parsing.  Trailing whitespace and comments\n           are OK.  */\n        if (err_ret->error == E_DONE && start == single_input) {\n            char *cur = tok->cur;\n            char c = *tok->cur;\n\n            for (;;) {\n                while (c == ' ' || c == '\\t' || c == '\\n' || c == '\\014')\n                    c = *++cur;\n\n                if (!c)\n                    break;\n\n                if (c != '#') {\n                    err_ret->error = E_BADSINGLE;\n                    Ta3Node_Free(n);\n                    n = NULL;\n                    break;\n                }\n\n                /* Suck up comment. */\n                while (c && c != '\\n')\n                    c = *++cur;\n            }\n        }\n#endif\n    }\n    else\n        n = NULL;\n\n    growable_comment_array_deallocate(&type_ignores);\n\n#ifdef PY_PARSER_REQUIRES_FUTURE_KEYWORD\n    *flags = ps->p_flags;\n#endif\n    Ta3Parser_Delete(ps);\n\n    if (n == NULL) {\n        if (tok->done == E_EOF)\n            err_ret->error = E_EOF;\n        err_ret->lineno = tok->lineno;\n        if (tok->buf != NULL) {\n            size_t len;\n            assert(tok->cur - tok->buf < INT_MAX);\n            err_ret->offset = (int)(tok->cur - tok->buf);\n            len = tok->inp - tok->buf;\n            err_ret->text = (char *) PyObject_MALLOC(len + 1);\n            if (err_ret->text != NULL) {\n                if (len > 0)\n                    strncpy(err_ret->text, tok->buf, len);\n                err_ret->text[len] = '\\0';\n            }\n        }\n    } else if (tok->encoding != NULL) {\n        /* 'nodes->n_str' uses PyObject_*, while 'tok->encoding' was\n         * allocated using PyMem_\n         */\n        node* r = Ta3Node_New(encoding_decl);\n        if (r)\n            r->n_str = PyObject_MALLOC(strlen(tok->encoding)+1);\n        if (!r || !r->n_str) {\n            err_ret->error = E_NOMEM;\n            if (r)\n                PyObject_FREE(r);\n            n = NULL;\n            goto done;\n        }\n        strcpy(r->n_str, tok->encoding);\n        PyMem_FREE(tok->encoding);\n        tok->encoding = NULL;\n        r->n_nchildren = 1;\n        r->n_child = n;\n        n = r;\n    }\n\ndone:\n    Ta3Tokenizer_Free(tok);\n\n    return n;\n}\n\nstatic int\niniterr(perrdetail *err_ret, PyObject *filename)\n{\n    err_ret->error = E_OK;\n    err_ret->lineno = 0;\n    err_ret->offset = 0;\n    err_ret->text = NULL;\n    err_ret->token = -1;\n    err_ret->expected = -1;\n#ifndef PGEN\n    if (filename) {\n        Py_INCREF(filename);\n        err_ret->filename = filename;\n    }\n    else {\n        err_ret->filename = PyUnicode_FromString(\"<string>\");\n        if (err_ret->filename == NULL) {\n            err_ret->error = E_ERROR;\n            return -1;\n        }\n    }\n#endif\n    return 0;\n}\n"
  },
  {
    "path": "ast3/Parser/tokenizer.c",
    "content": "\n/* Tokenizer implementation */\n\n#include \"Python.h\"\n#include \"../Include/pgenheaders.h\"\n\n#include <ctype.h>\n#include <assert.h>\n\n#include \"tokenizer.h\"\n#include \"../Include/errcode.h\"\n\n#ifndef PGEN\n#include \"unicodeobject.h\"\n#include \"bytesobject.h\"\n#include \"fileobject.h\"\n#include \"codecs.h\"\n#include \"abstract.h\"\n#endif /* PGEN */\n\n#ifndef Py_XSETREF\n#define Py_XSETREF(op, op2)                     \\\n    do {                                        \\\n        PyObject *_py_tmp = (PyObject *)(op);   \\\n        (op) = (op2);                           \\\n        Py_XDECREF(_py_tmp);                    \\\n    } while (0)\n#endif /* Py_XSETREF */\n\n#ifndef _PyObject_CallNoArg\n#define _PyObject_CallNoArg(func) PyObject_CallObject(func, NULL)\n#endif\n\n/* Alternate tab spacing */\n#define ALTTABSIZE 1\n\n#define is_potential_identifier_start(c) (\\\n              (c >= 'a' && c <= 'z')\\\n               || (c >= 'A' && c <= 'Z')\\\n               || c == '_'\\\n               || (c >= 128))\n\n#define is_potential_identifier_char(c) (\\\n              (c >= 'a' && c <= 'z')\\\n               || (c >= 'A' && c <= 'Z')\\\n               || (c >= '0' && c <= '9')\\\n               || c == '_'\\\n               || (c >= 128))\n\nPyAPI_FUNC(char *) PyOS_Readline(FILE *, FILE *, const char *);\n/* Return malloc'ed string including trailing \\n;\n   empty malloc'ed string for EOF;\n   NULL if interrupted */\n\n/* Don't ever change this -- it would break the portability of Python code */\n#define TABSIZE 8\n\n/* Forward */\nstatic struct tok_state *tok_new(void);\nstatic int tok_nextc(struct tok_state *tok);\nstatic void tok_backup(struct tok_state *tok, int c);\n\n\n/* Token names */\n\nconst char *_Ta3Parser_TokenNames[] = {\n    \"ENDMARKER\",\n    \"NAME\",\n    \"NUMBER\",\n    \"STRING\",\n    \"NEWLINE\",\n    \"INDENT\",\n    \"DEDENT\",\n    \"LPAR\",\n    \"RPAR\",\n    \"LSQB\",\n    \"RSQB\",\n    \"COLON\",\n    \"COMMA\",\n    \"SEMI\",\n    \"PLUS\",\n    \"MINUS\",\n    \"STAR\",\n    \"SLASH\",\n    \"VBAR\",\n    \"AMPER\",\n    \"LESS\",\n    \"GREATER\",\n    \"EQUAL\",\n    \"DOT\",\n    \"PERCENT\",\n    \"LBRACE\",\n    \"RBRACE\",\n    \"EQEQUAL\",\n    \"NOTEQUAL\",\n    \"LESSEQUAL\",\n    \"GREATEREQUAL\",\n    \"TILDE\",\n    \"CIRCUMFLEX\",\n    \"LEFTSHIFT\",\n    \"RIGHTSHIFT\",\n    \"DOUBLESTAR\",\n    \"PLUSEQUAL\",\n    \"MINEQUAL\",\n    \"STAREQUAL\",\n    \"SLASHEQUAL\",\n    \"PERCENTEQUAL\",\n    \"AMPEREQUAL\",\n    \"VBAREQUAL\",\n    \"CIRCUMFLEXEQUAL\",\n    \"LEFTSHIFTEQUAL\",\n    \"RIGHTSHIFTEQUAL\",\n    \"DOUBLESTAREQUAL\",\n    \"DOUBLESLASH\",\n    \"DOUBLESLASHEQUAL\",\n    \"AT\",\n    \"ATEQUAL\",\n    \"RARROW\",\n    \"ELLIPSIS\",\n    /* This table must match the #defines in token.h! */\n    \"OP\",\n    \"AWAIT\",\n    \"ASYNC\",\n    \"TYPE_IGNORE\",\n    \"TYPE_COMMENT\",\n    \"<ERRORTOKEN>\",\n    \"COMMENT\",\n    \"NL\",\n    \"ENCODING\",\n    \"<N_TOKENS>\"\n};\n\n/* Spaces in this constant are treated as \"zero or more spaces or tabs\" when\n   tokenizing. */\nstatic const char* type_comment_prefix = \"# type: \";\n\n\n/* Create and initialize a new tok_state structure */\n\nstatic struct tok_state *\ntok_new(void)\n{\n    struct tok_state *tok = (struct tok_state *)PyMem_MALLOC(\n                                            sizeof(struct tok_state));\n    if (tok == NULL)\n        return NULL;\n    tok->buf = tok->cur = tok->end = tok->inp = tok->start = NULL;\n    tok->done = E_OK;\n    tok->fp = NULL;\n    tok->input = NULL;\n    tok->tabsize = TABSIZE;\n    tok->indent = 0;\n    tok->indstack[0] = 0;\n\n    tok->atbol = 1;\n    tok->pendin = 0;\n    tok->prompt = tok->nextprompt = NULL;\n    tok->lineno = 0;\n    tok->level = 0;\n    tok->altindstack[0] = 0;\n    tok->decoding_state = STATE_INIT;\n    tok->decoding_erred = 0;\n    tok->read_coding_spec = 0;\n    tok->enc = NULL;\n    tok->encoding = NULL;\n    tok->cont_line = 0;\n#ifndef PGEN\n    tok->filename = NULL;\n    tok->decoding_readline = NULL;\n    tok->decoding_buffer = NULL;\n#endif\n\n    tok->async_def = 0;\n    tok->async_def_indent = 0;\n    tok->async_def_nl = 0;\n    tok->async_always = 0;\n\n    return tok;\n}\n\nstatic char *\nnew_string(const char *s, Py_ssize_t len, struct tok_state *tok)\n{\n    char* result = (char *)PyMem_MALLOC(len + 1);\n    if (!result) {\n        tok->done = E_NOMEM;\n        return NULL;\n    }\n    memcpy(result, s, len);\n    result[len] = '\\0';\n    return result;\n}\n\n#ifdef PGEN\n\nstatic char *\ndecoding_fgets(char *s, int size, struct tok_state *tok)\n{\n    return fgets(s, size, tok->fp);\n}\n\nstatic int\ndecoding_feof(struct tok_state *tok)\n{\n    return feof(tok->fp);\n}\n\nstatic char *\ndecode_str(const char *str, int exec_input, struct tok_state *tok)\n{\n    return new_string(str, strlen(str), tok);\n}\n\n#else /* PGEN */\n\nstatic char *\nerror_ret(struct tok_state *tok) /* XXX */\n{\n    tok->decoding_erred = 1;\n    if (tok->fp != NULL && tok->buf != NULL) /* see Ta3Tokenizer_Free */\n        PyMem_FREE(tok->buf);\n    tok->buf = tok->cur = tok->end = tok->inp = tok->start = NULL;\n    tok->done = E_DECODE;\n    return NULL;                /* as if it were EOF */\n}\n\n\nstatic const char *\nget_normal_name(const char *s)  /* for utf-8 and latin-1 */\n{\n    char buf[13];\n    int i;\n    for (i = 0; i < 12; i++) {\n        int c = s[i];\n        if (c == '\\0')\n            break;\n        else if (c == '_')\n            buf[i] = '-';\n        else\n            buf[i] = tolower(c);\n    }\n    buf[i] = '\\0';\n    if (strcmp(buf, \"utf-8\") == 0 ||\n        strncmp(buf, \"utf-8-\", 6) == 0)\n        return \"utf-8\";\n    else if (strcmp(buf, \"latin-1\") == 0 ||\n             strcmp(buf, \"iso-8859-1\") == 0 ||\n             strcmp(buf, \"iso-latin-1\") == 0 ||\n             strncmp(buf, \"latin-1-\", 8) == 0 ||\n             strncmp(buf, \"iso-8859-1-\", 11) == 0 ||\n             strncmp(buf, \"iso-latin-1-\", 12) == 0)\n        return \"iso-8859-1\";\n    else\n        return s;\n}\n\n/* Return the coding spec in S, or NULL if none is found.  */\n\nstatic int\nget_coding_spec(const char *s, char **spec, Py_ssize_t size, struct tok_state *tok)\n{\n    Py_ssize_t i;\n    *spec = NULL;\n    /* Coding spec must be in a comment, and that comment must be\n     * the only statement on the source code line. */\n    for (i = 0; i < size - 6; i++) {\n        if (s[i] == '#')\n            break;\n        if (s[i] != ' ' && s[i] != '\\t' && s[i] != '\\014')\n            return 1;\n    }\n    for (; i < size - 6; i++) { /* XXX inefficient search */\n        const char* t = s + i;\n        if (strncmp(t, \"coding\", 6) == 0) {\n            const char* begin = NULL;\n            t += 6;\n            if (t[0] != ':' && t[0] != '=')\n                continue;\n            do {\n                t++;\n            } while (t[0] == '\\x20' || t[0] == '\\t');\n\n            begin = t;\n            while (Py_ISALNUM(t[0]) ||\n                   t[0] == '-' || t[0] == '_' || t[0] == '.')\n                t++;\n\n            if (begin < t) {\n                char* r = new_string(begin, t - begin, tok);\n                const char* q;\n                if (!r)\n                    return 0;\n                q = get_normal_name(r);\n                if (r != q) {\n                    PyMem_FREE(r);\n                    r = new_string(q, strlen(q), tok);\n                    if (!r)\n                        return 0;\n                }\n                *spec = r;\n                break;\n            }\n        }\n    }\n    return 1;\n}\n\n/* Check whether the line contains a coding spec. If it does,\n   invoke the set_readline function for the new encoding.\n   This function receives the tok_state and the new encoding.\n   Return 1 on success, 0 on failure.  */\n\nstatic int\ncheck_coding_spec(const char* line, Py_ssize_t size, struct tok_state *tok,\n                  int set_readline(struct tok_state *, const char *))\n{\n    char *cs;\n    int r = 1;\n\n    if (tok->cont_line) {\n        /* It's a continuation line, so it can't be a coding spec. */\n        tok->read_coding_spec = 1;\n        return 1;\n    }\n    if (!get_coding_spec(line, &cs, size, tok))\n        return 0;\n    if (!cs) {\n        Py_ssize_t i;\n        for (i = 0; i < size; i++) {\n            if (line[i] == '#' || line[i] == '\\n' || line[i] == '\\r')\n                break;\n            if (line[i] != ' ' && line[i] != '\\t' && line[i] != '\\014') {\n                /* Stop checking coding spec after a line containing\n                 * anything except a comment. */\n                tok->read_coding_spec = 1;\n                break;\n            }\n        }\n        return 1;\n    }\n    tok->read_coding_spec = 1;\n    if (tok->encoding == NULL) {\n        assert(tok->decoding_state == STATE_RAW);\n        if (strcmp(cs, \"utf-8\") == 0) {\n            tok->encoding = cs;\n        } else {\n            r = set_readline(tok, cs);\n            if (r) {\n                tok->encoding = cs;\n                tok->decoding_state = STATE_NORMAL;\n            }\n            else {\n                PyErr_Format(PyExc_SyntaxError,\n                             \"encoding problem: %s\", cs);\n                PyMem_FREE(cs);\n            }\n        }\n    } else {                /* then, compare cs with BOM */\n        r = (strcmp(tok->encoding, cs) == 0);\n        if (!r)\n            PyErr_Format(PyExc_SyntaxError,\n                         \"encoding problem: %s with BOM\", cs);\n        PyMem_FREE(cs);\n    }\n    return r;\n}\n\n/* See whether the file starts with a BOM. If it does,\n   invoke the set_readline function with the new encoding.\n   Return 1 on success, 0 on failure.  */\n\nstatic int\ncheck_bom(int get_char(struct tok_state *),\n          void unget_char(int, struct tok_state *),\n          int set_readline(struct tok_state *, const char *),\n          struct tok_state *tok)\n{\n    int ch1, ch2, ch3;\n    ch1 = get_char(tok);\n    tok->decoding_state = STATE_RAW;\n    if (ch1 == EOF) {\n        return 1;\n    } else if (ch1 == 0xEF) {\n        ch2 = get_char(tok);\n        if (ch2 != 0xBB) {\n            unget_char(ch2, tok);\n            unget_char(ch1, tok);\n            return 1;\n        }\n        ch3 = get_char(tok);\n        if (ch3 != 0xBF) {\n            unget_char(ch3, tok);\n            unget_char(ch2, tok);\n            unget_char(ch1, tok);\n            return 1;\n        }\n#if 0\n    /* Disable support for UTF-16 BOMs until a decision\n       is made whether this needs to be supported.  */\n    } else if (ch1 == 0xFE) {\n        ch2 = get_char(tok);\n        if (ch2 != 0xFF) {\n            unget_char(ch2, tok);\n            unget_char(ch1, tok);\n            return 1;\n        }\n        if (!set_readline(tok, \"utf-16-be\"))\n            return 0;\n        tok->decoding_state = STATE_NORMAL;\n    } else if (ch1 == 0xFF) {\n        ch2 = get_char(tok);\n        if (ch2 != 0xFE) {\n            unget_char(ch2, tok);\n            unget_char(ch1, tok);\n            return 1;\n        }\n        if (!set_readline(tok, \"utf-16-le\"))\n            return 0;\n        tok->decoding_state = STATE_NORMAL;\n#endif\n    } else {\n        unget_char(ch1, tok);\n        return 1;\n    }\n    if (tok->encoding != NULL)\n        PyMem_FREE(tok->encoding);\n    tok->encoding = new_string(\"utf-8\", 5, tok);\n    if (!tok->encoding)\n        return 0;\n    /* No need to set_readline: input is already utf-8 */\n    return 1;\n}\n\n/* Read a line of text from TOK into S, using the stream in TOK.\n   Return NULL on failure, else S.\n\n   On entry, tok->decoding_buffer will be one of:\n     1) NULL: need to call tok->decoding_readline to get a new line\n     2) PyUnicodeObject *: decoding_feof has called tok->decoding_readline and\n       stored the result in tok->decoding_buffer\n     3) PyByteArrayObject *: previous call to fp_readl did not have enough room\n       (in the s buffer) to copy entire contents of the line read\n       by tok->decoding_readline.  tok->decoding_buffer has the overflow.\n       In this case, fp_readl is called in a loop (with an expanded buffer)\n       until the buffer ends with a '\\n' (or until the end of the file is\n       reached): see tok_nextc and its calls to decoding_fgets.\n*/\n\nstatic char *\nfp_readl(char *s, int size, struct tok_state *tok)\n{\n    PyObject* bufobj;\n    const char *buf;\n    Py_ssize_t buflen;\n\n    /* Ask for one less byte so we can terminate it */\n    assert(size > 0);\n    size--;\n\n    if (tok->decoding_buffer) {\n        bufobj = tok->decoding_buffer;\n        Py_INCREF(bufobj);\n    }\n    else\n    {\n        bufobj = _PyObject_CallNoArg(tok->decoding_readline);\n        if (bufobj == NULL)\n            goto error;\n    }\n    if (PyUnicode_CheckExact(bufobj))\n    {\n        buf = PyUnicode_AsUTF8AndSize(bufobj, &buflen);\n        if (buf == NULL) {\n            goto error;\n        }\n    }\n    else\n    {\n        buf = PyByteArray_AsString(bufobj);\n        if (buf == NULL) {\n            goto error;\n        }\n        buflen = PyByteArray_GET_SIZE(bufobj);\n    }\n\n    Py_XDECREF(tok->decoding_buffer);\n    if (buflen > size) {\n        /* Too many chars, the rest goes into tok->decoding_buffer */\n        tok->decoding_buffer = PyByteArray_FromStringAndSize(buf+size,\n                                                         buflen-size);\n        if (tok->decoding_buffer == NULL)\n            goto error;\n        buflen = size;\n    }\n    else\n        tok->decoding_buffer = NULL;\n\n    memcpy(s, buf, buflen);\n    s[buflen] = '\\0';\n    if (buflen == 0) /* EOF */\n        s = NULL;\n    Py_DECREF(bufobj);\n    return s;\n\nerror:\n    Py_XDECREF(bufobj);\n    return error_ret(tok);\n}\n\n/* Set the readline function for TOK to a StreamReader's\n   readline function. The StreamReader is named ENC.\n\n   This function is called from check_bom and check_coding_spec.\n\n   ENC is usually identical to the future value of tok->encoding,\n   except for the (currently unsupported) case of UTF-16.\n\n   Return 1 on success, 0 on failure. */\n\nstatic int\nfp_setreadl(struct tok_state *tok, const char* enc)\n{\n    PyObject *readline, *io, *stream;\n    _Py_IDENTIFIER(open);\n    _Py_IDENTIFIER(readline);\n    int fd;\n    long pos;\n\n    fd = fileno(tok->fp);\n    /* Due to buffering the file offset for fd can be different from the file\n     * position of tok->fp.  If tok->fp was opened in text mode on Windows,\n     * its file position counts CRLF as one char and can't be directly mapped\n     * to the file offset for fd.  Instead we step back one byte and read to\n     * the end of line.*/\n    pos = ftell(tok->fp);\n    if (pos == -1 ||\n        lseek(fd, (off_t)(pos > 0 ? pos - 1 : pos), SEEK_SET) == (off_t)-1) {\n        PyErr_SetFromErrnoWithFilename(PyExc_OSError, NULL);\n        return 0;\n    }\n\n    io = PyImport_ImportModuleNoBlock(\"io\");\n    if (io == NULL)\n        return 0;\n\n    stream = _PyObject_CallMethodId(io, &PyId_open, \"isisOOO\",\n                    fd, \"r\", -1, enc, Py_None, Py_None, Py_False);\n    Py_DECREF(io);\n    if (stream == NULL)\n        return 0;\n\n    readline = _PyObject_GetAttrId(stream, &PyId_readline);\n    Py_DECREF(stream);\n    if (readline == NULL)\n        return 0;\n    Py_XSETREF(tok->decoding_readline, readline);\n\n    if (pos > 0) {\n        PyObject *bufobj = _PyObject_CallNoArg(readline);\n        if (bufobj == NULL)\n            return 0;\n        Py_DECREF(bufobj);\n    }\n\n    return 1;\n}\n\n/* Fetch the next byte from TOK. */\n\nstatic int fp_getc(struct tok_state *tok) {\n    return getc(tok->fp);\n}\n\n/* Unfetch the last byte back into TOK.  */\n\nstatic void fp_ungetc(int c, struct tok_state *tok) {\n    ungetc(c, tok->fp);\n}\n\n/* Check whether the characters at s start a valid\n   UTF-8 sequence. Return the number of characters forming\n   the sequence if yes, 0 if not.  */\nstatic int valid_utf8(const unsigned char* s)\n{\n    int expected = 0;\n    int length;\n    if (*s < 0x80)\n        /* single-byte code */\n        return 1;\n    if (*s < 0xc0)\n        /* following byte */\n        return 0;\n    if (*s < 0xE0)\n        expected = 1;\n    else if (*s < 0xF0)\n        expected = 2;\n    else if (*s < 0xF8)\n        expected = 3;\n    else\n        return 0;\n    length = expected + 1;\n    for (; expected; expected--)\n        if (s[expected] < 0x80 || s[expected] >= 0xC0)\n            return 0;\n    return length;\n}\n\n/* Read a line of input from TOK. Determine encoding\n   if necessary.  */\n\nstatic char *\ndecoding_fgets(char *s, int size, struct tok_state *tok)\n{\n    char *line = NULL;\n    int badchar = 0;\n    for (;;) {\n        if (tok->decoding_state == STATE_NORMAL) {\n            /* We already have a codec associated with\n               this input. */\n            line = fp_readl(s, size, tok);\n            break;\n        } else if (tok->decoding_state == STATE_RAW) {\n            /* We want a 'raw' read. */\n            line = Py_UniversalNewlineFgets(s, size,\n                                            tok->fp, NULL);\n            break;\n        } else {\n            /* We have not yet determined the encoding.\n               If an encoding is found, use the file-pointer\n               reader functions from now on. */\n            if (!check_bom(fp_getc, fp_ungetc, fp_setreadl, tok))\n                return error_ret(tok);\n            assert(tok->decoding_state != STATE_INIT);\n        }\n    }\n    if (line != NULL && tok->lineno < 2 && !tok->read_coding_spec) {\n        if (!check_coding_spec(line, strlen(line), tok, fp_setreadl)) {\n            return error_ret(tok);\n        }\n    }\n#ifndef PGEN\n    /* The default encoding is UTF-8, so make sure we don't have any\n       non-UTF-8 sequences in it. */\n    if (line && !tok->encoding) {\n        unsigned char *c;\n        int length;\n        for (c = (unsigned char *)line; *c; c += length)\n            if (!(length = valid_utf8(c))) {\n                badchar = *c;\n                break;\n            }\n    }\n    if (badchar) {\n        /* Need to add 1 to the line number, since this line\n           has not been counted, yet.  */\n        PyErr_Format(PyExc_SyntaxError,\n                \"Non-UTF-8 code starting with '\\\\x%.2x' \"\n                \"in file %U on line %i, \"\n                \"but no encoding declared; \"\n                \"see http://python.org/dev/peps/pep-0263/ for details\",\n                badchar, tok->filename, tok->lineno + 1);\n        return error_ret(tok);\n    }\n#endif\n    return line;\n}\n\nstatic int\ndecoding_feof(struct tok_state *tok)\n{\n    if (tok->decoding_state != STATE_NORMAL) {\n        return feof(tok->fp);\n    } else {\n        PyObject* buf = tok->decoding_buffer;\n        if (buf == NULL) {\n            buf = _PyObject_CallNoArg(tok->decoding_readline);\n            if (buf == NULL) {\n                error_ret(tok);\n                return 1;\n            } else {\n                tok->decoding_buffer = buf;\n            }\n        }\n        return PyObject_Length(buf) == 0;\n    }\n}\n\n/* Fetch a byte from TOK, using the string buffer. */\n\nstatic int\nbuf_getc(struct tok_state *tok) {\n    return Py_CHARMASK(*tok->str++);\n}\n\n/* Unfetch a byte from TOK, using the string buffer. */\n\nstatic void\nbuf_ungetc(int c, struct tok_state *tok) {\n    tok->str--;\n    assert(Py_CHARMASK(*tok->str) == c);        /* tok->cur may point to read-only segment */\n}\n\n/* Set the readline function for TOK to ENC. For the string-based\n   tokenizer, this means to just record the encoding. */\n\nstatic int\nbuf_setreadl(struct tok_state *tok, const char* enc) {\n    tok->enc = enc;\n    return 1;\n}\n\n/* Return a UTF-8 encoding Python string object from the\n   C byte string STR, which is encoded with ENC. */\n\nstatic PyObject *\ntranslate_into_utf8(const char* str, const char* enc) {\n    PyObject *utf8;\n    PyObject* buf = PyUnicode_Decode(str, strlen(str), enc, NULL);\n    if (buf == NULL)\n        return NULL;\n    utf8 = PyUnicode_AsUTF8String(buf);\n    Py_DECREF(buf);\n    return utf8;\n}\n\n\nstatic char *\ntranslate_newlines(const char *s, int exec_input, struct tok_state *tok) {\n    int skip_next_lf = 0;\n    size_t needed_length = strlen(s) + 2, final_length;\n    char *buf, *current;\n    char c = '\\0';\n    buf = PyMem_MALLOC(needed_length);\n    if (buf == NULL) {\n        tok->done = E_NOMEM;\n        return NULL;\n    }\n    for (current = buf; *s; s++, current++) {\n        c = *s;\n        if (skip_next_lf) {\n            skip_next_lf = 0;\n            if (c == '\\n') {\n                c = *++s;\n                if (!c)\n                    break;\n            }\n        }\n        if (c == '\\r') {\n            skip_next_lf = 1;\n            c = '\\n';\n        }\n        *current = c;\n    }\n    /* If this is exec input, add a newline to the end of the string if\n       there isn't one already. */\n    if (exec_input && c != '\\n') {\n        *current = '\\n';\n        current++;\n    }\n    *current = '\\0';\n    final_length = current - buf + 1;\n    if (final_length < needed_length && final_length)\n        /* should never fail */\n        buf = PyMem_REALLOC(buf, final_length);\n    return buf;\n}\n\n/* Decode a byte string STR for use as the buffer of TOK.\n   Look for encoding declarations inside STR, and record them\n   inside TOK.  */\n\nstatic const char *\ndecode_str(const char *input, int single, struct tok_state *tok)\n{\n    PyObject* utf8 = NULL;\n    const char *str;\n    const char *s;\n    const char *newl[2] = {NULL, NULL};\n    int lineno = 0;\n    tok->input = str = translate_newlines(input, single, tok);\n    if (str == NULL)\n        return NULL;\n    tok->enc = NULL;\n    tok->str = str;\n    if (!check_bom(buf_getc, buf_ungetc, buf_setreadl, tok))\n        return error_ret(tok);\n    str = tok->str;             /* string after BOM if any */\n    assert(str);\n    if (tok->enc != NULL) {\n        utf8 = translate_into_utf8(str, tok->enc);\n        if (utf8 == NULL)\n            return error_ret(tok);\n        str = PyBytes_AsString(utf8);\n    }\n    for (s = str;; s++) {\n        if (*s == '\\0') break;\n        else if (*s == '\\n') {\n            assert(lineno < 2);\n            newl[lineno] = s;\n            lineno++;\n            if (lineno == 2) break;\n        }\n    }\n    tok->enc = NULL;\n    /* need to check line 1 and 2 separately since check_coding_spec\n       assumes a single line as input */\n    if (newl[0]) {\n        if (!check_coding_spec(str, newl[0] - str, tok, buf_setreadl))\n            return error_ret(tok);\n        if (tok->enc == NULL && !tok->read_coding_spec && newl[1]) {\n            if (!check_coding_spec(newl[0]+1, newl[1] - newl[0],\n                                   tok, buf_setreadl))\n                return error_ret(tok);\n        }\n    }\n    if (tok->enc != NULL) {\n        assert(utf8 == NULL);\n        utf8 = translate_into_utf8(str, tok->enc);\n        if (utf8 == NULL)\n            return error_ret(tok);\n        str = PyBytes_AS_STRING(utf8);\n    }\n    assert(tok->decoding_buffer == NULL);\n    tok->decoding_buffer = utf8; /* CAUTION */\n    return str;\n}\n\n#endif /* PGEN */\n\n/* Set up tokenizer for string */\n\nstruct tok_state *\nTa3Tokenizer_FromString(const char *str, int exec_input)\n{\n    struct tok_state *tok = tok_new();\n    if (tok == NULL)\n        return NULL;\n    str = decode_str(str, exec_input, tok);\n    if (str == NULL) {\n        Ta3Tokenizer_Free(tok);\n        return NULL;\n    }\n\n    /* XXX: constify members. */\n    tok->buf = tok->cur = tok->end = tok->inp = (char*)str;\n    return tok;\n}\n\nstruct tok_state *\nTa3Tokenizer_FromUTF8(const char *str, int exec_input)\n{\n    struct tok_state *tok = tok_new();\n    if (tok == NULL)\n        return NULL;\n#ifndef PGEN\n    tok->input = str = translate_newlines(str, exec_input, tok);\n#endif\n    if (str == NULL) {\n        Ta3Tokenizer_Free(tok);\n        return NULL;\n    }\n    tok->decoding_state = STATE_RAW;\n    tok->read_coding_spec = 1;\n    tok->enc = NULL;\n    tok->str = str;\n    tok->encoding = (char *)PyMem_MALLOC(6);\n    if (!tok->encoding) {\n        Ta3Tokenizer_Free(tok);\n        return NULL;\n    }\n    strcpy(tok->encoding, \"utf-8\");\n\n    /* XXX: constify members. */\n    tok->buf = tok->cur = tok->end = tok->inp = (char*)str;\n    return tok;\n}\n\n/* Set up tokenizer for file */\n\nstruct tok_state *\nTa3Tokenizer_FromFile(FILE *fp, const char* enc,\n                     const char *ps1, const char *ps2)\n{\n    struct tok_state *tok = tok_new();\n    if (tok == NULL)\n        return NULL;\n    if ((tok->buf = (char *)PyMem_MALLOC(BUFSIZ)) == NULL) {\n        Ta3Tokenizer_Free(tok);\n        return NULL;\n    }\n    tok->cur = tok->inp = tok->buf;\n    tok->end = tok->buf + BUFSIZ;\n    tok->fp = fp;\n    tok->prompt = ps1;\n    tok->nextprompt = ps2;\n    if (enc != NULL) {\n        /* Must copy encoding declaration since it\n           gets copied into the parse tree. */\n        tok->encoding = PyMem_MALLOC(strlen(enc)+1);\n        if (!tok->encoding) {\n            Ta3Tokenizer_Free(tok);\n            return NULL;\n        }\n        strcpy(tok->encoding, enc);\n        tok->decoding_state = STATE_NORMAL;\n    }\n    return tok;\n}\n\n\n/* Free a tok_state structure */\n\nvoid\nTa3Tokenizer_Free(struct tok_state *tok)\n{\n    if (tok->encoding != NULL)\n        PyMem_FREE(tok->encoding);\n#ifndef PGEN\n    Py_XDECREF(tok->decoding_readline);\n    Py_XDECREF(tok->decoding_buffer);\n    Py_XDECREF(tok->filename);\n#endif\n    if (tok->fp != NULL && tok->buf != NULL)\n        PyMem_FREE(tok->buf);\n    if (tok->input)\n        PyMem_FREE((char *)tok->input);\n    PyMem_FREE(tok);\n}\n\n/* Get next char, updating state; error code goes into tok->done */\n\nstatic int\ntok_nextc(struct tok_state *tok)\n{\n    for (;;) {\n        if (tok->cur != tok->inp) {\n            return Py_CHARMASK(*tok->cur++); /* Fast path */\n        }\n        if (tok->done != E_OK)\n            return EOF;\n        if (tok->fp == NULL) {\n            char *end = strchr(tok->inp, '\\n');\n            if (end != NULL)\n                end++;\n            else {\n                end = strchr(tok->inp, '\\0');\n                if (end == tok->inp) {\n                    tok->done = E_EOF;\n                    return EOF;\n                }\n            }\n            if (tok->start == NULL)\n                tok->buf = tok->cur;\n            tok->line_start = tok->cur;\n            tok->lineno++;\n            tok->inp = end;\n            return Py_CHARMASK(*tok->cur++);\n        }\n        if (tok->prompt != NULL) {\n            char *newtok = PyOS_Readline(stdin, stdout, tok->prompt);\n#ifndef PGEN\n            if (newtok != NULL) {\n                char *translated = translate_newlines(newtok, 0, tok);\n                PyMem_FREE(newtok);\n                if (translated == NULL)\n                    return EOF;\n                newtok = translated;\n            }\n            if (tok->encoding && newtok && *newtok) {\n                /* Recode to UTF-8 */\n                Py_ssize_t buflen;\n                const char* buf;\n                PyObject *u = translate_into_utf8(newtok, tok->encoding);\n                PyMem_FREE(newtok);\n                if (!u) {\n                    tok->done = E_DECODE;\n                    return EOF;\n                }\n                buflen = PyBytes_GET_SIZE(u);\n                buf = PyBytes_AS_STRING(u);\n                newtok = PyMem_MALLOC(buflen+1);\n                if (newtok == NULL) {\n                    Py_DECREF(u);\n                    tok->done = E_NOMEM;\n                    return EOF;\n                }\n                strcpy(newtok, buf);\n                Py_DECREF(u);\n            }\n#endif\n            if (tok->nextprompt != NULL)\n                tok->prompt = tok->nextprompt;\n            if (newtok == NULL)\n                tok->done = E_INTR;\n            else if (*newtok == '\\0') {\n                PyMem_FREE(newtok);\n                tok->done = E_EOF;\n            }\n            else if (tok->start != NULL) {\n                size_t start = tok->start - tok->buf;\n                size_t oldlen = tok->cur - tok->buf;\n                size_t newlen = oldlen + strlen(newtok);\n                char *buf = tok->buf;\n                buf = (char *)PyMem_REALLOC(buf, newlen+1);\n                tok->lineno++;\n                if (buf == NULL) {\n                    PyMem_FREE(tok->buf);\n                    tok->buf = NULL;\n                    PyMem_FREE(newtok);\n                    tok->done = E_NOMEM;\n                    return EOF;\n                }\n                tok->buf = buf;\n                tok->cur = tok->buf + oldlen;\n                tok->line_start = tok->cur;\n                strcpy(tok->buf + oldlen, newtok);\n                PyMem_FREE(newtok);\n                tok->inp = tok->buf + newlen;\n                tok->end = tok->inp + 1;\n                tok->start = tok->buf + start;\n            }\n            else {\n                tok->lineno++;\n                if (tok->buf != NULL)\n                    PyMem_FREE(tok->buf);\n                tok->buf = newtok;\n                tok->cur = tok->buf;\n                tok->line_start = tok->buf;\n                tok->inp = strchr(tok->buf, '\\0');\n                tok->end = tok->inp + 1;\n            }\n        }\n        else {\n            int done = 0;\n            Py_ssize_t cur = 0;\n            char *pt;\n            if (tok->start == NULL) {\n                if (tok->buf == NULL) {\n                    tok->buf = (char *)\n                        PyMem_MALLOC(BUFSIZ);\n                    if (tok->buf == NULL) {\n                        tok->done = E_NOMEM;\n                        return EOF;\n                    }\n                    tok->end = tok->buf + BUFSIZ;\n                }\n                if (decoding_fgets(tok->buf, (int)(tok->end - tok->buf),\n                          tok) == NULL) {\n                    if (!tok->decoding_erred)\n                        tok->done = E_EOF;\n                    done = 1;\n                }\n                else {\n                    tok->done = E_OK;\n                    tok->inp = strchr(tok->buf, '\\0');\n                    done = tok->inp == tok->buf || tok->inp[-1] == '\\n';\n                }\n            }\n            else {\n                cur = tok->cur - tok->buf;\n                if (decoding_feof(tok)) {\n                    tok->done = E_EOF;\n                    done = 1;\n                }\n                else\n                    tok->done = E_OK;\n            }\n            tok->lineno++;\n            /* Read until '\\n' or EOF */\n            while (!done) {\n                Py_ssize_t curstart = tok->start == NULL ? -1 :\n                          tok->start - tok->buf;\n                Py_ssize_t curvalid = tok->inp - tok->buf;\n                Py_ssize_t newsize = curvalid + BUFSIZ;\n                char *newbuf = tok->buf;\n                newbuf = (char *)PyMem_REALLOC(newbuf,\n                                               newsize);\n                if (newbuf == NULL) {\n                    tok->done = E_NOMEM;\n                    tok->cur = tok->inp;\n                    return EOF;\n                }\n                tok->buf = newbuf;\n                tok->cur = tok->buf + cur;\n                tok->line_start = tok->cur;\n                tok->inp = tok->buf + curvalid;\n                tok->end = tok->buf + newsize;\n                tok->start = curstart < 0 ? NULL :\n                         tok->buf + curstart;\n                if (decoding_fgets(tok->inp,\n                               (int)(tok->end - tok->inp),\n                               tok) == NULL) {\n                    /* Break out early on decoding\n                       errors, as tok->buf will be NULL\n                     */\n                    if (tok->decoding_erred)\n                        return EOF;\n                    /* Last line does not end in \\n,\n                       fake one */\n                    strcpy(tok->inp, \"\\n\");\n                }\n                tok->inp = strchr(tok->inp, '\\0');\n                done = tok->inp[-1] == '\\n';\n            }\n            if (tok->buf != NULL) {\n                tok->cur = tok->buf + cur;\n                tok->line_start = tok->cur;\n                /* replace \"\\r\\n\" with \"\\n\" */\n                /* For Mac leave the \\r, giving a syntax error */\n                pt = tok->inp - 2;\n                if (pt >= tok->buf && *pt == '\\r') {\n                    *pt++ = '\\n';\n                    *pt = '\\0';\n                    tok->inp = pt;\n                }\n            }\n        }\n        if (tok->done != E_OK) {\n            if (tok->prompt != NULL)\n                PySys_WriteStderr(\"\\n\");\n            tok->cur = tok->inp;\n            return EOF;\n        }\n    }\n    /*NOTREACHED*/\n}\n\n\n/* Back-up one character */\n\nstatic void\ntok_backup(struct tok_state *tok, int c)\n{\n    if (c != EOF) {\n        if (--tok->cur < tok->buf)\n            Py_FatalError(\"tok_backup: beginning of buffer\");\n        if (*tok->cur != c)\n            *tok->cur = c;\n    }\n}\n\n\n/* Return the token corresponding to a single character */\n\nint\nTa3Token_OneChar(int c)\n{\n    switch (c) {\n    case '(':           return LPAR;\n    case ')':           return RPAR;\n    case '[':           return LSQB;\n    case ']':           return RSQB;\n    case ':':           return COLON;\n    case ',':           return COMMA;\n    case ';':           return SEMI;\n    case '+':           return PLUS;\n    case '-':           return MINUS;\n    case '*':           return STAR;\n    case '/':           return SLASH;\n    case '|':           return VBAR;\n    case '&':           return AMPER;\n    case '<':           return LESS;\n    case '>':           return GREATER;\n    case '=':           return EQUAL;\n    case '.':           return DOT;\n    case '%':           return PERCENT;\n    case '{':           return LBRACE;\n    case '}':           return RBRACE;\n    case '^':           return CIRCUMFLEX;\n    case '~':           return TILDE;\n    case '@':           return AT;\n    default:            return OP;\n    }\n}\n\n\nint\nTa3Token_TwoChars(int c1, int c2)\n{\n    switch (c1) {\n    case '=':\n        switch (c2) {\n        case '=':               return EQEQUAL;\n        }\n        break;\n    case '!':\n        switch (c2) {\n        case '=':               return NOTEQUAL;\n        }\n        break;\n    case '<':\n        switch (c2) {\n        case '>':               return NOTEQUAL;\n        case '=':               return LESSEQUAL;\n        case '<':               return LEFTSHIFT;\n        }\n        break;\n    case '>':\n        switch (c2) {\n        case '=':               return GREATEREQUAL;\n        case '>':               return RIGHTSHIFT;\n        }\n        break;\n    case '+':\n        switch (c2) {\n        case '=':               return PLUSEQUAL;\n        }\n        break;\n    case '-':\n        switch (c2) {\n        case '=':               return MINEQUAL;\n        case '>':               return RARROW;\n        }\n        break;\n    case '*':\n        switch (c2) {\n        case '*':               return DOUBLESTAR;\n        case '=':               return STAREQUAL;\n        }\n        break;\n    case '/':\n        switch (c2) {\n        case '/':               return DOUBLESLASH;\n        case '=':               return SLASHEQUAL;\n        }\n        break;\n    case '|':\n        switch (c2) {\n        case '=':               return VBAREQUAL;\n        }\n        break;\n    case '%':\n        switch (c2) {\n        case '=':               return PERCENTEQUAL;\n        }\n        break;\n    case '&':\n        switch (c2) {\n        case '=':               return AMPEREQUAL;\n        }\n        break;\n    case '^':\n        switch (c2) {\n        case '=':               return CIRCUMFLEXEQUAL;\n        }\n        break;\n    case '@':\n        switch (c2) {\n        case '=':               return ATEQUAL;\n        }\n        break;\n    }\n    return OP;\n}\n\nint\nTa3Token_ThreeChars(int c1, int c2, int c3)\n{\n    switch (c1) {\n    case '<':\n        switch (c2) {\n        case '<':\n            switch (c3) {\n            case '=':\n                return LEFTSHIFTEQUAL;\n            }\n            break;\n        }\n        break;\n    case '>':\n        switch (c2) {\n        case '>':\n            switch (c3) {\n            case '=':\n                return RIGHTSHIFTEQUAL;\n            }\n            break;\n        }\n        break;\n    case '*':\n        switch (c2) {\n        case '*':\n            switch (c3) {\n            case '=':\n                return DOUBLESTAREQUAL;\n            }\n            break;\n        }\n        break;\n    case '/':\n        switch (c2) {\n        case '/':\n            switch (c3) {\n            case '=':\n                return DOUBLESLASHEQUAL;\n            }\n            break;\n        }\n        break;\n    case '.':\n        switch (c2) {\n        case '.':\n            switch (c3) {\n            case '.':\n                return ELLIPSIS;\n            }\n            break;\n        }\n        break;\n    }\n    return OP;\n}\n\nstatic int\nindenterror(struct tok_state *tok)\n{\n    tok->done = E_TABSPACE;\n    tok->cur = tok->inp;\n    return ERRORTOKEN;\n}\n\n#ifdef PGEN\n#define verify_identifier(tok) 1\n#else\n/* Verify that the identifier follows PEP 3131.\n   All identifier strings are guaranteed to be \"ready\" unicode objects.\n */\nstatic int\nverify_identifier(struct tok_state *tok)\n{\n    PyObject *s;\n    int result;\n    if (tok->decoding_erred)\n        return 0;\n    s = PyUnicode_DecodeUTF8(tok->start, tok->cur - tok->start, NULL);\n    if (s == NULL || PyUnicode_READY(s) == -1) {\n        if (PyErr_ExceptionMatches(PyExc_UnicodeDecodeError)) {\n            PyErr_Clear();\n            tok->done = E_IDENTIFIER;\n        } else {\n            tok->done = E_ERROR;\n        }\n        return 0;\n    }\n    result = PyUnicode_IsIdentifier(s);\n    Py_DECREF(s);\n    if (result == 0)\n        tok->done = E_IDENTIFIER;\n    return result;\n}\n#endif\n\nstatic int\ntok_decimal_tail(struct tok_state *tok)\n{\n    int c;\n\n    while (1) {\n        do {\n            c = tok_nextc(tok);\n        } while (isdigit(c));\n        if (c != '_') {\n            break;\n        }\n        c = tok_nextc(tok);\n        if (!isdigit(c)) {\n            tok->done = E_TOKEN;\n            tok_backup(tok, c);\n            return 0;\n        }\n    }\n    return c;\n}\n\n/* Get next token, after space stripping etc. */\n\nstatic int\ntok_get(struct tok_state *tok, char **p_start, char **p_end)\n{\n    int c;\n    int blankline, nonascii;\n\n    *p_start = *p_end = NULL;\n  nextline:\n    tok->start = NULL;\n    blankline = 0;\n\n    /* Get indentation level */\n    if (tok->atbol) {\n        int col = 0;\n        int altcol = 0;\n        tok->atbol = 0;\n        for (;;) {\n            c = tok_nextc(tok);\n            if (c == ' ') {\n                col++, altcol++;\n            }\n            else if (c == '\\t') {\n                col = (col / tok->tabsize + 1) * tok->tabsize;\n                altcol = (altcol / ALTTABSIZE + 1) * ALTTABSIZE;\n            }\n            else if (c == '\\014')  {/* Control-L (formfeed) */\n                col = altcol = 0; /* For Emacs users */\n            }\n            else {\n                break;\n            }\n        }\n        tok_backup(tok, c);\n        if (c == '#' || c == '\\n') {\n            /* Lines with only whitespace and/or comments\n               shouldn't affect the indentation and are\n               not passed to the parser as NEWLINE tokens,\n               except *totally* empty lines in interactive\n               mode, which signal the end of a command group. */\n            if (col == 0 && c == '\\n' && tok->prompt != NULL) {\n                blankline = 0; /* Let it through */\n            }\n            else {\n                blankline = 1; /* Ignore completely */\n            }\n            /* We can't jump back right here since we still\n               may need to skip to the end of a comment */\n        }\n        if (!blankline && tok->level == 0) {\n            if (col == tok->indstack[tok->indent]) {\n                /* No change */\n                if (altcol != tok->altindstack[tok->indent]) {\n                    return indenterror(tok);\n                }\n            }\n            else if (col > tok->indstack[tok->indent]) {\n                /* Indent -- always one */\n                if (tok->indent+1 >= MAXINDENT) {\n                    tok->done = E_TOODEEP;\n                    tok->cur = tok->inp;\n                    return ERRORTOKEN;\n                }\n                if (altcol <= tok->altindstack[tok->indent]) {\n                    return indenterror(tok);\n                }\n                tok->pendin++;\n                tok->indstack[++tok->indent] = col;\n                tok->altindstack[tok->indent] = altcol;\n            }\n            else /* col < tok->indstack[tok->indent] */ {\n                /* Dedent -- any number, must be consistent */\n                while (tok->indent > 0 &&\n                    col < tok->indstack[tok->indent]) {\n                    tok->pendin--;\n                    tok->indent--;\n                }\n                if (col != tok->indstack[tok->indent]) {\n                    tok->done = E_DEDENT;\n                    tok->cur = tok->inp;\n                    return ERRORTOKEN;\n                }\n                if (altcol != tok->altindstack[tok->indent]) {\n                    return indenterror(tok);\n                }\n            }\n        }\n    }\n\n    tok->start = tok->cur;\n\n    /* Return pending indents/dedents */\n    if (tok->pendin != 0) {\n        if (tok->pendin < 0) {\n            tok->pendin++;\n            return DEDENT;\n        }\n        else {\n            tok->pendin--;\n            return INDENT;\n        }\n    }\n\n    /* Peek ahead at the next character */\n    c = tok_nextc(tok);\n    tok_backup(tok, c);\n    /* Check if we are closing an async function */\n    if (tok->async_def\n        && !blankline\n        /* Due to some implementation artifacts of type comments,\n         * a TYPE_COMMENT at the start of a function won't set an\n         * indentation level and it will produce a NEWLINE after it.\n         * To avoid spuriously ending an async function due to this,\n         * wait until we have some non-newline char in front of us. */\n        && c != '\\n'\n        && tok->level == 0\n        /* There was a NEWLINE after ASYNC DEF,\n           so we're past the signature. */\n        && tok->async_def_nl\n        /* Current indentation level is less than where\n           the async function was defined */\n        && tok->async_def_indent >= tok->indent)\n    {\n        tok->async_def = 0;\n        tok->async_def_indent = 0;\n        tok->async_def_nl = 0;\n    }\n\n again:\n    tok->start = NULL;\n    /* Skip spaces */\n    do {\n        c = tok_nextc(tok);\n    } while (c == ' ' || c == '\\t' || c == '\\014');\n\n    /* Set start of current token */\n    tok->start = tok->cur - 1;\n\n    /* Skip comment, unless it's a type comment */\n    if (c == '#') {\n        const char *prefix, *p, *type_start;\n\n        while (c != EOF && c != '\\n')\n            c = tok_nextc(tok);\n\n        p = tok->start;\n        prefix = type_comment_prefix;\n        while (*prefix && p < tok->cur) {\n            if (*prefix == ' ') {\n                while (*p == ' ' || *p == '\\t')\n                    p++;\n            } else if (*prefix == *p) {\n                p++;\n            } else {\n                break;\n            }\n\n            prefix++;\n        }\n\n        /* This is a type comment if we matched all of type_comment_prefix. */\n        if (!*prefix) {\n            int is_type_ignore = 1;\n            const char *ignore_end = p + 6;\n            tok_backup(tok, c);  /* don't eat the newline or EOF */\n\n            type_start = p;\n\n            /* A TYPE_IGNORE is \"type: ignore\" followed by the end of the token\n             * or anything ASCII and non-alphanumeric. */\n            is_type_ignore = (\n                tok->cur >= ignore_end && memcmp(p, \"ignore\", 6) == 0\n                && !(tok->cur > ignore_end\n                     && ((unsigned char)ignore_end[0] >= 128 || Py_ISALNUM(ignore_end[0]))));\n\n            if (is_type_ignore) {\n                *p_start = (char *) ignore_end;\n                *p_end = tok->cur;\n\n                /* If this type ignore is the only thing on the line, consume the newline also. */\n                if (blankline) {\n                    tok_nextc(tok);\n                    tok->atbol = 1;\n                }\n                return TYPE_IGNORE;\n            } else {\n                *p_start = (char *) type_start;  /* after type_comment_prefix */\n                *p_end = tok->cur;\n                return TYPE_COMMENT;\n            }\n        }\n    }\n\n    /* Check for EOF and errors now */\n    if (c == EOF) {\n        return tok->done == E_EOF ? ENDMARKER : ERRORTOKEN;\n    }\n\n    /* Identifier (most frequent token!) */\n    nonascii = 0;\n    if (is_potential_identifier_start(c)) {\n        /* Process the various legal combinations of b\"\", r\"\", u\"\", and f\"\". */\n        int saw_b = 0, saw_r = 0, saw_u = 0, saw_f = 0;\n        while (1) {\n            if (!(saw_b || saw_u || saw_f) && (c == 'b' || c == 'B'))\n                saw_b = 1;\n            /* Since this is a backwards compatibility support literal we don't\n               want to support it in arbitrary order like byte literals. */\n            else if (!(saw_b || saw_u || saw_r || saw_f)\n                     && (c == 'u'|| c == 'U')) {\n                saw_u = 1;\n            }\n            /* ur\"\" and ru\"\" are not supported */\n            else if (!(saw_r || saw_u) && (c == 'r' || c == 'R')) {\n                saw_r = 1;\n            }\n            else if (!(saw_f || saw_b || saw_u) && (c == 'f' || c == 'F')) {\n                saw_f = 1;\n            }\n            else {\n                break;\n            }\n            c = tok_nextc(tok);\n            if (c == '\"' || c == '\\'') {\n                goto letter_quote;\n            }\n        }\n        while (is_potential_identifier_char(c)) {\n            if (c >= 128) {\n                nonascii = 1;\n            }\n            c = tok_nextc(tok);\n        }\n        tok_backup(tok, c);\n        if (nonascii && !verify_identifier(tok)) {\n            return ERRORTOKEN;\n        }\n        *p_start = tok->start;\n        *p_end = tok->cur;\n\n        /* async/await parsing block. */\n        if (tok->cur - tok->start == 5) {\n            /* Current token length is 5. */\n            if (tok->async_always || tok->async_def) {\n                /* We're inside an 'async def' function. */\n                if (memcmp(tok->start, \"async\", 5) == 0) {\n                    return ASYNC;\n                }\n                if (memcmp(tok->start, \"await\", 5) == 0) {\n                    return AWAIT;\n                }\n            }\n            else if (memcmp(tok->start, \"async\", 5) == 0) {\n                /* The current token is 'async'.\n                   Look ahead one token.*/\n\n                struct tok_state ahead_tok;\n                char *ahead_tok_start = NULL, *ahead_tok_end = NULL;\n                int ahead_tok_kind;\n\n                memcpy(&ahead_tok, tok, sizeof(ahead_tok));\n                ahead_tok_kind = tok_get(&ahead_tok, &ahead_tok_start,\n                                         &ahead_tok_end);\n\n                if (ahead_tok_kind == NAME\n                    && ahead_tok.cur - ahead_tok.start == 3\n                    && memcmp(ahead_tok.start, \"def\", 3) == 0)\n                {\n                    /* The next token is going to be 'def', so instead of\n                       returning 'async' NAME token, we return ASYNC. */\n                    tok->async_def_indent = tok->indent;\n                    tok->async_def = 1;\n                    return ASYNC;\n                }\n            }\n        }\n\n        return NAME;\n    }\n\n    /* Newline */\n    if (c == '\\n') {\n        tok->atbol = 1;\n        if (blankline || tok->level > 0) {\n            goto nextline;\n        }\n        *p_start = tok->start;\n        *p_end = tok->cur - 1; /* Leave '\\n' out of the string */\n        tok->cont_line = 0;\n        if (tok->async_def) {\n            /* We're somewhere inside an 'async def' function, and\n               we've encountered a NEWLINE after its signature. */\n            tok->async_def_nl = 1;\n        }\n        return NEWLINE;\n    }\n\n    /* Period or number starting with period? */\n    if (c == '.') {\n        c = tok_nextc(tok);\n        if (isdigit(c)) {\n            goto fraction;\n        } else if (c == '.') {\n            c = tok_nextc(tok);\n            if (c == '.') {\n                *p_start = tok->start;\n                *p_end = tok->cur;\n                return ELLIPSIS;\n            }\n            else {\n                tok_backup(tok, c);\n            }\n            tok_backup(tok, '.');\n        }\n        else {\n            tok_backup(tok, c);\n        }\n        *p_start = tok->start;\n        *p_end = tok->cur;\n        return DOT;\n    }\n\n    /* Number */\n    if (isdigit(c)) {\n        if (c == '0') {\n            /* Hex, octal or binary -- maybe. */\n            c = tok_nextc(tok);\n            if (c == 'x' || c == 'X') {\n                /* Hex */\n                c = tok_nextc(tok);\n                do {\n                    if (c == '_') {\n                        c = tok_nextc(tok);\n                    }\n                    if (!isxdigit(c)) {\n                        tok->done = E_TOKEN;\n                        tok_backup(tok, c);\n                        return ERRORTOKEN;\n                    }\n                    do {\n                        c = tok_nextc(tok);\n                    } while (isxdigit(c));\n                } while (c == '_');\n            }\n            else if (c == 'o' || c == 'O') {\n                /* Octal */\n                c = tok_nextc(tok);\n                do {\n                    if (c == '_') {\n                        c = tok_nextc(tok);\n                    }\n                    if (c < '0' || c >= '8') {\n                        tok->done = E_TOKEN;\n                        tok_backup(tok, c);\n                        return ERRORTOKEN;\n                    }\n                    do {\n                        c = tok_nextc(tok);\n                    } while ('0' <= c && c < '8');\n                } while (c == '_');\n            }\n            else if (c == 'b' || c == 'B') {\n                /* Binary */\n                c = tok_nextc(tok);\n                do {\n                    if (c == '_') {\n                        c = tok_nextc(tok);\n                    }\n                    if (c != '0' && c != '1') {\n                        tok->done = E_TOKEN;\n                        tok_backup(tok, c);\n                        return ERRORTOKEN;\n                    }\n                    do {\n                        c = tok_nextc(tok);\n                    } while (c == '0' || c == '1');\n                } while (c == '_');\n            }\n            else {\n                int nonzero = 0;\n                /* maybe old-style octal; c is first char of it */\n                /* in any case, allow '0' as a literal */\n                while (1) {\n                    if (c == '_') {\n                        c = tok_nextc(tok);\n                        if (!isdigit(c)) {\n                            tok->done = E_TOKEN;\n                            tok_backup(tok, c);\n                            return ERRORTOKEN;\n                        }\n                    }\n                    if (c != '0') {\n                        break;\n                    }\n                    c = tok_nextc(tok);\n                }\n                if (isdigit(c)) {\n                    nonzero = 1;\n                    c = tok_decimal_tail(tok);\n                    if (c == 0) {\n                        return ERRORTOKEN;\n                    }\n                }\n                if (c == '.') {\n                    c = tok_nextc(tok);\n                    goto fraction;\n                }\n                else if (c == 'e' || c == 'E') {\n                    goto exponent;\n                }\n                else if (c == 'j' || c == 'J') {\n                    goto imaginary;\n                }\n                else if (nonzero) {\n                    /* Old-style octal: now disallowed. */\n                    tok->done = E_TOKEN;\n                    tok_backup(tok, c);\n                    return ERRORTOKEN;\n                }\n            }\n        }\n        else {\n            /* Decimal */\n            c = tok_decimal_tail(tok);\n            if (c == 0) {\n                return ERRORTOKEN;\n            }\n            {\n                /* Accept floating point numbers. */\n                if (c == '.') {\n                    c = tok_nextc(tok);\n        fraction:\n                    /* Fraction */\n                    if (isdigit(c)) {\n                        c = tok_decimal_tail(tok);\n                        if (c == 0) {\n                            return ERRORTOKEN;\n                        }\n                    }\n                }\n                if (c == 'e' || c == 'E') {\n                    int e;\n                  exponent:\n                    e = c;\n                    /* Exponent part */\n                    c = tok_nextc(tok);\n                    if (c == '+' || c == '-') {\n                        c = tok_nextc(tok);\n                        if (!isdigit(c)) {\n                            tok->done = E_TOKEN;\n                            tok_backup(tok, c);\n                            return ERRORTOKEN;\n                        }\n                    } else if (!isdigit(c)) {\n                        tok_backup(tok, c);\n                        tok_backup(tok, e);\n                        *p_start = tok->start;\n                        *p_end = tok->cur;\n                        return NUMBER;\n                    }\n                    c = tok_decimal_tail(tok);\n                    if (c == 0) {\n                        return ERRORTOKEN;\n                    }\n                }\n                if (c == 'j' || c == 'J') {\n                    /* Imaginary part */\n        imaginary:\n                    c = tok_nextc(tok);\n                }\n            }\n        }\n        tok_backup(tok, c);\n        *p_start = tok->start;\n        *p_end = tok->cur;\n        return NUMBER;\n    }\n\n  letter_quote:\n    /* String */\n    if (c == '\\'' || c == '\"') {\n        int quote = c;\n        int quote_size = 1;             /* 1 or 3 */\n        int end_quote_size = 0;\n\n        /* Find the quote size and start of string */\n        c = tok_nextc(tok);\n        if (c == quote) {\n            c = tok_nextc(tok);\n            if (c == quote) {\n                quote_size = 3;\n            }\n            else {\n                end_quote_size = 1;     /* empty string found */\n            }\n        }\n        if (c != quote) {\n            tok_backup(tok, c);\n        }\n\n        /* Get rest of string */\n        while (end_quote_size != quote_size) {\n            c = tok_nextc(tok);\n            if (c == EOF) {\n                if (quote_size == 3) {\n                    tok->done = E_EOFS;\n                }\n                else {\n                    tok->done = E_EOLS;\n                }\n                tok->cur = tok->inp;\n                return ERRORTOKEN;\n            }\n            if (quote_size == 1 && c == '\\n') {\n                tok->done = E_EOLS;\n                tok->cur = tok->inp;\n                return ERRORTOKEN;\n            }\n            if (c == quote) {\n                end_quote_size += 1;\n            }\n            else {\n                end_quote_size = 0;\n                if (c == '\\\\') {\n                    tok_nextc(tok);  /* skip escaped char */\n                }\n            }\n        }\n\n        *p_start = tok->start;\n        *p_end = tok->cur;\n        return STRING;\n    }\n\n    /* Line continuation */\n    if (c == '\\\\') {\n        c = tok_nextc(tok);\n        if (c != '\\n') {\n            tok->done = E_LINECONT;\n            tok->cur = tok->inp;\n            return ERRORTOKEN;\n        }\n        tok->cont_line = 1;\n        goto again; /* Read next line */\n    }\n\n    /* Check for two-character token */\n    {\n        int c2 = tok_nextc(tok);\n        int token = Ta3Token_TwoChars(c, c2);\n        if (token != OP) {\n            int c3 = tok_nextc(tok);\n            int token3 = Ta3Token_ThreeChars(c, c2, c3);\n            if (token3 != OP) {\n                token = token3;\n            }\n            else {\n                tok_backup(tok, c3);\n            }\n            *p_start = tok->start;\n            *p_end = tok->cur;\n            return token;\n        }\n        tok_backup(tok, c2);\n    }\n\n    /* Keep track of parentheses nesting level */\n    switch (c) {\n    case '(':\n    case '[':\n    case '{':\n        tok->level++;\n        break;\n    case ')':\n    case ']':\n    case '}':\n        tok->level--;\n        break;\n    }\n\n    /* Punctuation character */\n    *p_start = tok->start;\n    *p_end = tok->cur;\n    return Ta3Token_OneChar(c);\n}\n\nint\nTa3Tokenizer_Get(struct tok_state *tok, char **p_start, char **p_end)\n{\n    int result = tok_get(tok, p_start, p_end);\n    if (tok->decoding_erred) {\n        result = ERRORTOKEN;\n        tok->done = E_DECODE;\n    }\n    return result;\n}\n\n/* Get the encoding of a Python file. Check for the coding cookie and check if\n   the file starts with a BOM.\n\n   Ta3Tokenizer_FindEncodingFilename() returns NULL when it can't find the\n   encoding in the first or second line of the file (in which case the encoding\n   should be assumed to be UTF-8).\n\n   The char* returned is malloc'ed via PyMem_MALLOC() and thus must be freed\n   by the caller. */\n\nPyAPI_FUNC(int) _Py_dup(int fd);\n\nchar *\nTa3Tokenizer_FindEncodingFilename(int fd, PyObject *filename)\n{\n    struct tok_state *tok;\n    FILE *fp;\n    char *p_start =NULL , *p_end =NULL , *encoding = NULL;\n\n#ifndef PGEN\n    fd = _Py_dup(fd);\n#else\n    fd = dup(fd);\n#endif\n    if (fd < 0) {\n        return NULL;\n    }\n\n    fp = fdopen(fd, \"r\");\n    if (fp == NULL) {\n        return NULL;\n    }\n    tok = Ta3Tokenizer_FromFile(fp, NULL, NULL, NULL);\n    if (tok == NULL) {\n        fclose(fp);\n        return NULL;\n    }\n#ifndef PGEN\n    if (filename != NULL) {\n        Py_INCREF(filename);\n        tok->filename = filename;\n    }\n    else {\n        tok->filename = PyUnicode_FromString(\"<string>\");\n        if (tok->filename == NULL) {\n            fclose(fp);\n            Ta3Tokenizer_Free(tok);\n            return encoding;\n        }\n    }\n#endif\n    while (tok->lineno < 2 && tok->done == E_OK) {\n        Ta3Tokenizer_Get(tok, &p_start, &p_end);\n    }\n    fclose(fp);\n    if (tok->encoding) {\n        encoding = (char *)PyMem_MALLOC(strlen(tok->encoding) + 1);\n        if (encoding)\n        strcpy(encoding, tok->encoding);\n    }\n    Ta3Tokenizer_Free(tok);\n    return encoding;\n}\n\nchar *\nTa3Tokenizer_FindEncoding(int fd)\n{\n    return Ta3Tokenizer_FindEncodingFilename(fd, NULL);\n}\n\n#ifdef Py_DEBUG\n\nvoid\ntok_dump(int type, char *start, char *end)\n{\n    printf(\"%s\", _Ta3Parser_TokenNames[type]);\n    if (type == NAME || type == NUMBER || type == STRING || type == OP)\n        printf(\"(%.*s)\", (int)(end - start), start);\n}\n\n#endif\n"
  },
  {
    "path": "ast3/Parser/tokenizer.h",
    "content": "#ifndef Ta3_TOKENIZER_H\n#define Ta3_TOKENIZER_H\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n#include \"object.h\"\n\n/* Tokenizer interface */\n\n#include \"../Include/token.h\"\n\n#define MAXINDENT 100   /* Max indentation level */\n\nenum decoding_state {\n    STATE_INIT,\n    STATE_RAW,\n    STATE_NORMAL        /* have a codec associated with input */\n};\n\n/* Tokenizer state */\nstruct tok_state {\n    /* Input state; buf <= cur <= inp <= end */\n    /* NB an entire line is held in the buffer */\n    char *buf;          /* Input buffer, or NULL; malloc'ed if fp != NULL */\n    char *cur;          /* Next character in buffer */\n    char *inp;          /* End of data in buffer */\n    char *end;          /* End of input buffer if buf != NULL */\n    char *start;        /* Start of current token if not NULL */\n    int done;           /* E_OK normally, E_EOF at EOF, otherwise error code */\n    /* NB If done != E_OK, cur must be == inp!!! */\n    FILE *fp;           /* Rest of input; NULL if tokenizing a string */\n    int tabsize;        /* Tab spacing */\n    int indent;         /* Current indentation index */\n    int indstack[MAXINDENT];            /* Stack of indents */\n    int atbol;          /* Nonzero if at begin of new line */\n    int pendin;         /* Pending indents (if > 0) or dedents (if < 0) */\n    const char *prompt, *nextprompt;          /* For interactive prompting */\n    int lineno;         /* Current line number */\n    int level;          /* () [] {} Parentheses nesting level */\n            /* Used to allow free continuations inside them */\n    /* Stuff for checking on different tab sizes */\n#ifndef PGEN\n    /* pgen doesn't have access to Python codecs, it cannot decode the input\n       filename. The bytes filename might be kept, but it is only used by\n       indenterror() and it is not really needed: pgen only compiles one file\n       (Grammar/Grammar). */\n    PyObject *filename;\n#endif\n    int altindstack[MAXINDENT];         /* Stack of alternate indents */\n    /* Stuff for PEP 0263 */\n    enum decoding_state decoding_state;\n    int decoding_erred;         /* whether erred in decoding  */\n    int read_coding_spec;       /* whether 'coding:...' has been read  */\n    char *encoding;         /* Source encoding. */\n    int cont_line;          /* whether we are in a continuation line. */\n    const char* line_start;     /* pointer to start of current line */\n#ifndef PGEN\n    PyObject *decoding_readline; /* open(...).readline */\n    PyObject *decoding_buffer;\n#endif\n    const char* enc;        /* Encoding for the current str. */\n    const char* str;\n    const char* input; /* Tokenizer's newline translated copy of the string. */\n\n    /* async/await related fields; can be removed in 3.7 when async and await\n       become normal keywords. */\n    int async_def;        /* =1 if tokens are inside an 'async def' body. */\n    int async_def_indent; /* Indentation level of the outermost 'async def'. */\n    int async_def_nl;     /* =1 if the outermost 'async def' had at least one\n                             NEWLINE token after it. */\n    int async_always;     /* =1 if async/await are always keywords */\n};\n\nextern struct tok_state *Ta3Tokenizer_FromString(const char *, int);\nextern struct tok_state *Ta3Tokenizer_FromUTF8(const char *, int);\nextern struct tok_state *Ta3Tokenizer_FromFile(FILE *, const char*,\n                                              const char *, const char *);\nextern void Ta3Tokenizer_Free(struct tok_state *);\nextern int Ta3Tokenizer_Get(struct tok_state *, char **, char **);\n\n#ifdef __cplusplus\n}\n#endif\n#endif /* !Ta3_TOKENIZER_H */\n"
  },
  {
    "path": "ast3/Python/Python-ast.c",
    "content": "/* File automatically generated by Parser/asdl_c.py. */\n\n#include <stddef.h>\n\n#include \"Python.h\"\n#include \"../Include/Python-ast.h\"\n\nstatic PyTypeObject AST_type;\nstatic PyTypeObject *mod_type;\nstatic PyObject* ast2obj_mod(void*);\nstatic PyTypeObject *Module_type;\n_Py_IDENTIFIER(body);\n_Py_IDENTIFIER(type_ignores);\nstatic char *Module_fields[]={\n    \"body\",\n    \"type_ignores\",\n};\nstatic PyTypeObject *Interactive_type;\nstatic char *Interactive_fields[]={\n    \"body\",\n};\nstatic PyTypeObject *Expression_type;\nstatic char *Expression_fields[]={\n    \"body\",\n};\nstatic PyTypeObject *FunctionType_type;\n_Py_IDENTIFIER(argtypes);\n_Py_IDENTIFIER(returns);\nstatic char *FunctionType_fields[]={\n    \"argtypes\",\n    \"returns\",\n};\nstatic PyTypeObject *Suite_type;\nstatic char *Suite_fields[]={\n    \"body\",\n};\nstatic PyTypeObject *stmt_type;\n_Py_IDENTIFIER(lineno);\n_Py_IDENTIFIER(col_offset);\nstatic char *stmt_attributes[] = {\n    \"lineno\",\n    \"col_offset\",\n};\nstatic PyObject* ast2obj_stmt(void*);\nstatic PyTypeObject *FunctionDef_type;\n_Py_IDENTIFIER(name);\n_Py_IDENTIFIER(args);\n_Py_IDENTIFIER(decorator_list);\n_Py_IDENTIFIER(type_comment);\nstatic char *FunctionDef_fields[]={\n    \"name\",\n    \"args\",\n    \"body\",\n    \"decorator_list\",\n    \"returns\",\n    \"type_comment\",\n};\nstatic PyTypeObject *AsyncFunctionDef_type;\nstatic char *AsyncFunctionDef_fields[]={\n    \"name\",\n    \"args\",\n    \"body\",\n    \"decorator_list\",\n    \"returns\",\n    \"type_comment\",\n};\nstatic PyTypeObject *ClassDef_type;\n_Py_IDENTIFIER(bases);\n_Py_IDENTIFIER(keywords);\nstatic char *ClassDef_fields[]={\n    \"name\",\n    \"bases\",\n    \"keywords\",\n    \"body\",\n    \"decorator_list\",\n};\nstatic PyTypeObject *Return_type;\n_Py_IDENTIFIER(value);\nstatic char *Return_fields[]={\n    \"value\",\n};\nstatic PyTypeObject *Delete_type;\n_Py_IDENTIFIER(targets);\nstatic char *Delete_fields[]={\n    \"targets\",\n};\nstatic PyTypeObject *Assign_type;\nstatic char *Assign_fields[]={\n    \"targets\",\n    \"value\",\n    \"type_comment\",\n};\nstatic PyTypeObject *AugAssign_type;\n_Py_IDENTIFIER(target);\n_Py_IDENTIFIER(op);\nstatic char *AugAssign_fields[]={\n    \"target\",\n    \"op\",\n    \"value\",\n};\nstatic PyTypeObject *AnnAssign_type;\n_Py_IDENTIFIER(annotation);\n_Py_IDENTIFIER(simple);\nstatic char *AnnAssign_fields[]={\n    \"target\",\n    \"annotation\",\n    \"value\",\n    \"simple\",\n};\nstatic PyTypeObject *For_type;\n_Py_IDENTIFIER(iter);\n_Py_IDENTIFIER(orelse);\nstatic char *For_fields[]={\n    \"target\",\n    \"iter\",\n    \"body\",\n    \"orelse\",\n    \"type_comment\",\n};\nstatic PyTypeObject *AsyncFor_type;\nstatic char *AsyncFor_fields[]={\n    \"target\",\n    \"iter\",\n    \"body\",\n    \"orelse\",\n    \"type_comment\",\n};\nstatic PyTypeObject *While_type;\n_Py_IDENTIFIER(test);\nstatic char *While_fields[]={\n    \"test\",\n    \"body\",\n    \"orelse\",\n};\nstatic PyTypeObject *If_type;\nstatic char *If_fields[]={\n    \"test\",\n    \"body\",\n    \"orelse\",\n};\nstatic PyTypeObject *With_type;\n_Py_IDENTIFIER(items);\nstatic char *With_fields[]={\n    \"items\",\n    \"body\",\n    \"type_comment\",\n};\nstatic PyTypeObject *AsyncWith_type;\nstatic char *AsyncWith_fields[]={\n    \"items\",\n    \"body\",\n    \"type_comment\",\n};\nstatic PyTypeObject *Raise_type;\n_Py_IDENTIFIER(exc);\n_Py_IDENTIFIER(cause);\nstatic char *Raise_fields[]={\n    \"exc\",\n    \"cause\",\n};\nstatic PyTypeObject *Try_type;\n_Py_IDENTIFIER(handlers);\n_Py_IDENTIFIER(finalbody);\nstatic char *Try_fields[]={\n    \"body\",\n    \"handlers\",\n    \"orelse\",\n    \"finalbody\",\n};\nstatic PyTypeObject *Assert_type;\n_Py_IDENTIFIER(msg);\nstatic char *Assert_fields[]={\n    \"test\",\n    \"msg\",\n};\nstatic PyTypeObject *Import_type;\n_Py_IDENTIFIER(names);\nstatic char *Import_fields[]={\n    \"names\",\n};\nstatic PyTypeObject *ImportFrom_type;\n_Py_IDENTIFIER(module);\n_Py_IDENTIFIER(level);\nstatic char *ImportFrom_fields[]={\n    \"module\",\n    \"names\",\n    \"level\",\n};\nstatic PyTypeObject *Global_type;\nstatic char *Global_fields[]={\n    \"names\",\n};\nstatic PyTypeObject *Nonlocal_type;\nstatic char *Nonlocal_fields[]={\n    \"names\",\n};\nstatic PyTypeObject *Expr_type;\nstatic char *Expr_fields[]={\n    \"value\",\n};\nstatic PyTypeObject *Pass_type;\nstatic PyTypeObject *Break_type;\nstatic PyTypeObject *Continue_type;\nstatic PyTypeObject *expr_type;\nstatic char *expr_attributes[] = {\n    \"lineno\",\n    \"col_offset\",\n};\nstatic PyObject* ast2obj_expr(void*);\nstatic PyTypeObject *BoolOp_type;\n_Py_IDENTIFIER(values);\nstatic char *BoolOp_fields[]={\n    \"op\",\n    \"values\",\n};\nstatic PyTypeObject *BinOp_type;\n_Py_IDENTIFIER(left);\n_Py_IDENTIFIER(right);\nstatic char *BinOp_fields[]={\n    \"left\",\n    \"op\",\n    \"right\",\n};\nstatic PyTypeObject *UnaryOp_type;\n_Py_IDENTIFIER(operand);\nstatic char *UnaryOp_fields[]={\n    \"op\",\n    \"operand\",\n};\nstatic PyTypeObject *Lambda_type;\nstatic char *Lambda_fields[]={\n    \"args\",\n    \"body\",\n};\nstatic PyTypeObject *IfExp_type;\nstatic char *IfExp_fields[]={\n    \"test\",\n    \"body\",\n    \"orelse\",\n};\nstatic PyTypeObject *Dict_type;\n_Py_IDENTIFIER(keys);\nstatic char *Dict_fields[]={\n    \"keys\",\n    \"values\",\n};\nstatic PyTypeObject *Set_type;\n_Py_IDENTIFIER(elts);\nstatic char *Set_fields[]={\n    \"elts\",\n};\nstatic PyTypeObject *ListComp_type;\n_Py_IDENTIFIER(elt);\n_Py_IDENTIFIER(generators);\nstatic char *ListComp_fields[]={\n    \"elt\",\n    \"generators\",\n};\nstatic PyTypeObject *SetComp_type;\nstatic char *SetComp_fields[]={\n    \"elt\",\n    \"generators\",\n};\nstatic PyTypeObject *DictComp_type;\n_Py_IDENTIFIER(key);\nstatic char *DictComp_fields[]={\n    \"key\",\n    \"value\",\n    \"generators\",\n};\nstatic PyTypeObject *GeneratorExp_type;\nstatic char *GeneratorExp_fields[]={\n    \"elt\",\n    \"generators\",\n};\nstatic PyTypeObject *Await_type;\nstatic char *Await_fields[]={\n    \"value\",\n};\nstatic PyTypeObject *Yield_type;\nstatic char *Yield_fields[]={\n    \"value\",\n};\nstatic PyTypeObject *YieldFrom_type;\nstatic char *YieldFrom_fields[]={\n    \"value\",\n};\nstatic PyTypeObject *Compare_type;\n_Py_IDENTIFIER(ops);\n_Py_IDENTIFIER(comparators);\nstatic char *Compare_fields[]={\n    \"left\",\n    \"ops\",\n    \"comparators\",\n};\nstatic PyTypeObject *Call_type;\n_Py_IDENTIFIER(func);\nstatic char *Call_fields[]={\n    \"func\",\n    \"args\",\n    \"keywords\",\n};\nstatic PyTypeObject *Num_type;\n_Py_IDENTIFIER(n);\nstatic char *Num_fields[]={\n    \"n\",\n};\nstatic PyTypeObject *Str_type;\n_Py_IDENTIFIER(s);\n_Py_IDENTIFIER(kind);\nstatic char *Str_fields[]={\n    \"s\",\n    \"kind\",\n};\nstatic PyTypeObject *FormattedValue_type;\n_Py_IDENTIFIER(conversion);\n_Py_IDENTIFIER(format_spec);\nstatic char *FormattedValue_fields[]={\n    \"value\",\n    \"conversion\",\n    \"format_spec\",\n};\nstatic PyTypeObject *JoinedStr_type;\nstatic char *JoinedStr_fields[]={\n    \"values\",\n};\nstatic PyTypeObject *Bytes_type;\nstatic char *Bytes_fields[]={\n    \"s\",\n    \"kind\",\n};\nstatic PyTypeObject *NameConstant_type;\nstatic char *NameConstant_fields[]={\n    \"value\",\n};\nstatic PyTypeObject *Ellipsis_type;\nstatic PyTypeObject *Constant_type;\nstatic char *Constant_fields[]={\n    \"value\",\n};\nstatic PyTypeObject *Attribute_type;\n_Py_IDENTIFIER(attr);\n_Py_IDENTIFIER(ctx);\nstatic char *Attribute_fields[]={\n    \"value\",\n    \"attr\",\n    \"ctx\",\n};\nstatic PyTypeObject *Subscript_type;\n_Py_IDENTIFIER(slice);\nstatic char *Subscript_fields[]={\n    \"value\",\n    \"slice\",\n    \"ctx\",\n};\nstatic PyTypeObject *Starred_type;\nstatic char *Starred_fields[]={\n    \"value\",\n    \"ctx\",\n};\nstatic PyTypeObject *Name_type;\n_Py_IDENTIFIER(id);\nstatic char *Name_fields[]={\n    \"id\",\n    \"ctx\",\n};\nstatic PyTypeObject *List_type;\nstatic char *List_fields[]={\n    \"elts\",\n    \"ctx\",\n};\nstatic PyTypeObject *Tuple_type;\nstatic char *Tuple_fields[]={\n    \"elts\",\n    \"ctx\",\n};\nstatic PyTypeObject *expr_context_type;\nstatic PyObject *Load_singleton, *Store_singleton, *Del_singleton,\n*AugLoad_singleton, *AugStore_singleton, *Param_singleton;\nstatic PyObject* ast2obj_expr_context(expr_context_ty);\nstatic PyTypeObject *Load_type;\nstatic PyTypeObject *Store_type;\nstatic PyTypeObject *Del_type;\nstatic PyTypeObject *AugLoad_type;\nstatic PyTypeObject *AugStore_type;\nstatic PyTypeObject *Param_type;\nstatic PyTypeObject *slice_type;\nstatic PyObject* ast2obj_slice(void*);\nstatic PyTypeObject *Slice_type;\n_Py_IDENTIFIER(lower);\n_Py_IDENTIFIER(upper);\n_Py_IDENTIFIER(step);\nstatic char *Slice_fields[]={\n    \"lower\",\n    \"upper\",\n    \"step\",\n};\nstatic PyTypeObject *ExtSlice_type;\n_Py_IDENTIFIER(dims);\nstatic char *ExtSlice_fields[]={\n    \"dims\",\n};\nstatic PyTypeObject *Index_type;\nstatic char *Index_fields[]={\n    \"value\",\n};\nstatic PyTypeObject *boolop_type;\nstatic PyObject *And_singleton, *Or_singleton;\nstatic PyObject* ast2obj_boolop(boolop_ty);\nstatic PyTypeObject *And_type;\nstatic PyTypeObject *Or_type;\nstatic PyTypeObject *operator_type;\nstatic PyObject *Add_singleton, *Sub_singleton, *Mult_singleton,\n*MatMult_singleton, *Div_singleton, *Mod_singleton, *Pow_singleton,\n*LShift_singleton, *RShift_singleton, *BitOr_singleton, *BitXor_singleton,\n*BitAnd_singleton, *FloorDiv_singleton;\nstatic PyObject* ast2obj_operator(operator_ty);\nstatic PyTypeObject *Add_type;\nstatic PyTypeObject *Sub_type;\nstatic PyTypeObject *Mult_type;\nstatic PyTypeObject *MatMult_type;\nstatic PyTypeObject *Div_type;\nstatic PyTypeObject *Mod_type;\nstatic PyTypeObject *Pow_type;\nstatic PyTypeObject *LShift_type;\nstatic PyTypeObject *RShift_type;\nstatic PyTypeObject *BitOr_type;\nstatic PyTypeObject *BitXor_type;\nstatic PyTypeObject *BitAnd_type;\nstatic PyTypeObject *FloorDiv_type;\nstatic PyTypeObject *unaryop_type;\nstatic PyObject *Invert_singleton, *Not_singleton, *UAdd_singleton,\n*USub_singleton;\nstatic PyObject* ast2obj_unaryop(unaryop_ty);\nstatic PyTypeObject *Invert_type;\nstatic PyTypeObject *Not_type;\nstatic PyTypeObject *UAdd_type;\nstatic PyTypeObject *USub_type;\nstatic PyTypeObject *cmpop_type;\nstatic PyObject *Eq_singleton, *NotEq_singleton, *Lt_singleton, *LtE_singleton,\n*Gt_singleton, *GtE_singleton, *Is_singleton, *IsNot_singleton, *In_singleton,\n*NotIn_singleton;\nstatic PyObject* ast2obj_cmpop(cmpop_ty);\nstatic PyTypeObject *Eq_type;\nstatic PyTypeObject *NotEq_type;\nstatic PyTypeObject *Lt_type;\nstatic PyTypeObject *LtE_type;\nstatic PyTypeObject *Gt_type;\nstatic PyTypeObject *GtE_type;\nstatic PyTypeObject *Is_type;\nstatic PyTypeObject *IsNot_type;\nstatic PyTypeObject *In_type;\nstatic PyTypeObject *NotIn_type;\nstatic PyTypeObject *comprehension_type;\nstatic PyObject* ast2obj_comprehension(void*);\n_Py_IDENTIFIER(ifs);\n_Py_IDENTIFIER(is_async);\nstatic char *comprehension_fields[]={\n    \"target\",\n    \"iter\",\n    \"ifs\",\n    \"is_async\",\n};\nstatic PyTypeObject *excepthandler_type;\nstatic char *excepthandler_attributes[] = {\n    \"lineno\",\n    \"col_offset\",\n};\nstatic PyObject* ast2obj_excepthandler(void*);\nstatic PyTypeObject *ExceptHandler_type;\n_Py_IDENTIFIER(type);\nstatic char *ExceptHandler_fields[]={\n    \"type\",\n    \"name\",\n    \"body\",\n};\nstatic PyTypeObject *arguments_type;\nstatic PyObject* ast2obj_arguments(void*);\n_Py_IDENTIFIER(vararg);\n_Py_IDENTIFIER(kwonlyargs);\n_Py_IDENTIFIER(kw_defaults);\n_Py_IDENTIFIER(kwarg);\n_Py_IDENTIFIER(defaults);\nstatic char *arguments_fields[]={\n    \"args\",\n    \"vararg\",\n    \"kwonlyargs\",\n    \"kw_defaults\",\n    \"kwarg\",\n    \"defaults\",\n};\nstatic PyTypeObject *arg_type;\nstatic PyObject* ast2obj_arg(void*);\nstatic char *arg_attributes[] = {\n    \"lineno\",\n    \"col_offset\",\n};\n_Py_IDENTIFIER(arg);\nstatic char *arg_fields[]={\n    \"arg\",\n    \"annotation\",\n    \"type_comment\",\n};\nstatic PyTypeObject *keyword_type;\nstatic PyObject* ast2obj_keyword(void*);\nstatic char *keyword_fields[]={\n    \"arg\",\n    \"value\",\n};\nstatic PyTypeObject *alias_type;\nstatic PyObject* ast2obj_alias(void*);\n_Py_IDENTIFIER(asname);\nstatic char *alias_fields[]={\n    \"name\",\n    \"asname\",\n};\nstatic PyTypeObject *withitem_type;\nstatic PyObject* ast2obj_withitem(void*);\n_Py_IDENTIFIER(context_expr);\n_Py_IDENTIFIER(optional_vars);\nstatic char *withitem_fields[]={\n    \"context_expr\",\n    \"optional_vars\",\n};\nstatic PyTypeObject *type_ignore_type;\nstatic PyObject* ast2obj_type_ignore(void*);\nstatic PyTypeObject *TypeIgnore_type;\n_Py_IDENTIFIER(tag);\nstatic char *TypeIgnore_fields[]={\n    \"lineno\",\n    \"tag\",\n};\n\n\n_Py_IDENTIFIER(_fields);\n_Py_IDENTIFIER(_attributes);\n\ntypedef struct {\n    PyObject_HEAD\n    PyObject *dict;\n} AST_object;\n\nstatic void\nast_dealloc(AST_object *self)\n{\n    /* bpo-31095: UnTrack is needed before calling any callbacks */\n    PyObject_GC_UnTrack(self);\n    Py_CLEAR(self->dict);\n    Py_TYPE(self)->tp_free(self);\n}\n\nstatic int\nast_traverse(AST_object *self, visitproc visit, void *arg)\n{\n    Py_VISIT(self->dict);\n    return 0;\n}\n\nstatic int\nast_clear(AST_object *self)\n{\n    Py_CLEAR(self->dict);\n    return 0;\n}\n\nstatic int lookup_attr_id(PyObject *v, _Py_Identifier *name, PyObject **result)\n{\n    PyObject *oname = _PyUnicode_FromId(name); /* borrowed */\n    if (!oname) {\n        *result = NULL;\n        return -1;\n    }\n    *result = PyObject_GetAttr(v, oname);\n    if (*result == NULL) {\n        if (!PyErr_ExceptionMatches(PyExc_AttributeError)) {\n            return -1;\n        }\n        PyErr_Clear();\n    }\n    return 0;\n}\n\nstatic int\nast_type_init(PyObject *self, PyObject *args, PyObject *kw)\n{\n    Py_ssize_t i, numfields = 0;\n    int res = -1;\n    PyObject *key, *value, *fields;\n    if (lookup_attr_id((PyObject*)Py_TYPE(self), &PyId__fields, &fields) < 0) {\n        goto cleanup;\n    }\n    if (fields) {\n        numfields = PySequence_Size(fields);\n        if (numfields == -1)\n            goto cleanup;\n    }\n\n    res = 0; /* if no error occurs, this stays 0 to the end */\n    if (numfields < PyTuple_GET_SIZE(args)) {\n        PyErr_Format(PyExc_TypeError, \"%.400s constructor takes at most \"\n                     \"%zd positional argument%s\",\n                     Py_TYPE(self)->tp_name,\n                     numfields, numfields == 1 ? \"\" : \"s\");\n        res = -1;\n        goto cleanup;\n    }\n    for (i = 0; i < PyTuple_GET_SIZE(args); i++) {\n        /* cannot be reached when fields is NULL */\n        PyObject *name = PySequence_GetItem(fields, i);\n        if (!name) {\n            res = -1;\n            goto cleanup;\n        }\n        res = PyObject_SetAttr(self, name, PyTuple_GET_ITEM(args, i));\n        Py_DECREF(name);\n        if (res < 0)\n            goto cleanup;\n    }\n    if (kw) {\n        i = 0;  /* needed by PyDict_Next */\n        while (PyDict_Next(kw, &i, &key, &value)) {\n            res = PyObject_SetAttr(self, key, value);\n            if (res < 0)\n                goto cleanup;\n        }\n    }\n  cleanup:\n    Py_XDECREF(fields);\n    return res;\n}\n\n/* Pickling support */\nstatic PyObject *\nast_type_reduce(PyObject *self, PyObject *unused)\n{\n    _Py_IDENTIFIER(__dict__);\n    PyObject *dict;\n    if (lookup_attr_id(self, &PyId___dict__, &dict) < 0) {\n        return NULL;\n    }\n    if (dict) {\n        return Py_BuildValue(\"O()N\", Py_TYPE(self), dict);\n    }\n    return Py_BuildValue(\"O()\", Py_TYPE(self));\n}\n\nstatic PyMethodDef ast_type_methods[] = {\n    {\"__reduce__\", ast_type_reduce, METH_NOARGS, NULL},\n    {NULL}\n};\n\nstatic PyGetSetDef ast_type_getsets[] = {\n    {\"__dict__\", PyObject_GenericGetDict, PyObject_GenericSetDict},\n    {NULL}\n};\n\nstatic PyTypeObject AST_type = {\n    PyVarObject_HEAD_INIT(NULL, 0)\n    \"typed_ast._ast3.AST\",\n    sizeof(AST_object),\n    0,\n    (destructor)ast_dealloc, /* tp_dealloc */\n    0,                       /* tp_print */\n    0,                       /* tp_getattr */\n    0,                       /* tp_setattr */\n    0,                       /* tp_reserved */\n    0,                       /* tp_repr */\n    0,                       /* tp_as_number */\n    0,                       /* tp_as_sequence */\n    0,                       /* tp_as_mapping */\n    0,                       /* tp_hash */\n    0,                       /* tp_call */\n    0,                       /* tp_str */\n    PyObject_GenericGetAttr, /* tp_getattro */\n    PyObject_GenericSetAttr, /* tp_setattro */\n    0,                       /* tp_as_buffer */\n    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, /* tp_flags */\n    0,                       /* tp_doc */\n    (traverseproc)ast_traverse, /* tp_traverse */\n    (inquiry)ast_clear,      /* tp_clear */\n    0,                       /* tp_richcompare */\n    0,                       /* tp_weaklistoffset */\n    0,                       /* tp_iter */\n    0,                       /* tp_iternext */\n    ast_type_methods,        /* tp_methods */\n    0,                       /* tp_members */\n    ast_type_getsets,        /* tp_getset */\n    0,                       /* tp_base */\n    0,                       /* tp_dict */\n    0,                       /* tp_descr_get */\n    0,                       /* tp_descr_set */\n    offsetof(AST_object, dict),/* tp_dictoffset */\n    (initproc)ast_type_init, /* tp_init */\n    PyType_GenericAlloc,     /* tp_alloc */\n    PyType_GenericNew,       /* tp_new */\n    PyObject_GC_Del,         /* tp_free */\n};\n\n\nstatic PyTypeObject* make_type(char *type, PyTypeObject* base, char**fields, int num_fields)\n{\n    _Py_IDENTIFIER(__module__);\n    _Py_static_string(PyId_typed_ast_ast3, \"typed_ast._ast3\");\n    PyObject *fnames, *result;\n    int i;\n    fnames = PyTuple_New(num_fields);\n    if (!fnames) return NULL;\n    for (i = 0; i < num_fields; i++) {\n        PyObject *field = PyUnicode_FromString(fields[i]);\n        if (!field) {\n            Py_DECREF(fnames);\n            return NULL;\n        }\n        PyTuple_SET_ITEM(fnames, i, field);\n    }\n    result = PyObject_CallFunction((PyObject*)&PyType_Type, \"s(O){OOOO}\",\n                    type, base,\n                    _PyUnicode_FromId(&PyId__fields), fnames,\n                    _PyUnicode_FromId(&PyId___module__),\n                    _PyUnicode_FromId(&PyId_typed_ast_ast3));\n    Py_DECREF(fnames);\n    return (PyTypeObject*)result;\n}\n\nstatic int add_attributes(PyTypeObject* type, char**attrs, int num_fields)\n{\n    int i, result;\n    PyObject *s, *l = PyTuple_New(num_fields);\n    if (!l)\n        return 0;\n    for (i = 0; i < num_fields; i++) {\n        s = PyUnicode_FromString(attrs[i]);\n        if (!s) {\n            Py_DECREF(l);\n            return 0;\n        }\n        PyTuple_SET_ITEM(l, i, s);\n    }\n    result = _PyObject_SetAttrId((PyObject*)type, &PyId__attributes, l) >= 0;\n    Py_DECREF(l);\n    return result;\n}\n\n/* Conversion AST -> Python */\n\nstatic PyObject* ast2obj_list(asdl_seq *seq, PyObject* (*func)(void*))\n{\n    Py_ssize_t i, n = asdl_seq_LEN(seq);\n    PyObject *result = PyList_New(n);\n    PyObject *value;\n    if (!result)\n        return NULL;\n    for (i = 0; i < n; i++) {\n        value = func(asdl_seq_GET(seq, i));\n        if (!value) {\n            Py_DECREF(result);\n            return NULL;\n        }\n        PyList_SET_ITEM(result, i, value);\n    }\n    return result;\n}\n\nstatic PyObject* ast2obj_object(void *o)\n{\n    if (!o)\n        o = Py_None;\n    Py_INCREF((PyObject*)o);\n    return (PyObject*)o;\n}\n#define ast2obj_singleton ast2obj_object\n#define ast2obj_constant ast2obj_object\n#define ast2obj_identifier ast2obj_object\n#define ast2obj_string ast2obj_object\n#define ast2obj_bytes ast2obj_object\n\nstatic PyObject* ast2obj_int(long b)\n{\n    return PyLong_FromLong(b);\n}\n\n/* Conversion Python -> AST */\n\nstatic int obj2ast_singleton(PyObject *obj, PyObject** out, PyArena* arena)\n{\n    if (obj != Py_None && obj != Py_True && obj != Py_False) {\n        PyErr_SetString(PyExc_ValueError,\n                        \"AST singleton must be True, False, or None\");\n        return 1;\n    }\n    *out = obj;\n    return 0;\n}\n\nstatic int obj2ast_object(PyObject* obj, PyObject** out, PyArena* arena)\n{\n    if (obj == Py_None)\n        obj = NULL;\n    if (obj) {\n        if (PyArena_AddPyObject(arena, obj) < 0) {\n            *out = NULL;\n            return -1;\n        }\n        Py_INCREF(obj);\n    }\n    *out = obj;\n    return 0;\n}\n\nstatic int obj2ast_constant(PyObject* obj, PyObject** out, PyArena* arena)\n{\n    if (obj) {\n        if (PyArena_AddPyObject(arena, obj) < 0) {\n            *out = NULL;\n            return -1;\n        }\n        Py_INCREF(obj);\n    }\n    *out = obj;\n    return 0;\n}\n\nstatic int obj2ast_identifier(PyObject* obj, PyObject** out, PyArena* arena)\n{\n    if (!PyUnicode_CheckExact(obj) && obj != Py_None) {\n        PyErr_SetString(PyExc_TypeError, \"AST identifier must be of type str\");\n        return 1;\n    }\n    return obj2ast_object(obj, out, arena);\n}\n\nstatic int obj2ast_string(PyObject* obj, PyObject** out, PyArena* arena)\n{\n    if (!PyUnicode_CheckExact(obj) && !PyBytes_CheckExact(obj)) {\n        PyErr_SetString(PyExc_TypeError, \"AST string must be of type str\");\n        return 1;\n    }\n    return obj2ast_object(obj, out, arena);\n}\n\nstatic int obj2ast_bytes(PyObject* obj, PyObject** out, PyArena* arena)\n{\n    if (!PyBytes_CheckExact(obj)) {\n        PyErr_SetString(PyExc_TypeError, \"AST bytes must be of type bytes\");\n        return 1;\n    }\n    return obj2ast_object(obj, out, arena);\n}\n\nstatic int obj2ast_int(PyObject* obj, int* out, PyArena* arena)\n{\n    int i;\n    if (!PyLong_Check(obj)) {\n        PyErr_Format(PyExc_ValueError, \"invalid integer value: %R\", obj);\n        return 1;\n    }\n\n    i = _PyLong_AsInt(obj);\n    if (i == -1 && PyErr_Occurred())\n        return 1;\n    *out = i;\n    return 0;\n}\n\nstatic int add_ast_fields(void)\n{\n    PyObject *empty_tuple, *d;\n    if (PyType_Ready(&AST_type) < 0)\n        return -1;\n    d = AST_type.tp_dict;\n    empty_tuple = PyTuple_New(0);\n    if (!empty_tuple ||\n        _PyDict_SetItemId(d, &PyId__fields, empty_tuple) < 0 ||\n        _PyDict_SetItemId(d, &PyId__attributes, empty_tuple) < 0) {\n        Py_XDECREF(empty_tuple);\n        return -1;\n    }\n    Py_DECREF(empty_tuple);\n    return 0;\n}\n\n\nstatic int init_types(void)\n{\n    static int initialized;\n    if (initialized) return 1;\n    if (add_ast_fields() < 0) return 0;\n    mod_type = make_type(\"mod\", &AST_type, NULL, 0);\n    if (!mod_type) return 0;\n    if (!add_attributes(mod_type, NULL, 0)) return 0;\n    Module_type = make_type(\"Module\", mod_type, Module_fields, 2);\n    if (!Module_type) return 0;\n    Interactive_type = make_type(\"Interactive\", mod_type, Interactive_fields,\n                                 1);\n    if (!Interactive_type) return 0;\n    Expression_type = make_type(\"Expression\", mod_type, Expression_fields, 1);\n    if (!Expression_type) return 0;\n    FunctionType_type = make_type(\"FunctionType\", mod_type,\n                                  FunctionType_fields, 2);\n    if (!FunctionType_type) return 0;\n    Suite_type = make_type(\"Suite\", mod_type, Suite_fields, 1);\n    if (!Suite_type) return 0;\n    stmt_type = make_type(\"stmt\", &AST_type, NULL, 0);\n    if (!stmt_type) return 0;\n    if (!add_attributes(stmt_type, stmt_attributes, 2)) return 0;\n    FunctionDef_type = make_type(\"FunctionDef\", stmt_type, FunctionDef_fields,\n                                 6);\n    if (!FunctionDef_type) return 0;\n    AsyncFunctionDef_type = make_type(\"AsyncFunctionDef\", stmt_type,\n                                      AsyncFunctionDef_fields, 6);\n    if (!AsyncFunctionDef_type) return 0;\n    ClassDef_type = make_type(\"ClassDef\", stmt_type, ClassDef_fields, 5);\n    if (!ClassDef_type) return 0;\n    Return_type = make_type(\"Return\", stmt_type, Return_fields, 1);\n    if (!Return_type) return 0;\n    Delete_type = make_type(\"Delete\", stmt_type, Delete_fields, 1);\n    if (!Delete_type) return 0;\n    Assign_type = make_type(\"Assign\", stmt_type, Assign_fields, 3);\n    if (!Assign_type) return 0;\n    AugAssign_type = make_type(\"AugAssign\", stmt_type, AugAssign_fields, 3);\n    if (!AugAssign_type) return 0;\n    AnnAssign_type = make_type(\"AnnAssign\", stmt_type, AnnAssign_fields, 4);\n    if (!AnnAssign_type) return 0;\n    For_type = make_type(\"For\", stmt_type, For_fields, 5);\n    if (!For_type) return 0;\n    AsyncFor_type = make_type(\"AsyncFor\", stmt_type, AsyncFor_fields, 5);\n    if (!AsyncFor_type) return 0;\n    While_type = make_type(\"While\", stmt_type, While_fields, 3);\n    if (!While_type) return 0;\n    If_type = make_type(\"If\", stmt_type, If_fields, 3);\n    if (!If_type) return 0;\n    With_type = make_type(\"With\", stmt_type, With_fields, 3);\n    if (!With_type) return 0;\n    AsyncWith_type = make_type(\"AsyncWith\", stmt_type, AsyncWith_fields, 3);\n    if (!AsyncWith_type) return 0;\n    Raise_type = make_type(\"Raise\", stmt_type, Raise_fields, 2);\n    if (!Raise_type) return 0;\n    Try_type = make_type(\"Try\", stmt_type, Try_fields, 4);\n    if (!Try_type) return 0;\n    Assert_type = make_type(\"Assert\", stmt_type, Assert_fields, 2);\n    if (!Assert_type) return 0;\n    Import_type = make_type(\"Import\", stmt_type, Import_fields, 1);\n    if (!Import_type) return 0;\n    ImportFrom_type = make_type(\"ImportFrom\", stmt_type, ImportFrom_fields, 3);\n    if (!ImportFrom_type) return 0;\n    Global_type = make_type(\"Global\", stmt_type, Global_fields, 1);\n    if (!Global_type) return 0;\n    Nonlocal_type = make_type(\"Nonlocal\", stmt_type, Nonlocal_fields, 1);\n    if (!Nonlocal_type) return 0;\n    Expr_type = make_type(\"Expr\", stmt_type, Expr_fields, 1);\n    if (!Expr_type) return 0;\n    Pass_type = make_type(\"Pass\", stmt_type, NULL, 0);\n    if (!Pass_type) return 0;\n    Break_type = make_type(\"Break\", stmt_type, NULL, 0);\n    if (!Break_type) return 0;\n    Continue_type = make_type(\"Continue\", stmt_type, NULL, 0);\n    if (!Continue_type) return 0;\n    expr_type = make_type(\"expr\", &AST_type, NULL, 0);\n    if (!expr_type) return 0;\n    if (!add_attributes(expr_type, expr_attributes, 2)) return 0;\n    BoolOp_type = make_type(\"BoolOp\", expr_type, BoolOp_fields, 2);\n    if (!BoolOp_type) return 0;\n    BinOp_type = make_type(\"BinOp\", expr_type, BinOp_fields, 3);\n    if (!BinOp_type) return 0;\n    UnaryOp_type = make_type(\"UnaryOp\", expr_type, UnaryOp_fields, 2);\n    if (!UnaryOp_type) return 0;\n    Lambda_type = make_type(\"Lambda\", expr_type, Lambda_fields, 2);\n    if (!Lambda_type) return 0;\n    IfExp_type = make_type(\"IfExp\", expr_type, IfExp_fields, 3);\n    if (!IfExp_type) return 0;\n    Dict_type = make_type(\"Dict\", expr_type, Dict_fields, 2);\n    if (!Dict_type) return 0;\n    Set_type = make_type(\"Set\", expr_type, Set_fields, 1);\n    if (!Set_type) return 0;\n    ListComp_type = make_type(\"ListComp\", expr_type, ListComp_fields, 2);\n    if (!ListComp_type) return 0;\n    SetComp_type = make_type(\"SetComp\", expr_type, SetComp_fields, 2);\n    if (!SetComp_type) return 0;\n    DictComp_type = make_type(\"DictComp\", expr_type, DictComp_fields, 3);\n    if (!DictComp_type) return 0;\n    GeneratorExp_type = make_type(\"GeneratorExp\", expr_type,\n                                  GeneratorExp_fields, 2);\n    if (!GeneratorExp_type) return 0;\n    Await_type = make_type(\"Await\", expr_type, Await_fields, 1);\n    if (!Await_type) return 0;\n    Yield_type = make_type(\"Yield\", expr_type, Yield_fields, 1);\n    if (!Yield_type) return 0;\n    YieldFrom_type = make_type(\"YieldFrom\", expr_type, YieldFrom_fields, 1);\n    if (!YieldFrom_type) return 0;\n    Compare_type = make_type(\"Compare\", expr_type, Compare_fields, 3);\n    if (!Compare_type) return 0;\n    Call_type = make_type(\"Call\", expr_type, Call_fields, 3);\n    if (!Call_type) return 0;\n    Num_type = make_type(\"Num\", expr_type, Num_fields, 1);\n    if (!Num_type) return 0;\n    Str_type = make_type(\"Str\", expr_type, Str_fields, 2);\n    if (!Str_type) return 0;\n    FormattedValue_type = make_type(\"FormattedValue\", expr_type,\n                                    FormattedValue_fields, 3);\n    if (!FormattedValue_type) return 0;\n    JoinedStr_type = make_type(\"JoinedStr\", expr_type, JoinedStr_fields, 1);\n    if (!JoinedStr_type) return 0;\n    Bytes_type = make_type(\"Bytes\", expr_type, Bytes_fields, 2);\n    if (!Bytes_type) return 0;\n    NameConstant_type = make_type(\"NameConstant\", expr_type,\n                                  NameConstant_fields, 1);\n    if (!NameConstant_type) return 0;\n    Ellipsis_type = make_type(\"Ellipsis\", expr_type, NULL, 0);\n    if (!Ellipsis_type) return 0;\n    Constant_type = make_type(\"Constant\", expr_type, Constant_fields, 1);\n    if (!Constant_type) return 0;\n    Attribute_type = make_type(\"Attribute\", expr_type, Attribute_fields, 3);\n    if (!Attribute_type) return 0;\n    Subscript_type = make_type(\"Subscript\", expr_type, Subscript_fields, 3);\n    if (!Subscript_type) return 0;\n    Starred_type = make_type(\"Starred\", expr_type, Starred_fields, 2);\n    if (!Starred_type) return 0;\n    Name_type = make_type(\"Name\", expr_type, Name_fields, 2);\n    if (!Name_type) return 0;\n    List_type = make_type(\"List\", expr_type, List_fields, 2);\n    if (!List_type) return 0;\n    Tuple_type = make_type(\"Tuple\", expr_type, Tuple_fields, 2);\n    if (!Tuple_type) return 0;\n    expr_context_type = make_type(\"expr_context\", &AST_type, NULL, 0);\n    if (!expr_context_type) return 0;\n    if (!add_attributes(expr_context_type, NULL, 0)) return 0;\n    Load_type = make_type(\"Load\", expr_context_type, NULL, 0);\n    if (!Load_type) return 0;\n    Load_singleton = PyType_GenericNew(Load_type, NULL, NULL);\n    if (!Load_singleton) return 0;\n    Store_type = make_type(\"Store\", expr_context_type, NULL, 0);\n    if (!Store_type) return 0;\n    Store_singleton = PyType_GenericNew(Store_type, NULL, NULL);\n    if (!Store_singleton) return 0;\n    Del_type = make_type(\"Del\", expr_context_type, NULL, 0);\n    if (!Del_type) return 0;\n    Del_singleton = PyType_GenericNew(Del_type, NULL, NULL);\n    if (!Del_singleton) return 0;\n    AugLoad_type = make_type(\"AugLoad\", expr_context_type, NULL, 0);\n    if (!AugLoad_type) return 0;\n    AugLoad_singleton = PyType_GenericNew(AugLoad_type, NULL, NULL);\n    if (!AugLoad_singleton) return 0;\n    AugStore_type = make_type(\"AugStore\", expr_context_type, NULL, 0);\n    if (!AugStore_type) return 0;\n    AugStore_singleton = PyType_GenericNew(AugStore_type, NULL, NULL);\n    if (!AugStore_singleton) return 0;\n    Param_type = make_type(\"Param\", expr_context_type, NULL, 0);\n    if (!Param_type) return 0;\n    Param_singleton = PyType_GenericNew(Param_type, NULL, NULL);\n    if (!Param_singleton) return 0;\n    slice_type = make_type(\"slice\", &AST_type, NULL, 0);\n    if (!slice_type) return 0;\n    if (!add_attributes(slice_type, NULL, 0)) return 0;\n    Slice_type = make_type(\"Slice\", slice_type, Slice_fields, 3);\n    if (!Slice_type) return 0;\n    ExtSlice_type = make_type(\"ExtSlice\", slice_type, ExtSlice_fields, 1);\n    if (!ExtSlice_type) return 0;\n    Index_type = make_type(\"Index\", slice_type, Index_fields, 1);\n    if (!Index_type) return 0;\n    boolop_type = make_type(\"boolop\", &AST_type, NULL, 0);\n    if (!boolop_type) return 0;\n    if (!add_attributes(boolop_type, NULL, 0)) return 0;\n    And_type = make_type(\"And\", boolop_type, NULL, 0);\n    if (!And_type) return 0;\n    And_singleton = PyType_GenericNew(And_type, NULL, NULL);\n    if (!And_singleton) return 0;\n    Or_type = make_type(\"Or\", boolop_type, NULL, 0);\n    if (!Or_type) return 0;\n    Or_singleton = PyType_GenericNew(Or_type, NULL, NULL);\n    if (!Or_singleton) return 0;\n    operator_type = make_type(\"operator\", &AST_type, NULL, 0);\n    if (!operator_type) return 0;\n    if (!add_attributes(operator_type, NULL, 0)) return 0;\n    Add_type = make_type(\"Add\", operator_type, NULL, 0);\n    if (!Add_type) return 0;\n    Add_singleton = PyType_GenericNew(Add_type, NULL, NULL);\n    if (!Add_singleton) return 0;\n    Sub_type = make_type(\"Sub\", operator_type, NULL, 0);\n    if (!Sub_type) return 0;\n    Sub_singleton = PyType_GenericNew(Sub_type, NULL, NULL);\n    if (!Sub_singleton) return 0;\n    Mult_type = make_type(\"Mult\", operator_type, NULL, 0);\n    if (!Mult_type) return 0;\n    Mult_singleton = PyType_GenericNew(Mult_type, NULL, NULL);\n    if (!Mult_singleton) return 0;\n    MatMult_type = make_type(\"MatMult\", operator_type, NULL, 0);\n    if (!MatMult_type) return 0;\n    MatMult_singleton = PyType_GenericNew(MatMult_type, NULL, NULL);\n    if (!MatMult_singleton) return 0;\n    Div_type = make_type(\"Div\", operator_type, NULL, 0);\n    if (!Div_type) return 0;\n    Div_singleton = PyType_GenericNew(Div_type, NULL, NULL);\n    if (!Div_singleton) return 0;\n    Mod_type = make_type(\"Mod\", operator_type, NULL, 0);\n    if (!Mod_type) return 0;\n    Mod_singleton = PyType_GenericNew(Mod_type, NULL, NULL);\n    if (!Mod_singleton) return 0;\n    Pow_type = make_type(\"Pow\", operator_type, NULL, 0);\n    if (!Pow_type) return 0;\n    Pow_singleton = PyType_GenericNew(Pow_type, NULL, NULL);\n    if (!Pow_singleton) return 0;\n    LShift_type = make_type(\"LShift\", operator_type, NULL, 0);\n    if (!LShift_type) return 0;\n    LShift_singleton = PyType_GenericNew(LShift_type, NULL, NULL);\n    if (!LShift_singleton) return 0;\n    RShift_type = make_type(\"RShift\", operator_type, NULL, 0);\n    if (!RShift_type) return 0;\n    RShift_singleton = PyType_GenericNew(RShift_type, NULL, NULL);\n    if (!RShift_singleton) return 0;\n    BitOr_type = make_type(\"BitOr\", operator_type, NULL, 0);\n    if (!BitOr_type) return 0;\n    BitOr_singleton = PyType_GenericNew(BitOr_type, NULL, NULL);\n    if (!BitOr_singleton) return 0;\n    BitXor_type = make_type(\"BitXor\", operator_type, NULL, 0);\n    if (!BitXor_type) return 0;\n    BitXor_singleton = PyType_GenericNew(BitXor_type, NULL, NULL);\n    if (!BitXor_singleton) return 0;\n    BitAnd_type = make_type(\"BitAnd\", operator_type, NULL, 0);\n    if (!BitAnd_type) return 0;\n    BitAnd_singleton = PyType_GenericNew(BitAnd_type, NULL, NULL);\n    if (!BitAnd_singleton) return 0;\n    FloorDiv_type = make_type(\"FloorDiv\", operator_type, NULL, 0);\n    if (!FloorDiv_type) return 0;\n    FloorDiv_singleton = PyType_GenericNew(FloorDiv_type, NULL, NULL);\n    if (!FloorDiv_singleton) return 0;\n    unaryop_type = make_type(\"unaryop\", &AST_type, NULL, 0);\n    if (!unaryop_type) return 0;\n    if (!add_attributes(unaryop_type, NULL, 0)) return 0;\n    Invert_type = make_type(\"Invert\", unaryop_type, NULL, 0);\n    if (!Invert_type) return 0;\n    Invert_singleton = PyType_GenericNew(Invert_type, NULL, NULL);\n    if (!Invert_singleton) return 0;\n    Not_type = make_type(\"Not\", unaryop_type, NULL, 0);\n    if (!Not_type) return 0;\n    Not_singleton = PyType_GenericNew(Not_type, NULL, NULL);\n    if (!Not_singleton) return 0;\n    UAdd_type = make_type(\"UAdd\", unaryop_type, NULL, 0);\n    if (!UAdd_type) return 0;\n    UAdd_singleton = PyType_GenericNew(UAdd_type, NULL, NULL);\n    if (!UAdd_singleton) return 0;\n    USub_type = make_type(\"USub\", unaryop_type, NULL, 0);\n    if (!USub_type) return 0;\n    USub_singleton = PyType_GenericNew(USub_type, NULL, NULL);\n    if (!USub_singleton) return 0;\n    cmpop_type = make_type(\"cmpop\", &AST_type, NULL, 0);\n    if (!cmpop_type) return 0;\n    if (!add_attributes(cmpop_type, NULL, 0)) return 0;\n    Eq_type = make_type(\"Eq\", cmpop_type, NULL, 0);\n    if (!Eq_type) return 0;\n    Eq_singleton = PyType_GenericNew(Eq_type, NULL, NULL);\n    if (!Eq_singleton) return 0;\n    NotEq_type = make_type(\"NotEq\", cmpop_type, NULL, 0);\n    if (!NotEq_type) return 0;\n    NotEq_singleton = PyType_GenericNew(NotEq_type, NULL, NULL);\n    if (!NotEq_singleton) return 0;\n    Lt_type = make_type(\"Lt\", cmpop_type, NULL, 0);\n    if (!Lt_type) return 0;\n    Lt_singleton = PyType_GenericNew(Lt_type, NULL, NULL);\n    if (!Lt_singleton) return 0;\n    LtE_type = make_type(\"LtE\", cmpop_type, NULL, 0);\n    if (!LtE_type) return 0;\n    LtE_singleton = PyType_GenericNew(LtE_type, NULL, NULL);\n    if (!LtE_singleton) return 0;\n    Gt_type = make_type(\"Gt\", cmpop_type, NULL, 0);\n    if (!Gt_type) return 0;\n    Gt_singleton = PyType_GenericNew(Gt_type, NULL, NULL);\n    if (!Gt_singleton) return 0;\n    GtE_type = make_type(\"GtE\", cmpop_type, NULL, 0);\n    if (!GtE_type) return 0;\n    GtE_singleton = PyType_GenericNew(GtE_type, NULL, NULL);\n    if (!GtE_singleton) return 0;\n    Is_type = make_type(\"Is\", cmpop_type, NULL, 0);\n    if (!Is_type) return 0;\n    Is_singleton = PyType_GenericNew(Is_type, NULL, NULL);\n    if (!Is_singleton) return 0;\n    IsNot_type = make_type(\"IsNot\", cmpop_type, NULL, 0);\n    if (!IsNot_type) return 0;\n    IsNot_singleton = PyType_GenericNew(IsNot_type, NULL, NULL);\n    if (!IsNot_singleton) return 0;\n    In_type = make_type(\"In\", cmpop_type, NULL, 0);\n    if (!In_type) return 0;\n    In_singleton = PyType_GenericNew(In_type, NULL, NULL);\n    if (!In_singleton) return 0;\n    NotIn_type = make_type(\"NotIn\", cmpop_type, NULL, 0);\n    if (!NotIn_type) return 0;\n    NotIn_singleton = PyType_GenericNew(NotIn_type, NULL, NULL);\n    if (!NotIn_singleton) return 0;\n    comprehension_type = make_type(\"comprehension\", &AST_type,\n                                   comprehension_fields, 4);\n    if (!comprehension_type) return 0;\n    if (!add_attributes(comprehension_type, NULL, 0)) return 0;\n    excepthandler_type = make_type(\"excepthandler\", &AST_type, NULL, 0);\n    if (!excepthandler_type) return 0;\n    if (!add_attributes(excepthandler_type, excepthandler_attributes, 2))\n        return 0;\n    ExceptHandler_type = make_type(\"ExceptHandler\", excepthandler_type,\n                                   ExceptHandler_fields, 3);\n    if (!ExceptHandler_type) return 0;\n    arguments_type = make_type(\"arguments\", &AST_type, arguments_fields, 6);\n    if (!arguments_type) return 0;\n    if (!add_attributes(arguments_type, NULL, 0)) return 0;\n    arg_type = make_type(\"arg\", &AST_type, arg_fields, 3);\n    if (!arg_type) return 0;\n    if (!add_attributes(arg_type, arg_attributes, 2)) return 0;\n    keyword_type = make_type(\"keyword\", &AST_type, keyword_fields, 2);\n    if (!keyword_type) return 0;\n    if (!add_attributes(keyword_type, NULL, 0)) return 0;\n    alias_type = make_type(\"alias\", &AST_type, alias_fields, 2);\n    if (!alias_type) return 0;\n    if (!add_attributes(alias_type, NULL, 0)) return 0;\n    withitem_type = make_type(\"withitem\", &AST_type, withitem_fields, 2);\n    if (!withitem_type) return 0;\n    if (!add_attributes(withitem_type, NULL, 0)) return 0;\n    type_ignore_type = make_type(\"type_ignore\", &AST_type, NULL, 0);\n    if (!type_ignore_type) return 0;\n    if (!add_attributes(type_ignore_type, NULL, 0)) return 0;\n    TypeIgnore_type = make_type(\"TypeIgnore\", type_ignore_type,\n                                TypeIgnore_fields, 2);\n    if (!TypeIgnore_type) return 0;\n    initialized = 1;\n    return 1;\n}\n\nstatic int obj2ast_mod(PyObject* obj, mod_ty* out, PyArena* arena);\nstatic int obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena);\nstatic int obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena);\nstatic int obj2ast_expr_context(PyObject* obj, expr_context_ty* out, PyArena*\n                                arena);\nstatic int obj2ast_slice(PyObject* obj, slice_ty* out, PyArena* arena);\nstatic int obj2ast_boolop(PyObject* obj, boolop_ty* out, PyArena* arena);\nstatic int obj2ast_operator(PyObject* obj, operator_ty* out, PyArena* arena);\nstatic int obj2ast_unaryop(PyObject* obj, unaryop_ty* out, PyArena* arena);\nstatic int obj2ast_cmpop(PyObject* obj, cmpop_ty* out, PyArena* arena);\nstatic int obj2ast_comprehension(PyObject* obj, comprehension_ty* out, PyArena*\n                                 arena);\nstatic int obj2ast_excepthandler(PyObject* obj, excepthandler_ty* out, PyArena*\n                                 arena);\nstatic int obj2ast_arguments(PyObject* obj, arguments_ty* out, PyArena* arena);\nstatic int obj2ast_arg(PyObject* obj, arg_ty* out, PyArena* arena);\nstatic int obj2ast_keyword(PyObject* obj, keyword_ty* out, PyArena* arena);\nstatic int obj2ast_alias(PyObject* obj, alias_ty* out, PyArena* arena);\nstatic int obj2ast_withitem(PyObject* obj, withitem_ty* out, PyArena* arena);\nstatic int obj2ast_type_ignore(PyObject* obj, type_ignore_ty* out, PyArena*\n                               arena);\n\nmod_ty\nModule(asdl_seq * body, asdl_seq * type_ignores, PyArena *arena)\n{\n    mod_ty p;\n    p = (mod_ty)PyArena_Malloc(arena, sizeof(*p));\n    if (!p)\n        return NULL;\n    p->kind = Module_kind;\n    p->v.Module.body = body;\n    p->v.Module.type_ignores = type_ignores;\n    return p;\n}\n\nmod_ty\nInteractive(asdl_seq * body, PyArena *arena)\n{\n    mod_ty p;\n    p = (mod_ty)PyArena_Malloc(arena, sizeof(*p));\n    if (!p)\n        return NULL;\n    p->kind = Interactive_kind;\n    p->v.Interactive.body = body;\n    return p;\n}\n\nmod_ty\nExpression(expr_ty body, PyArena *arena)\n{\n    mod_ty p;\n    if (!body) {\n        PyErr_SetString(PyExc_ValueError,\n                        \"field body is required for Expression\");\n        return NULL;\n    }\n    p = (mod_ty)PyArena_Malloc(arena, sizeof(*p));\n    if (!p)\n        return NULL;\n    p->kind = Expression_kind;\n    p->v.Expression.body = body;\n    return p;\n}\n\nmod_ty\nFunctionType(asdl_seq * argtypes, expr_ty returns, PyArena *arena)\n{\n    mod_ty p;\n    if (!returns) {\n        PyErr_SetString(PyExc_ValueError,\n                        \"field returns is required for FunctionType\");\n        return NULL;\n    }\n    p = (mod_ty)PyArena_Malloc(arena, sizeof(*p));\n    if (!p)\n        return NULL;\n    p->kind = FunctionType_kind;\n    p->v.FunctionType.argtypes = argtypes;\n    p->v.FunctionType.returns = returns;\n    return p;\n}\n\nmod_ty\nSuite(asdl_seq * body, PyArena *arena)\n{\n    mod_ty p;\n    p = (mod_ty)PyArena_Malloc(arena, sizeof(*p));\n    if (!p)\n        return NULL;\n    p->kind = Suite_kind;\n    p->v.Suite.body = body;\n    return p;\n}\n\nstmt_ty\nFunctionDef(identifier name, arguments_ty args, asdl_seq * body, asdl_seq *\n            decorator_list, expr_ty returns, string type_comment, int lineno,\n            int col_offset, PyArena *arena)\n{\n    stmt_ty p;\n    if (!name) {\n        PyErr_SetString(PyExc_ValueError,\n                        \"field name is required for FunctionDef\");\n        return NULL;\n    }\n    if (!args) {\n        PyErr_SetString(PyExc_ValueError,\n                        \"field args is required for FunctionDef\");\n        return NULL;\n    }\n    p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));\n    if (!p)\n        return NULL;\n    p->kind = FunctionDef_kind;\n    p->v.FunctionDef.name = name;\n    p->v.FunctionDef.args = args;\n    p->v.FunctionDef.body = body;\n    p->v.FunctionDef.decorator_list = decorator_list;\n    p->v.FunctionDef.returns = returns;\n    p->v.FunctionDef.type_comment = type_comment;\n    p->lineno = lineno;\n    p->col_offset = col_offset;\n    return p;\n}\n\nstmt_ty\nAsyncFunctionDef(identifier name, arguments_ty args, asdl_seq * body, asdl_seq\n                 * decorator_list, expr_ty returns, string type_comment, int\n                 lineno, int col_offset, PyArena *arena)\n{\n    stmt_ty p;\n    if (!name) {\n        PyErr_SetString(PyExc_ValueError,\n                        \"field name is required for AsyncFunctionDef\");\n        return NULL;\n    }\n    if (!args) {\n        PyErr_SetString(PyExc_ValueError,\n                        \"field args is required for AsyncFunctionDef\");\n        return NULL;\n    }\n    p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));\n    if (!p)\n        return NULL;\n    p->kind = AsyncFunctionDef_kind;\n    p->v.AsyncFunctionDef.name = name;\n    p->v.AsyncFunctionDef.args = args;\n    p->v.AsyncFunctionDef.body = body;\n    p->v.AsyncFunctionDef.decorator_list = decorator_list;\n    p->v.AsyncFunctionDef.returns = returns;\n    p->v.AsyncFunctionDef.type_comment = type_comment;\n    p->lineno = lineno;\n    p->col_offset = col_offset;\n    return p;\n}\n\nstmt_ty\nClassDef(identifier name, asdl_seq * bases, asdl_seq * keywords, asdl_seq *\n         body, asdl_seq * decorator_list, int lineno, int col_offset, PyArena\n         *arena)\n{\n    stmt_ty p;\n    if (!name) {\n        PyErr_SetString(PyExc_ValueError,\n                        \"field name is required for ClassDef\");\n        return NULL;\n    }\n    p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));\n    if (!p)\n        return NULL;\n    p->kind = ClassDef_kind;\n    p->v.ClassDef.name = name;\n    p->v.ClassDef.bases = bases;\n    p->v.ClassDef.keywords = keywords;\n    p->v.ClassDef.body = body;\n    p->v.ClassDef.decorator_list = decorator_list;\n    p->lineno = lineno;\n    p->col_offset = col_offset;\n    return p;\n}\n\nstmt_ty\nReturn(expr_ty value, int lineno, int col_offset, PyArena *arena)\n{\n    stmt_ty p;\n    p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));\n    if (!p)\n        return NULL;\n    p->kind = Return_kind;\n    p->v.Return.value = value;\n    p->lineno = lineno;\n    p->col_offset = col_offset;\n    return p;\n}\n\nstmt_ty\nDelete(asdl_seq * targets, int lineno, int col_offset, PyArena *arena)\n{\n    stmt_ty p;\n    p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));\n    if (!p)\n        return NULL;\n    p->kind = Delete_kind;\n    p->v.Delete.targets = targets;\n    p->lineno = lineno;\n    p->col_offset = col_offset;\n    return p;\n}\n\nstmt_ty\nAssign(asdl_seq * targets, expr_ty value, string type_comment, int lineno, int\n       col_offset, PyArena *arena)\n{\n    stmt_ty p;\n    if (!value) {\n        PyErr_SetString(PyExc_ValueError,\n                        \"field value is required for Assign\");\n        return NULL;\n    }\n    p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));\n    if (!p)\n        return NULL;\n    p->kind = Assign_kind;\n    p->v.Assign.targets = targets;\n    p->v.Assign.value = value;\n    p->v.Assign.type_comment = type_comment;\n    p->lineno = lineno;\n    p->col_offset = col_offset;\n    return p;\n}\n\nstmt_ty\nAugAssign(expr_ty target, operator_ty op, expr_ty value, int lineno, int\n          col_offset, PyArena *arena)\n{\n    stmt_ty p;\n    if (!target) {\n        PyErr_SetString(PyExc_ValueError,\n                        \"field target is required for AugAssign\");\n        return NULL;\n    }\n    if (!op) {\n        PyErr_SetString(PyExc_ValueError,\n                        \"field op is required for AugAssign\");\n        return NULL;\n    }\n    if (!value) {\n        PyErr_SetString(PyExc_ValueError,\n                        \"field value is required for AugAssign\");\n        return NULL;\n    }\n    p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));\n    if (!p)\n        return NULL;\n    p->kind = AugAssign_kind;\n    p->v.AugAssign.target = target;\n    p->v.AugAssign.op = op;\n    p->v.AugAssign.value = value;\n    p->lineno = lineno;\n    p->col_offset = col_offset;\n    return p;\n}\n\nstmt_ty\nAnnAssign(expr_ty target, expr_ty annotation, expr_ty value, int simple, int\n          lineno, int col_offset, PyArena *arena)\n{\n    stmt_ty p;\n    if (!target) {\n        PyErr_SetString(PyExc_ValueError,\n                        \"field target is required for AnnAssign\");\n        return NULL;\n    }\n    if (!annotation) {\n        PyErr_SetString(PyExc_ValueError,\n                        \"field annotation is required for AnnAssign\");\n        return NULL;\n    }\n    p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));\n    if (!p)\n        return NULL;\n    p->kind = AnnAssign_kind;\n    p->v.AnnAssign.target = target;\n    p->v.AnnAssign.annotation = annotation;\n    p->v.AnnAssign.value = value;\n    p->v.AnnAssign.simple = simple;\n    p->lineno = lineno;\n    p->col_offset = col_offset;\n    return p;\n}\n\nstmt_ty\nFor(expr_ty target, expr_ty iter, asdl_seq * body, asdl_seq * orelse, string\n    type_comment, int lineno, int col_offset, PyArena *arena)\n{\n    stmt_ty p;\n    if (!target) {\n        PyErr_SetString(PyExc_ValueError,\n                        \"field target is required for For\");\n        return NULL;\n    }\n    if (!iter) {\n        PyErr_SetString(PyExc_ValueError,\n                        \"field iter is required for For\");\n        return NULL;\n    }\n    p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));\n    if (!p)\n        return NULL;\n    p->kind = For_kind;\n    p->v.For.target = target;\n    p->v.For.iter = iter;\n    p->v.For.body = body;\n    p->v.For.orelse = orelse;\n    p->v.For.type_comment = type_comment;\n    p->lineno = lineno;\n    p->col_offset = col_offset;\n    return p;\n}\n\nstmt_ty\nAsyncFor(expr_ty target, expr_ty iter, asdl_seq * body, asdl_seq * orelse,\n         string type_comment, int lineno, int col_offset, PyArena *arena)\n{\n    stmt_ty p;\n    if (!target) {\n        PyErr_SetString(PyExc_ValueError,\n                        \"field target is required for AsyncFor\");\n        return NULL;\n    }\n    if (!iter) {\n        PyErr_SetString(PyExc_ValueError,\n                        \"field iter is required for AsyncFor\");\n        return NULL;\n    }\n    p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));\n    if (!p)\n        return NULL;\n    p->kind = AsyncFor_kind;\n    p->v.AsyncFor.target = target;\n    p->v.AsyncFor.iter = iter;\n    p->v.AsyncFor.body = body;\n    p->v.AsyncFor.orelse = orelse;\n    p->v.AsyncFor.type_comment = type_comment;\n    p->lineno = lineno;\n    p->col_offset = col_offset;\n    return p;\n}\n\nstmt_ty\nWhile(expr_ty test, asdl_seq * body, asdl_seq * orelse, int lineno, int\n      col_offset, PyArena *arena)\n{\n    stmt_ty p;\n    if (!test) {\n        PyErr_SetString(PyExc_ValueError,\n                        \"field test is required for While\");\n        return NULL;\n    }\n    p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));\n    if (!p)\n        return NULL;\n    p->kind = While_kind;\n    p->v.While.test = test;\n    p->v.While.body = body;\n    p->v.While.orelse = orelse;\n    p->lineno = lineno;\n    p->col_offset = col_offset;\n    return p;\n}\n\nstmt_ty\nIf(expr_ty test, asdl_seq * body, asdl_seq * orelse, int lineno, int\n   col_offset, PyArena *arena)\n{\n    stmt_ty p;\n    if (!test) {\n        PyErr_SetString(PyExc_ValueError,\n                        \"field test is required for If\");\n        return NULL;\n    }\n    p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));\n    if (!p)\n        return NULL;\n    p->kind = If_kind;\n    p->v.If.test = test;\n    p->v.If.body = body;\n    p->v.If.orelse = orelse;\n    p->lineno = lineno;\n    p->col_offset = col_offset;\n    return p;\n}\n\nstmt_ty\nWith(asdl_seq * items, asdl_seq * body, string type_comment, int lineno, int\n     col_offset, PyArena *arena)\n{\n    stmt_ty p;\n    p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));\n    if (!p)\n        return NULL;\n    p->kind = With_kind;\n    p->v.With.items = items;\n    p->v.With.body = body;\n    p->v.With.type_comment = type_comment;\n    p->lineno = lineno;\n    p->col_offset = col_offset;\n    return p;\n}\n\nstmt_ty\nAsyncWith(asdl_seq * items, asdl_seq * body, string type_comment, int lineno,\n          int col_offset, PyArena *arena)\n{\n    stmt_ty p;\n    p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));\n    if (!p)\n        return NULL;\n    p->kind = AsyncWith_kind;\n    p->v.AsyncWith.items = items;\n    p->v.AsyncWith.body = body;\n    p->v.AsyncWith.type_comment = type_comment;\n    p->lineno = lineno;\n    p->col_offset = col_offset;\n    return p;\n}\n\nstmt_ty\nRaise(expr_ty exc, expr_ty cause, int lineno, int col_offset, PyArena *arena)\n{\n    stmt_ty p;\n    p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));\n    if (!p)\n        return NULL;\n    p->kind = Raise_kind;\n    p->v.Raise.exc = exc;\n    p->v.Raise.cause = cause;\n    p->lineno = lineno;\n    p->col_offset = col_offset;\n    return p;\n}\n\nstmt_ty\nTry(asdl_seq * body, asdl_seq * handlers, asdl_seq * orelse, asdl_seq *\n    finalbody, int lineno, int col_offset, PyArena *arena)\n{\n    stmt_ty p;\n    p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));\n    if (!p)\n        return NULL;\n    p->kind = Try_kind;\n    p->v.Try.body = body;\n    p->v.Try.handlers = handlers;\n    p->v.Try.orelse = orelse;\n    p->v.Try.finalbody = finalbody;\n    p->lineno = lineno;\n    p->col_offset = col_offset;\n    return p;\n}\n\nstmt_ty\nAssert(expr_ty test, expr_ty msg, int lineno, int col_offset, PyArena *arena)\n{\n    stmt_ty p;\n    if (!test) {\n        PyErr_SetString(PyExc_ValueError,\n                        \"field test is required for Assert\");\n        return NULL;\n    }\n    p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));\n    if (!p)\n        return NULL;\n    p->kind = Assert_kind;\n    p->v.Assert.test = test;\n    p->v.Assert.msg = msg;\n    p->lineno = lineno;\n    p->col_offset = col_offset;\n    return p;\n}\n\nstmt_ty\nImport(asdl_seq * names, int lineno, int col_offset, PyArena *arena)\n{\n    stmt_ty p;\n    p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));\n    if (!p)\n        return NULL;\n    p->kind = Import_kind;\n    p->v.Import.names = names;\n    p->lineno = lineno;\n    p->col_offset = col_offset;\n    return p;\n}\n\nstmt_ty\nImportFrom(identifier module, asdl_seq * names, int level, int lineno, int\n           col_offset, PyArena *arena)\n{\n    stmt_ty p;\n    p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));\n    if (!p)\n        return NULL;\n    p->kind = ImportFrom_kind;\n    p->v.ImportFrom.module = module;\n    p->v.ImportFrom.names = names;\n    p->v.ImportFrom.level = level;\n    p->lineno = lineno;\n    p->col_offset = col_offset;\n    return p;\n}\n\nstmt_ty\nGlobal(asdl_seq * names, int lineno, int col_offset, PyArena *arena)\n{\n    stmt_ty p;\n    p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));\n    if (!p)\n        return NULL;\n    p->kind = Global_kind;\n    p->v.Global.names = names;\n    p->lineno = lineno;\n    p->col_offset = col_offset;\n    return p;\n}\n\nstmt_ty\nNonlocal(asdl_seq * names, int lineno, int col_offset, PyArena *arena)\n{\n    stmt_ty p;\n    p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));\n    if (!p)\n        return NULL;\n    p->kind = Nonlocal_kind;\n    p->v.Nonlocal.names = names;\n    p->lineno = lineno;\n    p->col_offset = col_offset;\n    return p;\n}\n\nstmt_ty\nExpr(expr_ty value, int lineno, int col_offset, PyArena *arena)\n{\n    stmt_ty p;\n    if (!value) {\n        PyErr_SetString(PyExc_ValueError,\n                        \"field value is required for Expr\");\n        return NULL;\n    }\n    p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));\n    if (!p)\n        return NULL;\n    p->kind = Expr_kind;\n    p->v.Expr.value = value;\n    p->lineno = lineno;\n    p->col_offset = col_offset;\n    return p;\n}\n\nstmt_ty\nPass(int lineno, int col_offset, PyArena *arena)\n{\n    stmt_ty p;\n    p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));\n    if (!p)\n        return NULL;\n    p->kind = Pass_kind;\n    p->lineno = lineno;\n    p->col_offset = col_offset;\n    return p;\n}\n\nstmt_ty\nBreak(int lineno, int col_offset, PyArena *arena)\n{\n    stmt_ty p;\n    p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));\n    if (!p)\n        return NULL;\n    p->kind = Break_kind;\n    p->lineno = lineno;\n    p->col_offset = col_offset;\n    return p;\n}\n\nstmt_ty\nContinue(int lineno, int col_offset, PyArena *arena)\n{\n    stmt_ty p;\n    p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));\n    if (!p)\n        return NULL;\n    p->kind = Continue_kind;\n    p->lineno = lineno;\n    p->col_offset = col_offset;\n    return p;\n}\n\nexpr_ty\nBoolOp(boolop_ty op, asdl_seq * values, int lineno, int col_offset, PyArena\n       *arena)\n{\n    expr_ty p;\n    if (!op) {\n        PyErr_SetString(PyExc_ValueError,\n                        \"field op is required for BoolOp\");\n        return NULL;\n    }\n    p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));\n    if (!p)\n        return NULL;\n    p->kind = BoolOp_kind;\n    p->v.BoolOp.op = op;\n    p->v.BoolOp.values = values;\n    p->lineno = lineno;\n    p->col_offset = col_offset;\n    return p;\n}\n\nexpr_ty\nBinOp(expr_ty left, operator_ty op, expr_ty right, int lineno, int col_offset,\n      PyArena *arena)\n{\n    expr_ty p;\n    if (!left) {\n        PyErr_SetString(PyExc_ValueError,\n                        \"field left is required for BinOp\");\n        return NULL;\n    }\n    if (!op) {\n        PyErr_SetString(PyExc_ValueError,\n                        \"field op is required for BinOp\");\n        return NULL;\n    }\n    if (!right) {\n        PyErr_SetString(PyExc_ValueError,\n                        \"field right is required for BinOp\");\n        return NULL;\n    }\n    p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));\n    if (!p)\n        return NULL;\n    p->kind = BinOp_kind;\n    p->v.BinOp.left = left;\n    p->v.BinOp.op = op;\n    p->v.BinOp.right = right;\n    p->lineno = lineno;\n    p->col_offset = col_offset;\n    return p;\n}\n\nexpr_ty\nUnaryOp(unaryop_ty op, expr_ty operand, int lineno, int col_offset, PyArena\n        *arena)\n{\n    expr_ty p;\n    if (!op) {\n        PyErr_SetString(PyExc_ValueError,\n                        \"field op is required for UnaryOp\");\n        return NULL;\n    }\n    if (!operand) {\n        PyErr_SetString(PyExc_ValueError,\n                        \"field operand is required for UnaryOp\");\n        return NULL;\n    }\n    p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));\n    if (!p)\n        return NULL;\n    p->kind = UnaryOp_kind;\n    p->v.UnaryOp.op = op;\n    p->v.UnaryOp.operand = operand;\n    p->lineno = lineno;\n    p->col_offset = col_offset;\n    return p;\n}\n\nexpr_ty\nLambda(arguments_ty args, expr_ty body, int lineno, int col_offset, PyArena\n       *arena)\n{\n    expr_ty p;\n    if (!args) {\n        PyErr_SetString(PyExc_ValueError,\n                        \"field args is required for Lambda\");\n        return NULL;\n    }\n    if (!body) {\n        PyErr_SetString(PyExc_ValueError,\n                        \"field body is required for Lambda\");\n        return NULL;\n    }\n    p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));\n    if (!p)\n        return NULL;\n    p->kind = Lambda_kind;\n    p->v.Lambda.args = args;\n    p->v.Lambda.body = body;\n    p->lineno = lineno;\n    p->col_offset = col_offset;\n    return p;\n}\n\nexpr_ty\nIfExp(expr_ty test, expr_ty body, expr_ty orelse, int lineno, int col_offset,\n      PyArena *arena)\n{\n    expr_ty p;\n    if (!test) {\n        PyErr_SetString(PyExc_ValueError,\n                        \"field test is required for IfExp\");\n        return NULL;\n    }\n    if (!body) {\n        PyErr_SetString(PyExc_ValueError,\n                        \"field body is required for IfExp\");\n        return NULL;\n    }\n    if (!orelse) {\n        PyErr_SetString(PyExc_ValueError,\n                        \"field orelse is required for IfExp\");\n        return NULL;\n    }\n    p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));\n    if (!p)\n        return NULL;\n    p->kind = IfExp_kind;\n    p->v.IfExp.test = test;\n    p->v.IfExp.body = body;\n    p->v.IfExp.orelse = orelse;\n    p->lineno = lineno;\n    p->col_offset = col_offset;\n    return p;\n}\n\nexpr_ty\nDict(asdl_seq * keys, asdl_seq * values, int lineno, int col_offset, PyArena\n     *arena)\n{\n    expr_ty p;\n    p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));\n    if (!p)\n        return NULL;\n    p->kind = Dict_kind;\n    p->v.Dict.keys = keys;\n    p->v.Dict.values = values;\n    p->lineno = lineno;\n    p->col_offset = col_offset;\n    return p;\n}\n\nexpr_ty\nSet(asdl_seq * elts, int lineno, int col_offset, PyArena *arena)\n{\n    expr_ty p;\n    p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));\n    if (!p)\n        return NULL;\n    p->kind = Set_kind;\n    p->v.Set.elts = elts;\n    p->lineno = lineno;\n    p->col_offset = col_offset;\n    return p;\n}\n\nexpr_ty\nListComp(expr_ty elt, asdl_seq * generators, int lineno, int col_offset,\n         PyArena *arena)\n{\n    expr_ty p;\n    if (!elt) {\n        PyErr_SetString(PyExc_ValueError,\n                        \"field elt is required for ListComp\");\n        return NULL;\n    }\n    p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));\n    if (!p)\n        return NULL;\n    p->kind = ListComp_kind;\n    p->v.ListComp.elt = elt;\n    p->v.ListComp.generators = generators;\n    p->lineno = lineno;\n    p->col_offset = col_offset;\n    return p;\n}\n\nexpr_ty\nSetComp(expr_ty elt, asdl_seq * generators, int lineno, int col_offset, PyArena\n        *arena)\n{\n    expr_ty p;\n    if (!elt) {\n        PyErr_SetString(PyExc_ValueError,\n                        \"field elt is required for SetComp\");\n        return NULL;\n    }\n    p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));\n    if (!p)\n        return NULL;\n    p->kind = SetComp_kind;\n    p->v.SetComp.elt = elt;\n    p->v.SetComp.generators = generators;\n    p->lineno = lineno;\n    p->col_offset = col_offset;\n    return p;\n}\n\nexpr_ty\nDictComp(expr_ty key, expr_ty value, asdl_seq * generators, int lineno, int\n         col_offset, PyArena *arena)\n{\n    expr_ty p;\n    if (!key) {\n        PyErr_SetString(PyExc_ValueError,\n                        \"field key is required for DictComp\");\n        return NULL;\n    }\n    if (!value) {\n        PyErr_SetString(PyExc_ValueError,\n                        \"field value is required for DictComp\");\n        return NULL;\n    }\n    p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));\n    if (!p)\n        return NULL;\n    p->kind = DictComp_kind;\n    p->v.DictComp.key = key;\n    p->v.DictComp.value = value;\n    p->v.DictComp.generators = generators;\n    p->lineno = lineno;\n    p->col_offset = col_offset;\n    return p;\n}\n\nexpr_ty\nGeneratorExp(expr_ty elt, asdl_seq * generators, int lineno, int col_offset,\n             PyArena *arena)\n{\n    expr_ty p;\n    if (!elt) {\n        PyErr_SetString(PyExc_ValueError,\n                        \"field elt is required for GeneratorExp\");\n        return NULL;\n    }\n    p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));\n    if (!p)\n        return NULL;\n    p->kind = GeneratorExp_kind;\n    p->v.GeneratorExp.elt = elt;\n    p->v.GeneratorExp.generators = generators;\n    p->lineno = lineno;\n    p->col_offset = col_offset;\n    return p;\n}\n\nexpr_ty\nAwait(expr_ty value, int lineno, int col_offset, PyArena *arena)\n{\n    expr_ty p;\n    if (!value) {\n        PyErr_SetString(PyExc_ValueError,\n                        \"field value is required for Await\");\n        return NULL;\n    }\n    p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));\n    if (!p)\n        return NULL;\n    p->kind = Await_kind;\n    p->v.Await.value = value;\n    p->lineno = lineno;\n    p->col_offset = col_offset;\n    return p;\n}\n\nexpr_ty\nYield(expr_ty value, int lineno, int col_offset, PyArena *arena)\n{\n    expr_ty p;\n    p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));\n    if (!p)\n        return NULL;\n    p->kind = Yield_kind;\n    p->v.Yield.value = value;\n    p->lineno = lineno;\n    p->col_offset = col_offset;\n    return p;\n}\n\nexpr_ty\nYieldFrom(expr_ty value, int lineno, int col_offset, PyArena *arena)\n{\n    expr_ty p;\n    if (!value) {\n        PyErr_SetString(PyExc_ValueError,\n                        \"field value is required for YieldFrom\");\n        return NULL;\n    }\n    p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));\n    if (!p)\n        return NULL;\n    p->kind = YieldFrom_kind;\n    p->v.YieldFrom.value = value;\n    p->lineno = lineno;\n    p->col_offset = col_offset;\n    return p;\n}\n\nexpr_ty\nCompare(expr_ty left, asdl_int_seq * ops, asdl_seq * comparators, int lineno,\n        int col_offset, PyArena *arena)\n{\n    expr_ty p;\n    if (!left) {\n        PyErr_SetString(PyExc_ValueError,\n                        \"field left is required for Compare\");\n        return NULL;\n    }\n    p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));\n    if (!p)\n        return NULL;\n    p->kind = Compare_kind;\n    p->v.Compare.left = left;\n    p->v.Compare.ops = ops;\n    p->v.Compare.comparators = comparators;\n    p->lineno = lineno;\n    p->col_offset = col_offset;\n    return p;\n}\n\nexpr_ty\nCall(expr_ty func, asdl_seq * args, asdl_seq * keywords, int lineno, int\n     col_offset, PyArena *arena)\n{\n    expr_ty p;\n    if (!func) {\n        PyErr_SetString(PyExc_ValueError,\n                        \"field func is required for Call\");\n        return NULL;\n    }\n    p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));\n    if (!p)\n        return NULL;\n    p->kind = Call_kind;\n    p->v.Call.func = func;\n    p->v.Call.args = args;\n    p->v.Call.keywords = keywords;\n    p->lineno = lineno;\n    p->col_offset = col_offset;\n    return p;\n}\n\nexpr_ty\nNum(object n, int lineno, int col_offset, PyArena *arena)\n{\n    expr_ty p;\n    if (!n) {\n        PyErr_SetString(PyExc_ValueError,\n                        \"field n is required for Num\");\n        return NULL;\n    }\n    p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));\n    if (!p)\n        return NULL;\n    p->kind = Num_kind;\n    p->v.Num.n = n;\n    p->lineno = lineno;\n    p->col_offset = col_offset;\n    return p;\n}\n\nexpr_ty\nStr(string s, string kind, int lineno, int col_offset, PyArena *arena)\n{\n    expr_ty p;\n    if (!s) {\n        PyErr_SetString(PyExc_ValueError,\n                        \"field s is required for Str\");\n        return NULL;\n    }\n    if (!kind) {\n        PyErr_SetString(PyExc_ValueError,\n                        \"field kind is required for Str\");\n        return NULL;\n    }\n    p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));\n    if (!p)\n        return NULL;\n    p->kind = Str_kind;\n    p->v.Str.s = s;\n    p->v.Str.kind = kind;\n    p->lineno = lineno;\n    p->col_offset = col_offset;\n    return p;\n}\n\nexpr_ty\nFormattedValue(expr_ty value, int conversion, expr_ty format_spec, int lineno,\n               int col_offset, PyArena *arena)\n{\n    expr_ty p;\n    if (!value) {\n        PyErr_SetString(PyExc_ValueError,\n                        \"field value is required for FormattedValue\");\n        return NULL;\n    }\n    p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));\n    if (!p)\n        return NULL;\n    p->kind = FormattedValue_kind;\n    p->v.FormattedValue.value = value;\n    p->v.FormattedValue.conversion = conversion;\n    p->v.FormattedValue.format_spec = format_spec;\n    p->lineno = lineno;\n    p->col_offset = col_offset;\n    return p;\n}\n\nexpr_ty\nJoinedStr(asdl_seq * values, int lineno, int col_offset, PyArena *arena)\n{\n    expr_ty p;\n    p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));\n    if (!p)\n        return NULL;\n    p->kind = JoinedStr_kind;\n    p->v.JoinedStr.values = values;\n    p->lineno = lineno;\n    p->col_offset = col_offset;\n    return p;\n}\n\nexpr_ty\nBytes(bytes s, string kind, int lineno, int col_offset, PyArena *arena)\n{\n    expr_ty p;\n    if (!s) {\n        PyErr_SetString(PyExc_ValueError,\n                        \"field s is required for Bytes\");\n        return NULL;\n    }\n    if (!kind) {\n        PyErr_SetString(PyExc_ValueError,\n                        \"field kind is required for Bytes\");\n        return NULL;\n    }\n    p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));\n    if (!p)\n        return NULL;\n    p->kind = Bytes_kind;\n    p->v.Bytes.s = s;\n    p->v.Bytes.kind = kind;\n    p->lineno = lineno;\n    p->col_offset = col_offset;\n    return p;\n}\n\nexpr_ty\nNameConstant(singleton value, int lineno, int col_offset, PyArena *arena)\n{\n    expr_ty p;\n    if (!value) {\n        PyErr_SetString(PyExc_ValueError,\n                        \"field value is required for NameConstant\");\n        return NULL;\n    }\n    p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));\n    if (!p)\n        return NULL;\n    p->kind = NameConstant_kind;\n    p->v.NameConstant.value = value;\n    p->lineno = lineno;\n    p->col_offset = col_offset;\n    return p;\n}\n\nexpr_ty\nEllipsis(int lineno, int col_offset, PyArena *arena)\n{\n    expr_ty p;\n    p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));\n    if (!p)\n        return NULL;\n    p->kind = Ellipsis_kind;\n    p->lineno = lineno;\n    p->col_offset = col_offset;\n    return p;\n}\n\nexpr_ty\nConstant(constant value, int lineno, int col_offset, PyArena *arena)\n{\n    expr_ty p;\n    if (!value) {\n        PyErr_SetString(PyExc_ValueError,\n                        \"field value is required for Constant\");\n        return NULL;\n    }\n    p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));\n    if (!p)\n        return NULL;\n    p->kind = Constant_kind;\n    p->v.Constant.value = value;\n    p->lineno = lineno;\n    p->col_offset = col_offset;\n    return p;\n}\n\nexpr_ty\nAttribute(expr_ty value, identifier attr, expr_context_ty ctx, int lineno, int\n          col_offset, PyArena *arena)\n{\n    expr_ty p;\n    if (!value) {\n        PyErr_SetString(PyExc_ValueError,\n                        \"field value is required for Attribute\");\n        return NULL;\n    }\n    if (!attr) {\n        PyErr_SetString(PyExc_ValueError,\n                        \"field attr is required for Attribute\");\n        return NULL;\n    }\n    if (!ctx) {\n        PyErr_SetString(PyExc_ValueError,\n                        \"field ctx is required for Attribute\");\n        return NULL;\n    }\n    p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));\n    if (!p)\n        return NULL;\n    p->kind = Attribute_kind;\n    p->v.Attribute.value = value;\n    p->v.Attribute.attr = attr;\n    p->v.Attribute.ctx = ctx;\n    p->lineno = lineno;\n    p->col_offset = col_offset;\n    return p;\n}\n\nexpr_ty\nSubscript(expr_ty value, slice_ty slice, expr_context_ty ctx, int lineno, int\n          col_offset, PyArena *arena)\n{\n    expr_ty p;\n    if (!value) {\n        PyErr_SetString(PyExc_ValueError,\n                        \"field value is required for Subscript\");\n        return NULL;\n    }\n    if (!slice) {\n        PyErr_SetString(PyExc_ValueError,\n                        \"field slice is required for Subscript\");\n        return NULL;\n    }\n    if (!ctx) {\n        PyErr_SetString(PyExc_ValueError,\n                        \"field ctx is required for Subscript\");\n        return NULL;\n    }\n    p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));\n    if (!p)\n        return NULL;\n    p->kind = Subscript_kind;\n    p->v.Subscript.value = value;\n    p->v.Subscript.slice = slice;\n    p->v.Subscript.ctx = ctx;\n    p->lineno = lineno;\n    p->col_offset = col_offset;\n    return p;\n}\n\nexpr_ty\nStarred(expr_ty value, expr_context_ty ctx, int lineno, int col_offset, PyArena\n        *arena)\n{\n    expr_ty p;\n    if (!value) {\n        PyErr_SetString(PyExc_ValueError,\n                        \"field value is required for Starred\");\n        return NULL;\n    }\n    if (!ctx) {\n        PyErr_SetString(PyExc_ValueError,\n                        \"field ctx is required for Starred\");\n        return NULL;\n    }\n    p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));\n    if (!p)\n        return NULL;\n    p->kind = Starred_kind;\n    p->v.Starred.value = value;\n    p->v.Starred.ctx = ctx;\n    p->lineno = lineno;\n    p->col_offset = col_offset;\n    return p;\n}\n\nexpr_ty\nName(identifier id, expr_context_ty ctx, int lineno, int col_offset, PyArena\n     *arena)\n{\n    expr_ty p;\n    if (!id) {\n        PyErr_SetString(PyExc_ValueError,\n                        \"field id is required for Name\");\n        return NULL;\n    }\n    if (!ctx) {\n        PyErr_SetString(PyExc_ValueError,\n                        \"field ctx is required for Name\");\n        return NULL;\n    }\n    p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));\n    if (!p)\n        return NULL;\n    p->kind = Name_kind;\n    p->v.Name.id = id;\n    p->v.Name.ctx = ctx;\n    p->lineno = lineno;\n    p->col_offset = col_offset;\n    return p;\n}\n\nexpr_ty\nList(asdl_seq * elts, expr_context_ty ctx, int lineno, int col_offset, PyArena\n     *arena)\n{\n    expr_ty p;\n    if (!ctx) {\n        PyErr_SetString(PyExc_ValueError,\n                        \"field ctx is required for List\");\n        return NULL;\n    }\n    p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));\n    if (!p)\n        return NULL;\n    p->kind = List_kind;\n    p->v.List.elts = elts;\n    p->v.List.ctx = ctx;\n    p->lineno = lineno;\n    p->col_offset = col_offset;\n    return p;\n}\n\nexpr_ty\nTuple(asdl_seq * elts, expr_context_ty ctx, int lineno, int col_offset, PyArena\n      *arena)\n{\n    expr_ty p;\n    if (!ctx) {\n        PyErr_SetString(PyExc_ValueError,\n                        \"field ctx is required for Tuple\");\n        return NULL;\n    }\n    p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));\n    if (!p)\n        return NULL;\n    p->kind = Tuple_kind;\n    p->v.Tuple.elts = elts;\n    p->v.Tuple.ctx = ctx;\n    p->lineno = lineno;\n    p->col_offset = col_offset;\n    return p;\n}\n\nslice_ty\nSlice(expr_ty lower, expr_ty upper, expr_ty step, PyArena *arena)\n{\n    slice_ty p;\n    p = (slice_ty)PyArena_Malloc(arena, sizeof(*p));\n    if (!p)\n        return NULL;\n    p->kind = Slice_kind;\n    p->v.Slice.lower = lower;\n    p->v.Slice.upper = upper;\n    p->v.Slice.step = step;\n    return p;\n}\n\nslice_ty\nExtSlice(asdl_seq * dims, PyArena *arena)\n{\n    slice_ty p;\n    p = (slice_ty)PyArena_Malloc(arena, sizeof(*p));\n    if (!p)\n        return NULL;\n    p->kind = ExtSlice_kind;\n    p->v.ExtSlice.dims = dims;\n    return p;\n}\n\nslice_ty\nIndex(expr_ty value, PyArena *arena)\n{\n    slice_ty p;\n    if (!value) {\n        PyErr_SetString(PyExc_ValueError,\n                        \"field value is required for Index\");\n        return NULL;\n    }\n    p = (slice_ty)PyArena_Malloc(arena, sizeof(*p));\n    if (!p)\n        return NULL;\n    p->kind = Index_kind;\n    p->v.Index.value = value;\n    return p;\n}\n\ncomprehension_ty\ncomprehension(expr_ty target, expr_ty iter, asdl_seq * ifs, int is_async,\n              PyArena *arena)\n{\n    comprehension_ty p;\n    if (!target) {\n        PyErr_SetString(PyExc_ValueError,\n                        \"field target is required for comprehension\");\n        return NULL;\n    }\n    if (!iter) {\n        PyErr_SetString(PyExc_ValueError,\n                        \"field iter is required for comprehension\");\n        return NULL;\n    }\n    p = (comprehension_ty)PyArena_Malloc(arena, sizeof(*p));\n    if (!p)\n        return NULL;\n    p->target = target;\n    p->iter = iter;\n    p->ifs = ifs;\n    p->is_async = is_async;\n    return p;\n}\n\nexcepthandler_ty\nExceptHandler(expr_ty type, identifier name, asdl_seq * body, int lineno, int\n              col_offset, PyArena *arena)\n{\n    excepthandler_ty p;\n    p = (excepthandler_ty)PyArena_Malloc(arena, sizeof(*p));\n    if (!p)\n        return NULL;\n    p->kind = ExceptHandler_kind;\n    p->v.ExceptHandler.type = type;\n    p->v.ExceptHandler.name = name;\n    p->v.ExceptHandler.body = body;\n    p->lineno = lineno;\n    p->col_offset = col_offset;\n    return p;\n}\n\narguments_ty\narguments(asdl_seq * args, arg_ty vararg, asdl_seq * kwonlyargs, asdl_seq *\n          kw_defaults, arg_ty kwarg, asdl_seq * defaults, PyArena *arena)\n{\n    arguments_ty p;\n    p = (arguments_ty)PyArena_Malloc(arena, sizeof(*p));\n    if (!p)\n        return NULL;\n    p->args = args;\n    p->vararg = vararg;\n    p->kwonlyargs = kwonlyargs;\n    p->kw_defaults = kw_defaults;\n    p->kwarg = kwarg;\n    p->defaults = defaults;\n    return p;\n}\n\narg_ty\narg(identifier arg, expr_ty annotation, string type_comment, int lineno, int\n    col_offset, PyArena *arena)\n{\n    arg_ty p;\n    if (!arg) {\n        PyErr_SetString(PyExc_ValueError,\n                        \"field arg is required for arg\");\n        return NULL;\n    }\n    p = (arg_ty)PyArena_Malloc(arena, sizeof(*p));\n    if (!p)\n        return NULL;\n    p->arg = arg;\n    p->annotation = annotation;\n    p->type_comment = type_comment;\n    p->lineno = lineno;\n    p->col_offset = col_offset;\n    return p;\n}\n\nkeyword_ty\nkeyword(identifier arg, expr_ty value, PyArena *arena)\n{\n    keyword_ty p;\n    if (!value) {\n        PyErr_SetString(PyExc_ValueError,\n                        \"field value is required for keyword\");\n        return NULL;\n    }\n    p = (keyword_ty)PyArena_Malloc(arena, sizeof(*p));\n    if (!p)\n        return NULL;\n    p->arg = arg;\n    p->value = value;\n    return p;\n}\n\nalias_ty\nalias(identifier name, identifier asname, PyArena *arena)\n{\n    alias_ty p;\n    if (!name) {\n        PyErr_SetString(PyExc_ValueError,\n                        \"field name is required for alias\");\n        return NULL;\n    }\n    p = (alias_ty)PyArena_Malloc(arena, sizeof(*p));\n    if (!p)\n        return NULL;\n    p->name = name;\n    p->asname = asname;\n    return p;\n}\n\nwithitem_ty\nwithitem(expr_ty context_expr, expr_ty optional_vars, PyArena *arena)\n{\n    withitem_ty p;\n    if (!context_expr) {\n        PyErr_SetString(PyExc_ValueError,\n                        \"field context_expr is required for withitem\");\n        return NULL;\n    }\n    p = (withitem_ty)PyArena_Malloc(arena, sizeof(*p));\n    if (!p)\n        return NULL;\n    p->context_expr = context_expr;\n    p->optional_vars = optional_vars;\n    return p;\n}\n\ntype_ignore_ty\nTypeIgnore(int lineno, string tag, PyArena *arena)\n{\n    type_ignore_ty p;\n    if (!tag) {\n        PyErr_SetString(PyExc_ValueError,\n                        \"field tag is required for TypeIgnore\");\n        return NULL;\n    }\n    p = (type_ignore_ty)PyArena_Malloc(arena, sizeof(*p));\n    if (!p)\n        return NULL;\n    p->kind = TypeIgnore_kind;\n    p->v.TypeIgnore.lineno = lineno;\n    p->v.TypeIgnore.tag = tag;\n    return p;\n}\n\n\nPyObject*\nast2obj_mod(void* _o)\n{\n    mod_ty o = (mod_ty)_o;\n    PyObject *result = NULL, *value = NULL;\n    if (!o) {\n        Py_RETURN_NONE;\n    }\n\n    switch (o->kind) {\n    case Module_kind:\n        result = PyType_GenericNew(Module_type, NULL, NULL);\n        if (!result) goto failed;\n        value = ast2obj_list(o->v.Module.body, ast2obj_stmt);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_body, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        value = ast2obj_list(o->v.Module.type_ignores, ast2obj_type_ignore);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_type_ignores, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        break;\n    case Interactive_kind:\n        result = PyType_GenericNew(Interactive_type, NULL, NULL);\n        if (!result) goto failed;\n        value = ast2obj_list(o->v.Interactive.body, ast2obj_stmt);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_body, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        break;\n    case Expression_kind:\n        result = PyType_GenericNew(Expression_type, NULL, NULL);\n        if (!result) goto failed;\n        value = ast2obj_expr(o->v.Expression.body);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_body, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        break;\n    case FunctionType_kind:\n        result = PyType_GenericNew(FunctionType_type, NULL, NULL);\n        if (!result) goto failed;\n        value = ast2obj_list(o->v.FunctionType.argtypes, ast2obj_expr);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_argtypes, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        value = ast2obj_expr(o->v.FunctionType.returns);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_returns, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        break;\n    case Suite_kind:\n        result = PyType_GenericNew(Suite_type, NULL, NULL);\n        if (!result) goto failed;\n        value = ast2obj_list(o->v.Suite.body, ast2obj_stmt);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_body, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        break;\n    }\n    return result;\nfailed:\n    Py_XDECREF(value);\n    Py_XDECREF(result);\n    return NULL;\n}\n\nPyObject*\nast2obj_stmt(void* _o)\n{\n    stmt_ty o = (stmt_ty)_o;\n    PyObject *result = NULL, *value = NULL;\n    if (!o) {\n        Py_RETURN_NONE;\n    }\n\n    switch (o->kind) {\n    case FunctionDef_kind:\n        result = PyType_GenericNew(FunctionDef_type, NULL, NULL);\n        if (!result) goto failed;\n        value = ast2obj_identifier(o->v.FunctionDef.name);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_name, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        value = ast2obj_arguments(o->v.FunctionDef.args);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_args, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        value = ast2obj_list(o->v.FunctionDef.body, ast2obj_stmt);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_body, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        value = ast2obj_list(o->v.FunctionDef.decorator_list, ast2obj_expr);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_decorator_list, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        value = ast2obj_expr(o->v.FunctionDef.returns);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_returns, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        value = ast2obj_string(o->v.FunctionDef.type_comment);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_type_comment, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        break;\n    case AsyncFunctionDef_kind:\n        result = PyType_GenericNew(AsyncFunctionDef_type, NULL, NULL);\n        if (!result) goto failed;\n        value = ast2obj_identifier(o->v.AsyncFunctionDef.name);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_name, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        value = ast2obj_arguments(o->v.AsyncFunctionDef.args);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_args, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        value = ast2obj_list(o->v.AsyncFunctionDef.body, ast2obj_stmt);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_body, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        value = ast2obj_list(o->v.AsyncFunctionDef.decorator_list,\n                             ast2obj_expr);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_decorator_list, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        value = ast2obj_expr(o->v.AsyncFunctionDef.returns);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_returns, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        value = ast2obj_string(o->v.AsyncFunctionDef.type_comment);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_type_comment, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        break;\n    case ClassDef_kind:\n        result = PyType_GenericNew(ClassDef_type, NULL, NULL);\n        if (!result) goto failed;\n        value = ast2obj_identifier(o->v.ClassDef.name);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_name, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        value = ast2obj_list(o->v.ClassDef.bases, ast2obj_expr);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_bases, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        value = ast2obj_list(o->v.ClassDef.keywords, ast2obj_keyword);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_keywords, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        value = ast2obj_list(o->v.ClassDef.body, ast2obj_stmt);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_body, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        value = ast2obj_list(o->v.ClassDef.decorator_list, ast2obj_expr);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_decorator_list, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        break;\n    case Return_kind:\n        result = PyType_GenericNew(Return_type, NULL, NULL);\n        if (!result) goto failed;\n        value = ast2obj_expr(o->v.Return.value);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_value, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        break;\n    case Delete_kind:\n        result = PyType_GenericNew(Delete_type, NULL, NULL);\n        if (!result) goto failed;\n        value = ast2obj_list(o->v.Delete.targets, ast2obj_expr);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_targets, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        break;\n    case Assign_kind:\n        result = PyType_GenericNew(Assign_type, NULL, NULL);\n        if (!result) goto failed;\n        value = ast2obj_list(o->v.Assign.targets, ast2obj_expr);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_targets, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        value = ast2obj_expr(o->v.Assign.value);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_value, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        value = ast2obj_string(o->v.Assign.type_comment);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_type_comment, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        break;\n    case AugAssign_kind:\n        result = PyType_GenericNew(AugAssign_type, NULL, NULL);\n        if (!result) goto failed;\n        value = ast2obj_expr(o->v.AugAssign.target);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_target, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        value = ast2obj_operator(o->v.AugAssign.op);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_op, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        value = ast2obj_expr(o->v.AugAssign.value);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_value, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        break;\n    case AnnAssign_kind:\n        result = PyType_GenericNew(AnnAssign_type, NULL, NULL);\n        if (!result) goto failed;\n        value = ast2obj_expr(o->v.AnnAssign.target);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_target, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        value = ast2obj_expr(o->v.AnnAssign.annotation);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_annotation, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        value = ast2obj_expr(o->v.AnnAssign.value);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_value, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        value = ast2obj_int(o->v.AnnAssign.simple);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_simple, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        break;\n    case For_kind:\n        result = PyType_GenericNew(For_type, NULL, NULL);\n        if (!result) goto failed;\n        value = ast2obj_expr(o->v.For.target);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_target, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        value = ast2obj_expr(o->v.For.iter);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_iter, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        value = ast2obj_list(o->v.For.body, ast2obj_stmt);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_body, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        value = ast2obj_list(o->v.For.orelse, ast2obj_stmt);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_orelse, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        value = ast2obj_string(o->v.For.type_comment);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_type_comment, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        break;\n    case AsyncFor_kind:\n        result = PyType_GenericNew(AsyncFor_type, NULL, NULL);\n        if (!result) goto failed;\n        value = ast2obj_expr(o->v.AsyncFor.target);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_target, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        value = ast2obj_expr(o->v.AsyncFor.iter);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_iter, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        value = ast2obj_list(o->v.AsyncFor.body, ast2obj_stmt);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_body, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        value = ast2obj_list(o->v.AsyncFor.orelse, ast2obj_stmt);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_orelse, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        value = ast2obj_string(o->v.AsyncFor.type_comment);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_type_comment, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        break;\n    case While_kind:\n        result = PyType_GenericNew(While_type, NULL, NULL);\n        if (!result) goto failed;\n        value = ast2obj_expr(o->v.While.test);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_test, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        value = ast2obj_list(o->v.While.body, ast2obj_stmt);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_body, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        value = ast2obj_list(o->v.While.orelse, ast2obj_stmt);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_orelse, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        break;\n    case If_kind:\n        result = PyType_GenericNew(If_type, NULL, NULL);\n        if (!result) goto failed;\n        value = ast2obj_expr(o->v.If.test);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_test, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        value = ast2obj_list(o->v.If.body, ast2obj_stmt);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_body, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        value = ast2obj_list(o->v.If.orelse, ast2obj_stmt);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_orelse, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        break;\n    case With_kind:\n        result = PyType_GenericNew(With_type, NULL, NULL);\n        if (!result) goto failed;\n        value = ast2obj_list(o->v.With.items, ast2obj_withitem);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_items, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        value = ast2obj_list(o->v.With.body, ast2obj_stmt);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_body, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        value = ast2obj_string(o->v.With.type_comment);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_type_comment, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        break;\n    case AsyncWith_kind:\n        result = PyType_GenericNew(AsyncWith_type, NULL, NULL);\n        if (!result) goto failed;\n        value = ast2obj_list(o->v.AsyncWith.items, ast2obj_withitem);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_items, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        value = ast2obj_list(o->v.AsyncWith.body, ast2obj_stmt);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_body, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        value = ast2obj_string(o->v.AsyncWith.type_comment);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_type_comment, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        break;\n    case Raise_kind:\n        result = PyType_GenericNew(Raise_type, NULL, NULL);\n        if (!result) goto failed;\n        value = ast2obj_expr(o->v.Raise.exc);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_exc, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        value = ast2obj_expr(o->v.Raise.cause);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_cause, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        break;\n    case Try_kind:\n        result = PyType_GenericNew(Try_type, NULL, NULL);\n        if (!result) goto failed;\n        value = ast2obj_list(o->v.Try.body, ast2obj_stmt);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_body, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        value = ast2obj_list(o->v.Try.handlers, ast2obj_excepthandler);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_handlers, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        value = ast2obj_list(o->v.Try.orelse, ast2obj_stmt);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_orelse, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        value = ast2obj_list(o->v.Try.finalbody, ast2obj_stmt);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_finalbody, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        break;\n    case Assert_kind:\n        result = PyType_GenericNew(Assert_type, NULL, NULL);\n        if (!result) goto failed;\n        value = ast2obj_expr(o->v.Assert.test);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_test, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        value = ast2obj_expr(o->v.Assert.msg);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_msg, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        break;\n    case Import_kind:\n        result = PyType_GenericNew(Import_type, NULL, NULL);\n        if (!result) goto failed;\n        value = ast2obj_list(o->v.Import.names, ast2obj_alias);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_names, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        break;\n    case ImportFrom_kind:\n        result = PyType_GenericNew(ImportFrom_type, NULL, NULL);\n        if (!result) goto failed;\n        value = ast2obj_identifier(o->v.ImportFrom.module);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_module, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        value = ast2obj_list(o->v.ImportFrom.names, ast2obj_alias);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_names, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        value = ast2obj_int(o->v.ImportFrom.level);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_level, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        break;\n    case Global_kind:\n        result = PyType_GenericNew(Global_type, NULL, NULL);\n        if (!result) goto failed;\n        value = ast2obj_list(o->v.Global.names, ast2obj_identifier);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_names, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        break;\n    case Nonlocal_kind:\n        result = PyType_GenericNew(Nonlocal_type, NULL, NULL);\n        if (!result) goto failed;\n        value = ast2obj_list(o->v.Nonlocal.names, ast2obj_identifier);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_names, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        break;\n    case Expr_kind:\n        result = PyType_GenericNew(Expr_type, NULL, NULL);\n        if (!result) goto failed;\n        value = ast2obj_expr(o->v.Expr.value);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_value, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        break;\n    case Pass_kind:\n        result = PyType_GenericNew(Pass_type, NULL, NULL);\n        if (!result) goto failed;\n        break;\n    case Break_kind:\n        result = PyType_GenericNew(Break_type, NULL, NULL);\n        if (!result) goto failed;\n        break;\n    case Continue_kind:\n        result = PyType_GenericNew(Continue_type, NULL, NULL);\n        if (!result) goto failed;\n        break;\n    }\n    value = ast2obj_int(o->lineno);\n    if (!value) goto failed;\n    if (_PyObject_SetAttrId(result, &PyId_lineno, value) < 0)\n        goto failed;\n    Py_DECREF(value);\n    value = ast2obj_int(o->col_offset);\n    if (!value) goto failed;\n    if (_PyObject_SetAttrId(result, &PyId_col_offset, value) < 0)\n        goto failed;\n    Py_DECREF(value);\n    return result;\nfailed:\n    Py_XDECREF(value);\n    Py_XDECREF(result);\n    return NULL;\n}\n\nPyObject*\nast2obj_expr(void* _o)\n{\n    expr_ty o = (expr_ty)_o;\n    PyObject *result = NULL, *value = NULL;\n    if (!o) {\n        Py_RETURN_NONE;\n    }\n\n    switch (o->kind) {\n    case BoolOp_kind:\n        result = PyType_GenericNew(BoolOp_type, NULL, NULL);\n        if (!result) goto failed;\n        value = ast2obj_boolop(o->v.BoolOp.op);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_op, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        value = ast2obj_list(o->v.BoolOp.values, ast2obj_expr);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_values, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        break;\n    case BinOp_kind:\n        result = PyType_GenericNew(BinOp_type, NULL, NULL);\n        if (!result) goto failed;\n        value = ast2obj_expr(o->v.BinOp.left);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_left, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        value = ast2obj_operator(o->v.BinOp.op);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_op, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        value = ast2obj_expr(o->v.BinOp.right);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_right, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        break;\n    case UnaryOp_kind:\n        result = PyType_GenericNew(UnaryOp_type, NULL, NULL);\n        if (!result) goto failed;\n        value = ast2obj_unaryop(o->v.UnaryOp.op);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_op, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        value = ast2obj_expr(o->v.UnaryOp.operand);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_operand, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        break;\n    case Lambda_kind:\n        result = PyType_GenericNew(Lambda_type, NULL, NULL);\n        if (!result) goto failed;\n        value = ast2obj_arguments(o->v.Lambda.args);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_args, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        value = ast2obj_expr(o->v.Lambda.body);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_body, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        break;\n    case IfExp_kind:\n        result = PyType_GenericNew(IfExp_type, NULL, NULL);\n        if (!result) goto failed;\n        value = ast2obj_expr(o->v.IfExp.test);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_test, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        value = ast2obj_expr(o->v.IfExp.body);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_body, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        value = ast2obj_expr(o->v.IfExp.orelse);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_orelse, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        break;\n    case Dict_kind:\n        result = PyType_GenericNew(Dict_type, NULL, NULL);\n        if (!result) goto failed;\n        value = ast2obj_list(o->v.Dict.keys, ast2obj_expr);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_keys, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        value = ast2obj_list(o->v.Dict.values, ast2obj_expr);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_values, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        break;\n    case Set_kind:\n        result = PyType_GenericNew(Set_type, NULL, NULL);\n        if (!result) goto failed;\n        value = ast2obj_list(o->v.Set.elts, ast2obj_expr);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_elts, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        break;\n    case ListComp_kind:\n        result = PyType_GenericNew(ListComp_type, NULL, NULL);\n        if (!result) goto failed;\n        value = ast2obj_expr(o->v.ListComp.elt);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_elt, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        value = ast2obj_list(o->v.ListComp.generators, ast2obj_comprehension);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_generators, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        break;\n    case SetComp_kind:\n        result = PyType_GenericNew(SetComp_type, NULL, NULL);\n        if (!result) goto failed;\n        value = ast2obj_expr(o->v.SetComp.elt);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_elt, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        value = ast2obj_list(o->v.SetComp.generators, ast2obj_comprehension);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_generators, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        break;\n    case DictComp_kind:\n        result = PyType_GenericNew(DictComp_type, NULL, NULL);\n        if (!result) goto failed;\n        value = ast2obj_expr(o->v.DictComp.key);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_key, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        value = ast2obj_expr(o->v.DictComp.value);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_value, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        value = ast2obj_list(o->v.DictComp.generators, ast2obj_comprehension);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_generators, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        break;\n    case GeneratorExp_kind:\n        result = PyType_GenericNew(GeneratorExp_type, NULL, NULL);\n        if (!result) goto failed;\n        value = ast2obj_expr(o->v.GeneratorExp.elt);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_elt, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        value = ast2obj_list(o->v.GeneratorExp.generators,\n                             ast2obj_comprehension);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_generators, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        break;\n    case Await_kind:\n        result = PyType_GenericNew(Await_type, NULL, NULL);\n        if (!result) goto failed;\n        value = ast2obj_expr(o->v.Await.value);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_value, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        break;\n    case Yield_kind:\n        result = PyType_GenericNew(Yield_type, NULL, NULL);\n        if (!result) goto failed;\n        value = ast2obj_expr(o->v.Yield.value);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_value, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        break;\n    case YieldFrom_kind:\n        result = PyType_GenericNew(YieldFrom_type, NULL, NULL);\n        if (!result) goto failed;\n        value = ast2obj_expr(o->v.YieldFrom.value);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_value, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        break;\n    case Compare_kind:\n        result = PyType_GenericNew(Compare_type, NULL, NULL);\n        if (!result) goto failed;\n        value = ast2obj_expr(o->v.Compare.left);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_left, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        {\n            Py_ssize_t i, n = asdl_seq_LEN(o->v.Compare.ops);\n            value = PyList_New(n);\n            if (!value) goto failed;\n            for(i = 0; i < n; i++)\n                PyList_SET_ITEM(value, i, ast2obj_cmpop((cmpop_ty)asdl_seq_GET(o->v.Compare.ops, i)));\n        }\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_ops, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        value = ast2obj_list(o->v.Compare.comparators, ast2obj_expr);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_comparators, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        break;\n    case Call_kind:\n        result = PyType_GenericNew(Call_type, NULL, NULL);\n        if (!result) goto failed;\n        value = ast2obj_expr(o->v.Call.func);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_func, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        value = ast2obj_list(o->v.Call.args, ast2obj_expr);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_args, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        value = ast2obj_list(o->v.Call.keywords, ast2obj_keyword);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_keywords, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        break;\n    case Num_kind:\n        result = PyType_GenericNew(Num_type, NULL, NULL);\n        if (!result) goto failed;\n        value = ast2obj_object(o->v.Num.n);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_n, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        break;\n    case Str_kind:\n        result = PyType_GenericNew(Str_type, NULL, NULL);\n        if (!result) goto failed;\n        value = ast2obj_string(o->v.Str.s);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_s, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        value = ast2obj_string(o->v.Str.kind);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_kind, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        break;\n    case FormattedValue_kind:\n        result = PyType_GenericNew(FormattedValue_type, NULL, NULL);\n        if (!result) goto failed;\n        value = ast2obj_expr(o->v.FormattedValue.value);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_value, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        value = ast2obj_int(o->v.FormattedValue.conversion);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_conversion, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        value = ast2obj_expr(o->v.FormattedValue.format_spec);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_format_spec, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        break;\n    case JoinedStr_kind:\n        result = PyType_GenericNew(JoinedStr_type, NULL, NULL);\n        if (!result) goto failed;\n        value = ast2obj_list(o->v.JoinedStr.values, ast2obj_expr);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_values, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        break;\n    case Bytes_kind:\n        result = PyType_GenericNew(Bytes_type, NULL, NULL);\n        if (!result) goto failed;\n        value = ast2obj_bytes(o->v.Bytes.s);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_s, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        value = ast2obj_string(o->v.Bytes.kind);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_kind, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        break;\n    case NameConstant_kind:\n        result = PyType_GenericNew(NameConstant_type, NULL, NULL);\n        if (!result) goto failed;\n        value = ast2obj_singleton(o->v.NameConstant.value);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_value, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        break;\n    case Ellipsis_kind:\n        result = PyType_GenericNew(Ellipsis_type, NULL, NULL);\n        if (!result) goto failed;\n        break;\n    case Constant_kind:\n        result = PyType_GenericNew(Constant_type, NULL, NULL);\n        if (!result) goto failed;\n        value = ast2obj_constant(o->v.Constant.value);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_value, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        break;\n    case Attribute_kind:\n        result = PyType_GenericNew(Attribute_type, NULL, NULL);\n        if (!result) goto failed;\n        value = ast2obj_expr(o->v.Attribute.value);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_value, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        value = ast2obj_identifier(o->v.Attribute.attr);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_attr, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        value = ast2obj_expr_context(o->v.Attribute.ctx);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_ctx, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        break;\n    case Subscript_kind:\n        result = PyType_GenericNew(Subscript_type, NULL, NULL);\n        if (!result) goto failed;\n        value = ast2obj_expr(o->v.Subscript.value);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_value, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        value = ast2obj_slice(o->v.Subscript.slice);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_slice, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        value = ast2obj_expr_context(o->v.Subscript.ctx);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_ctx, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        break;\n    case Starred_kind:\n        result = PyType_GenericNew(Starred_type, NULL, NULL);\n        if (!result) goto failed;\n        value = ast2obj_expr(o->v.Starred.value);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_value, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        value = ast2obj_expr_context(o->v.Starred.ctx);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_ctx, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        break;\n    case Name_kind:\n        result = PyType_GenericNew(Name_type, NULL, NULL);\n        if (!result) goto failed;\n        value = ast2obj_identifier(o->v.Name.id);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_id, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        value = ast2obj_expr_context(o->v.Name.ctx);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_ctx, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        break;\n    case List_kind:\n        result = PyType_GenericNew(List_type, NULL, NULL);\n        if (!result) goto failed;\n        value = ast2obj_list(o->v.List.elts, ast2obj_expr);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_elts, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        value = ast2obj_expr_context(o->v.List.ctx);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_ctx, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        break;\n    case Tuple_kind:\n        result = PyType_GenericNew(Tuple_type, NULL, NULL);\n        if (!result) goto failed;\n        value = ast2obj_list(o->v.Tuple.elts, ast2obj_expr);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_elts, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        value = ast2obj_expr_context(o->v.Tuple.ctx);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_ctx, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        break;\n    }\n    value = ast2obj_int(o->lineno);\n    if (!value) goto failed;\n    if (_PyObject_SetAttrId(result, &PyId_lineno, value) < 0)\n        goto failed;\n    Py_DECREF(value);\n    value = ast2obj_int(o->col_offset);\n    if (!value) goto failed;\n    if (_PyObject_SetAttrId(result, &PyId_col_offset, value) < 0)\n        goto failed;\n    Py_DECREF(value);\n    return result;\nfailed:\n    Py_XDECREF(value);\n    Py_XDECREF(result);\n    return NULL;\n}\n\nPyObject* ast2obj_expr_context(expr_context_ty o)\n{\n    switch(o) {\n        case Load:\n            Py_INCREF(Load_singleton);\n            return Load_singleton;\n        case Store:\n            Py_INCREF(Store_singleton);\n            return Store_singleton;\n        case Del:\n            Py_INCREF(Del_singleton);\n            return Del_singleton;\n        case AugLoad:\n            Py_INCREF(AugLoad_singleton);\n            return AugLoad_singleton;\n        case AugStore:\n            Py_INCREF(AugStore_singleton);\n            return AugStore_singleton;\n        case Param:\n            Py_INCREF(Param_singleton);\n            return Param_singleton;\n        default:\n            /* should never happen, but just in case ... */\n            PyErr_Format(PyExc_SystemError, \"unknown expr_context found\");\n            return NULL;\n    }\n}\nPyObject*\nast2obj_slice(void* _o)\n{\n    slice_ty o = (slice_ty)_o;\n    PyObject *result = NULL, *value = NULL;\n    if (!o) {\n        Py_RETURN_NONE;\n    }\n\n    switch (o->kind) {\n    case Slice_kind:\n        result = PyType_GenericNew(Slice_type, NULL, NULL);\n        if (!result) goto failed;\n        value = ast2obj_expr(o->v.Slice.lower);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_lower, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        value = ast2obj_expr(o->v.Slice.upper);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_upper, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        value = ast2obj_expr(o->v.Slice.step);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_step, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        break;\n    case ExtSlice_kind:\n        result = PyType_GenericNew(ExtSlice_type, NULL, NULL);\n        if (!result) goto failed;\n        value = ast2obj_list(o->v.ExtSlice.dims, ast2obj_slice);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_dims, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        break;\n    case Index_kind:\n        result = PyType_GenericNew(Index_type, NULL, NULL);\n        if (!result) goto failed;\n        value = ast2obj_expr(o->v.Index.value);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_value, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        break;\n    }\n    return result;\nfailed:\n    Py_XDECREF(value);\n    Py_XDECREF(result);\n    return NULL;\n}\n\nPyObject* ast2obj_boolop(boolop_ty o)\n{\n    switch(o) {\n        case And:\n            Py_INCREF(And_singleton);\n            return And_singleton;\n        case Or:\n            Py_INCREF(Or_singleton);\n            return Or_singleton;\n        default:\n            /* should never happen, but just in case ... */\n            PyErr_Format(PyExc_SystemError, \"unknown boolop found\");\n            return NULL;\n    }\n}\nPyObject* ast2obj_operator(operator_ty o)\n{\n    switch(o) {\n        case Add:\n            Py_INCREF(Add_singleton);\n            return Add_singleton;\n        case Sub:\n            Py_INCREF(Sub_singleton);\n            return Sub_singleton;\n        case Mult:\n            Py_INCREF(Mult_singleton);\n            return Mult_singleton;\n        case MatMult:\n            Py_INCREF(MatMult_singleton);\n            return MatMult_singleton;\n        case Div:\n            Py_INCREF(Div_singleton);\n            return Div_singleton;\n        case Mod:\n            Py_INCREF(Mod_singleton);\n            return Mod_singleton;\n        case Pow:\n            Py_INCREF(Pow_singleton);\n            return Pow_singleton;\n        case LShift:\n            Py_INCREF(LShift_singleton);\n            return LShift_singleton;\n        case RShift:\n            Py_INCREF(RShift_singleton);\n            return RShift_singleton;\n        case BitOr:\n            Py_INCREF(BitOr_singleton);\n            return BitOr_singleton;\n        case BitXor:\n            Py_INCREF(BitXor_singleton);\n            return BitXor_singleton;\n        case BitAnd:\n            Py_INCREF(BitAnd_singleton);\n            return BitAnd_singleton;\n        case FloorDiv:\n            Py_INCREF(FloorDiv_singleton);\n            return FloorDiv_singleton;\n        default:\n            /* should never happen, but just in case ... */\n            PyErr_Format(PyExc_SystemError, \"unknown operator found\");\n            return NULL;\n    }\n}\nPyObject* ast2obj_unaryop(unaryop_ty o)\n{\n    switch(o) {\n        case Invert:\n            Py_INCREF(Invert_singleton);\n            return Invert_singleton;\n        case Not:\n            Py_INCREF(Not_singleton);\n            return Not_singleton;\n        case UAdd:\n            Py_INCREF(UAdd_singleton);\n            return UAdd_singleton;\n        case USub:\n            Py_INCREF(USub_singleton);\n            return USub_singleton;\n        default:\n            /* should never happen, but just in case ... */\n            PyErr_Format(PyExc_SystemError, \"unknown unaryop found\");\n            return NULL;\n    }\n}\nPyObject* ast2obj_cmpop(cmpop_ty o)\n{\n    switch(o) {\n        case Eq:\n            Py_INCREF(Eq_singleton);\n            return Eq_singleton;\n        case NotEq:\n            Py_INCREF(NotEq_singleton);\n            return NotEq_singleton;\n        case Lt:\n            Py_INCREF(Lt_singleton);\n            return Lt_singleton;\n        case LtE:\n            Py_INCREF(LtE_singleton);\n            return LtE_singleton;\n        case Gt:\n            Py_INCREF(Gt_singleton);\n            return Gt_singleton;\n        case GtE:\n            Py_INCREF(GtE_singleton);\n            return GtE_singleton;\n        case Is:\n            Py_INCREF(Is_singleton);\n            return Is_singleton;\n        case IsNot:\n            Py_INCREF(IsNot_singleton);\n            return IsNot_singleton;\n        case In:\n            Py_INCREF(In_singleton);\n            return In_singleton;\n        case NotIn:\n            Py_INCREF(NotIn_singleton);\n            return NotIn_singleton;\n        default:\n            /* should never happen, but just in case ... */\n            PyErr_Format(PyExc_SystemError, \"unknown cmpop found\");\n            return NULL;\n    }\n}\nPyObject*\nast2obj_comprehension(void* _o)\n{\n    comprehension_ty o = (comprehension_ty)_o;\n    PyObject *result = NULL, *value = NULL;\n    if (!o) {\n        Py_RETURN_NONE;\n    }\n\n    result = PyType_GenericNew(comprehension_type, NULL, NULL);\n    if (!result) return NULL;\n    value = ast2obj_expr(o->target);\n    if (!value) goto failed;\n    if (_PyObject_SetAttrId(result, &PyId_target, value) == -1)\n        goto failed;\n    Py_DECREF(value);\n    value = ast2obj_expr(o->iter);\n    if (!value) goto failed;\n    if (_PyObject_SetAttrId(result, &PyId_iter, value) == -1)\n        goto failed;\n    Py_DECREF(value);\n    value = ast2obj_list(o->ifs, ast2obj_expr);\n    if (!value) goto failed;\n    if (_PyObject_SetAttrId(result, &PyId_ifs, value) == -1)\n        goto failed;\n    Py_DECREF(value);\n    value = ast2obj_int(o->is_async);\n    if (!value) goto failed;\n    if (_PyObject_SetAttrId(result, &PyId_is_async, value) == -1)\n        goto failed;\n    Py_DECREF(value);\n    return result;\nfailed:\n    Py_XDECREF(value);\n    Py_XDECREF(result);\n    return NULL;\n}\n\nPyObject*\nast2obj_excepthandler(void* _o)\n{\n    excepthandler_ty o = (excepthandler_ty)_o;\n    PyObject *result = NULL, *value = NULL;\n    if (!o) {\n        Py_RETURN_NONE;\n    }\n\n    switch (o->kind) {\n    case ExceptHandler_kind:\n        result = PyType_GenericNew(ExceptHandler_type, NULL, NULL);\n        if (!result) goto failed;\n        value = ast2obj_expr(o->v.ExceptHandler.type);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_type, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        value = ast2obj_identifier(o->v.ExceptHandler.name);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_name, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        value = ast2obj_list(o->v.ExceptHandler.body, ast2obj_stmt);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_body, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        break;\n    }\n    value = ast2obj_int(o->lineno);\n    if (!value) goto failed;\n    if (_PyObject_SetAttrId(result, &PyId_lineno, value) < 0)\n        goto failed;\n    Py_DECREF(value);\n    value = ast2obj_int(o->col_offset);\n    if (!value) goto failed;\n    if (_PyObject_SetAttrId(result, &PyId_col_offset, value) < 0)\n        goto failed;\n    Py_DECREF(value);\n    return result;\nfailed:\n    Py_XDECREF(value);\n    Py_XDECREF(result);\n    return NULL;\n}\n\nPyObject*\nast2obj_arguments(void* _o)\n{\n    arguments_ty o = (arguments_ty)_o;\n    PyObject *result = NULL, *value = NULL;\n    if (!o) {\n        Py_RETURN_NONE;\n    }\n\n    result = PyType_GenericNew(arguments_type, NULL, NULL);\n    if (!result) return NULL;\n    value = ast2obj_list(o->args, ast2obj_arg);\n    if (!value) goto failed;\n    if (_PyObject_SetAttrId(result, &PyId_args, value) == -1)\n        goto failed;\n    Py_DECREF(value);\n    value = ast2obj_arg(o->vararg);\n    if (!value) goto failed;\n    if (_PyObject_SetAttrId(result, &PyId_vararg, value) == -1)\n        goto failed;\n    Py_DECREF(value);\n    value = ast2obj_list(o->kwonlyargs, ast2obj_arg);\n    if (!value) goto failed;\n    if (_PyObject_SetAttrId(result, &PyId_kwonlyargs, value) == -1)\n        goto failed;\n    Py_DECREF(value);\n    value = ast2obj_list(o->kw_defaults, ast2obj_expr);\n    if (!value) goto failed;\n    if (_PyObject_SetAttrId(result, &PyId_kw_defaults, value) == -1)\n        goto failed;\n    Py_DECREF(value);\n    value = ast2obj_arg(o->kwarg);\n    if (!value) goto failed;\n    if (_PyObject_SetAttrId(result, &PyId_kwarg, value) == -1)\n        goto failed;\n    Py_DECREF(value);\n    value = ast2obj_list(o->defaults, ast2obj_expr);\n    if (!value) goto failed;\n    if (_PyObject_SetAttrId(result, &PyId_defaults, value) == -1)\n        goto failed;\n    Py_DECREF(value);\n    return result;\nfailed:\n    Py_XDECREF(value);\n    Py_XDECREF(result);\n    return NULL;\n}\n\nPyObject*\nast2obj_arg(void* _o)\n{\n    arg_ty o = (arg_ty)_o;\n    PyObject *result = NULL, *value = NULL;\n    if (!o) {\n        Py_RETURN_NONE;\n    }\n\n    result = PyType_GenericNew(arg_type, NULL, NULL);\n    if (!result) return NULL;\n    value = ast2obj_identifier(o->arg);\n    if (!value) goto failed;\n    if (_PyObject_SetAttrId(result, &PyId_arg, value) == -1)\n        goto failed;\n    Py_DECREF(value);\n    value = ast2obj_expr(o->annotation);\n    if (!value) goto failed;\n    if (_PyObject_SetAttrId(result, &PyId_annotation, value) == -1)\n        goto failed;\n    Py_DECREF(value);\n    value = ast2obj_string(o->type_comment);\n    if (!value) goto failed;\n    if (_PyObject_SetAttrId(result, &PyId_type_comment, value) == -1)\n        goto failed;\n    Py_DECREF(value);\n    value = ast2obj_int(o->lineno);\n    if (!value) goto failed;\n    if (_PyObject_SetAttrId(result, &PyId_lineno, value) < 0)\n        goto failed;\n    Py_DECREF(value);\n    value = ast2obj_int(o->col_offset);\n    if (!value) goto failed;\n    if (_PyObject_SetAttrId(result, &PyId_col_offset, value) < 0)\n        goto failed;\n    Py_DECREF(value);\n    return result;\nfailed:\n    Py_XDECREF(value);\n    Py_XDECREF(result);\n    return NULL;\n}\n\nPyObject*\nast2obj_keyword(void* _o)\n{\n    keyword_ty o = (keyword_ty)_o;\n    PyObject *result = NULL, *value = NULL;\n    if (!o) {\n        Py_RETURN_NONE;\n    }\n\n    result = PyType_GenericNew(keyword_type, NULL, NULL);\n    if (!result) return NULL;\n    value = ast2obj_identifier(o->arg);\n    if (!value) goto failed;\n    if (_PyObject_SetAttrId(result, &PyId_arg, value) == -1)\n        goto failed;\n    Py_DECREF(value);\n    value = ast2obj_expr(o->value);\n    if (!value) goto failed;\n    if (_PyObject_SetAttrId(result, &PyId_value, value) == -1)\n        goto failed;\n    Py_DECREF(value);\n    return result;\nfailed:\n    Py_XDECREF(value);\n    Py_XDECREF(result);\n    return NULL;\n}\n\nPyObject*\nast2obj_alias(void* _o)\n{\n    alias_ty o = (alias_ty)_o;\n    PyObject *result = NULL, *value = NULL;\n    if (!o) {\n        Py_RETURN_NONE;\n    }\n\n    result = PyType_GenericNew(alias_type, NULL, NULL);\n    if (!result) return NULL;\n    value = ast2obj_identifier(o->name);\n    if (!value) goto failed;\n    if (_PyObject_SetAttrId(result, &PyId_name, value) == -1)\n        goto failed;\n    Py_DECREF(value);\n    value = ast2obj_identifier(o->asname);\n    if (!value) goto failed;\n    if (_PyObject_SetAttrId(result, &PyId_asname, value) == -1)\n        goto failed;\n    Py_DECREF(value);\n    return result;\nfailed:\n    Py_XDECREF(value);\n    Py_XDECREF(result);\n    return NULL;\n}\n\nPyObject*\nast2obj_withitem(void* _o)\n{\n    withitem_ty o = (withitem_ty)_o;\n    PyObject *result = NULL, *value = NULL;\n    if (!o) {\n        Py_RETURN_NONE;\n    }\n\n    result = PyType_GenericNew(withitem_type, NULL, NULL);\n    if (!result) return NULL;\n    value = ast2obj_expr(o->context_expr);\n    if (!value) goto failed;\n    if (_PyObject_SetAttrId(result, &PyId_context_expr, value) == -1)\n        goto failed;\n    Py_DECREF(value);\n    value = ast2obj_expr(o->optional_vars);\n    if (!value) goto failed;\n    if (_PyObject_SetAttrId(result, &PyId_optional_vars, value) == -1)\n        goto failed;\n    Py_DECREF(value);\n    return result;\nfailed:\n    Py_XDECREF(value);\n    Py_XDECREF(result);\n    return NULL;\n}\n\nPyObject*\nast2obj_type_ignore(void* _o)\n{\n    type_ignore_ty o = (type_ignore_ty)_o;\n    PyObject *result = NULL, *value = NULL;\n    if (!o) {\n        Py_RETURN_NONE;\n    }\n\n    switch (o->kind) {\n    case TypeIgnore_kind:\n        result = PyType_GenericNew(TypeIgnore_type, NULL, NULL);\n        if (!result) goto failed;\n        value = ast2obj_int(o->v.TypeIgnore.lineno);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_lineno, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        value = ast2obj_string(o->v.TypeIgnore.tag);\n        if (!value) goto failed;\n        if (_PyObject_SetAttrId(result, &PyId_tag, value) == -1)\n            goto failed;\n        Py_DECREF(value);\n        break;\n    }\n    return result;\nfailed:\n    Py_XDECREF(value);\n    Py_XDECREF(result);\n    return NULL;\n}\n\n\nint\nobj2ast_mod(PyObject* obj, mod_ty* out, PyArena* arena)\n{\n    int isinstance;\n\n    PyObject *tmp = NULL;\n\n    if (obj == Py_None) {\n        *out = NULL;\n        return 0;\n    }\n    isinstance = PyObject_IsInstance(obj, (PyObject*)Module_type);\n    if (isinstance == -1) {\n        return 1;\n    }\n    if (isinstance) {\n        asdl_seq* body;\n        asdl_seq* type_ignores;\n\n        if (lookup_attr_id(obj, &PyId_body, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"body\\\" missing from Module\");\n            return 1;\n        }\n        else {\n            int res;\n            Py_ssize_t len;\n            Py_ssize_t i;\n            if (!PyList_Check(tmp)) {\n                PyErr_Format(PyExc_TypeError, \"Module field \\\"body\\\" must be a list, not a %.200s\", tmp->ob_type->tp_name);\n                goto failed;\n            }\n            len = PyList_GET_SIZE(tmp);\n            body = _Ta3_asdl_seq_new(len, arena);\n            if (body == NULL) goto failed;\n            for (i = 0; i < len; i++) {\n                stmt_ty val;\n                res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &val, arena);\n                if (res != 0) goto failed;\n                if (len != PyList_GET_SIZE(tmp)) {\n                    PyErr_SetString(PyExc_RuntimeError, \"Module field \\\"body\\\" changed size during iteration\");\n                    goto failed;\n                }\n                asdl_seq_SET(body, i, val);\n            }\n            Py_CLEAR(tmp);\n        }\n        if (lookup_attr_id(obj, &PyId_type_ignores, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"type_ignores\\\" missing from Module\");\n            return 1;\n        }\n        else {\n            int res;\n            Py_ssize_t len;\n            Py_ssize_t i;\n            if (!PyList_Check(tmp)) {\n                PyErr_Format(PyExc_TypeError, \"Module field \\\"type_ignores\\\" must be a list, not a %.200s\", tmp->ob_type->tp_name);\n                goto failed;\n            }\n            len = PyList_GET_SIZE(tmp);\n            type_ignores = _Ta3_asdl_seq_new(len, arena);\n            if (type_ignores == NULL) goto failed;\n            for (i = 0; i < len; i++) {\n                type_ignore_ty val;\n                res = obj2ast_type_ignore(PyList_GET_ITEM(tmp, i), &val, arena);\n                if (res != 0) goto failed;\n                if (len != PyList_GET_SIZE(tmp)) {\n                    PyErr_SetString(PyExc_RuntimeError, \"Module field \\\"type_ignores\\\" changed size during iteration\");\n                    goto failed;\n                }\n                asdl_seq_SET(type_ignores, i, val);\n            }\n            Py_CLEAR(tmp);\n        }\n        *out = Module(body, type_ignores, arena);\n        if (*out == NULL) goto failed;\n        return 0;\n    }\n    isinstance = PyObject_IsInstance(obj, (PyObject*)Interactive_type);\n    if (isinstance == -1) {\n        return 1;\n    }\n    if (isinstance) {\n        asdl_seq* body;\n\n        if (lookup_attr_id(obj, &PyId_body, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"body\\\" missing from Interactive\");\n            return 1;\n        }\n        else {\n            int res;\n            Py_ssize_t len;\n            Py_ssize_t i;\n            if (!PyList_Check(tmp)) {\n                PyErr_Format(PyExc_TypeError, \"Interactive field \\\"body\\\" must be a list, not a %.200s\", tmp->ob_type->tp_name);\n                goto failed;\n            }\n            len = PyList_GET_SIZE(tmp);\n            body = _Ta3_asdl_seq_new(len, arena);\n            if (body == NULL) goto failed;\n            for (i = 0; i < len; i++) {\n                stmt_ty val;\n                res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &val, arena);\n                if (res != 0) goto failed;\n                if (len != PyList_GET_SIZE(tmp)) {\n                    PyErr_SetString(PyExc_RuntimeError, \"Interactive field \\\"body\\\" changed size during iteration\");\n                    goto failed;\n                }\n                asdl_seq_SET(body, i, val);\n            }\n            Py_CLEAR(tmp);\n        }\n        *out = Interactive(body, arena);\n        if (*out == NULL) goto failed;\n        return 0;\n    }\n    isinstance = PyObject_IsInstance(obj, (PyObject*)Expression_type);\n    if (isinstance == -1) {\n        return 1;\n    }\n    if (isinstance) {\n        expr_ty body;\n\n        if (lookup_attr_id(obj, &PyId_body, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"body\\\" missing from Expression\");\n            return 1;\n        }\n        else {\n            int res;\n            res = obj2ast_expr(tmp, &body, arena);\n            if (res != 0) goto failed;\n            Py_CLEAR(tmp);\n        }\n        *out = Expression(body, arena);\n        if (*out == NULL) goto failed;\n        return 0;\n    }\n    isinstance = PyObject_IsInstance(obj, (PyObject*)FunctionType_type);\n    if (isinstance == -1) {\n        return 1;\n    }\n    if (isinstance) {\n        asdl_seq* argtypes;\n        expr_ty returns;\n\n        if (lookup_attr_id(obj, &PyId_argtypes, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"argtypes\\\" missing from FunctionType\");\n            return 1;\n        }\n        else {\n            int res;\n            Py_ssize_t len;\n            Py_ssize_t i;\n            if (!PyList_Check(tmp)) {\n                PyErr_Format(PyExc_TypeError, \"FunctionType field \\\"argtypes\\\" must be a list, not a %.200s\", tmp->ob_type->tp_name);\n                goto failed;\n            }\n            len = PyList_GET_SIZE(tmp);\n            argtypes = _Ta3_asdl_seq_new(len, arena);\n            if (argtypes == NULL) goto failed;\n            for (i = 0; i < len; i++) {\n                expr_ty val;\n                res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &val, arena);\n                if (res != 0) goto failed;\n                if (len != PyList_GET_SIZE(tmp)) {\n                    PyErr_SetString(PyExc_RuntimeError, \"FunctionType field \\\"argtypes\\\" changed size during iteration\");\n                    goto failed;\n                }\n                asdl_seq_SET(argtypes, i, val);\n            }\n            Py_CLEAR(tmp);\n        }\n        if (lookup_attr_id(obj, &PyId_returns, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"returns\\\" missing from FunctionType\");\n            return 1;\n        }\n        else {\n            int res;\n            res = obj2ast_expr(tmp, &returns, arena);\n            if (res != 0) goto failed;\n            Py_CLEAR(tmp);\n        }\n        *out = FunctionType(argtypes, returns, arena);\n        if (*out == NULL) goto failed;\n        return 0;\n    }\n    isinstance = PyObject_IsInstance(obj, (PyObject*)Suite_type);\n    if (isinstance == -1) {\n        return 1;\n    }\n    if (isinstance) {\n        asdl_seq* body;\n\n        if (lookup_attr_id(obj, &PyId_body, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"body\\\" missing from Suite\");\n            return 1;\n        }\n        else {\n            int res;\n            Py_ssize_t len;\n            Py_ssize_t i;\n            if (!PyList_Check(tmp)) {\n                PyErr_Format(PyExc_TypeError, \"Suite field \\\"body\\\" must be a list, not a %.200s\", tmp->ob_type->tp_name);\n                goto failed;\n            }\n            len = PyList_GET_SIZE(tmp);\n            body = _Ta3_asdl_seq_new(len, arena);\n            if (body == NULL) goto failed;\n            for (i = 0; i < len; i++) {\n                stmt_ty val;\n                res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &val, arena);\n                if (res != 0) goto failed;\n                if (len != PyList_GET_SIZE(tmp)) {\n                    PyErr_SetString(PyExc_RuntimeError, \"Suite field \\\"body\\\" changed size during iteration\");\n                    goto failed;\n                }\n                asdl_seq_SET(body, i, val);\n            }\n            Py_CLEAR(tmp);\n        }\n        *out = Suite(body, arena);\n        if (*out == NULL) goto failed;\n        return 0;\n    }\n\n    PyErr_Format(PyExc_TypeError, \"expected some sort of mod, but got %R\", obj);\n    failed:\n    Py_XDECREF(tmp);\n    return 1;\n}\n\nint\nobj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)\n{\n    int isinstance;\n\n    PyObject *tmp = NULL;\n    int lineno;\n    int col_offset;\n\n    if (obj == Py_None) {\n        *out = NULL;\n        return 0;\n    }\n    if (lookup_attr_id(obj, &PyId_lineno, &tmp) < 0) {\n        return 1;\n    }\n    if (tmp == NULL) {\n        PyErr_SetString(PyExc_TypeError, \"required field \\\"lineno\\\" missing from stmt\");\n        return 1;\n    }\n    else {\n        int res;\n        res = obj2ast_int(tmp, &lineno, arena);\n        if (res != 0) goto failed;\n        Py_CLEAR(tmp);\n    }\n    if (lookup_attr_id(obj, &PyId_col_offset, &tmp) < 0) {\n        return 1;\n    }\n    if (tmp == NULL) {\n        PyErr_SetString(PyExc_TypeError, \"required field \\\"col_offset\\\" missing from stmt\");\n        return 1;\n    }\n    else {\n        int res;\n        res = obj2ast_int(tmp, &col_offset, arena);\n        if (res != 0) goto failed;\n        Py_CLEAR(tmp);\n    }\n    isinstance = PyObject_IsInstance(obj, (PyObject*)FunctionDef_type);\n    if (isinstance == -1) {\n        return 1;\n    }\n    if (isinstance) {\n        identifier name;\n        arguments_ty args;\n        asdl_seq* body;\n        asdl_seq* decorator_list;\n        expr_ty returns;\n        string type_comment;\n\n        if (lookup_attr_id(obj, &PyId_name, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"name\\\" missing from FunctionDef\");\n            return 1;\n        }\n        else {\n            int res;\n            res = obj2ast_identifier(tmp, &name, arena);\n            if (res != 0) goto failed;\n            Py_CLEAR(tmp);\n        }\n        if (lookup_attr_id(obj, &PyId_args, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"args\\\" missing from FunctionDef\");\n            return 1;\n        }\n        else {\n            int res;\n            res = obj2ast_arguments(tmp, &args, arena);\n            if (res != 0) goto failed;\n            Py_CLEAR(tmp);\n        }\n        if (lookup_attr_id(obj, &PyId_body, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"body\\\" missing from FunctionDef\");\n            return 1;\n        }\n        else {\n            int res;\n            Py_ssize_t len;\n            Py_ssize_t i;\n            if (!PyList_Check(tmp)) {\n                PyErr_Format(PyExc_TypeError, \"FunctionDef field \\\"body\\\" must be a list, not a %.200s\", tmp->ob_type->tp_name);\n                goto failed;\n            }\n            len = PyList_GET_SIZE(tmp);\n            body = _Ta3_asdl_seq_new(len, arena);\n            if (body == NULL) goto failed;\n            for (i = 0; i < len; i++) {\n                stmt_ty val;\n                res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &val, arena);\n                if (res != 0) goto failed;\n                if (len != PyList_GET_SIZE(tmp)) {\n                    PyErr_SetString(PyExc_RuntimeError, \"FunctionDef field \\\"body\\\" changed size during iteration\");\n                    goto failed;\n                }\n                asdl_seq_SET(body, i, val);\n            }\n            Py_CLEAR(tmp);\n        }\n        if (lookup_attr_id(obj, &PyId_decorator_list, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"decorator_list\\\" missing from FunctionDef\");\n            return 1;\n        }\n        else {\n            int res;\n            Py_ssize_t len;\n            Py_ssize_t i;\n            if (!PyList_Check(tmp)) {\n                PyErr_Format(PyExc_TypeError, \"FunctionDef field \\\"decorator_list\\\" must be a list, not a %.200s\", tmp->ob_type->tp_name);\n                goto failed;\n            }\n            len = PyList_GET_SIZE(tmp);\n            decorator_list = _Ta3_asdl_seq_new(len, arena);\n            if (decorator_list == NULL) goto failed;\n            for (i = 0; i < len; i++) {\n                expr_ty val;\n                res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &val, arena);\n                if (res != 0) goto failed;\n                if (len != PyList_GET_SIZE(tmp)) {\n                    PyErr_SetString(PyExc_RuntimeError, \"FunctionDef field \\\"decorator_list\\\" changed size during iteration\");\n                    goto failed;\n                }\n                asdl_seq_SET(decorator_list, i, val);\n            }\n            Py_CLEAR(tmp);\n        }\n        if (lookup_attr_id(obj, &PyId_returns, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL || tmp == Py_None) {\n            Py_CLEAR(tmp);\n            returns = NULL;\n        }\n        else {\n            int res;\n            res = obj2ast_expr(tmp, &returns, arena);\n            if (res != 0) goto failed;\n            Py_CLEAR(tmp);\n        }\n        if (lookup_attr_id(obj, &PyId_type_comment, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL || tmp == Py_None) {\n            Py_CLEAR(tmp);\n            type_comment = NULL;\n        }\n        else {\n            int res;\n            res = obj2ast_string(tmp, &type_comment, arena);\n            if (res != 0) goto failed;\n            Py_CLEAR(tmp);\n        }\n        *out = FunctionDef(name, args, body, decorator_list, returns,\n                           type_comment, lineno, col_offset, arena);\n        if (*out == NULL) goto failed;\n        return 0;\n    }\n    isinstance = PyObject_IsInstance(obj, (PyObject*)AsyncFunctionDef_type);\n    if (isinstance == -1) {\n        return 1;\n    }\n    if (isinstance) {\n        identifier name;\n        arguments_ty args;\n        asdl_seq* body;\n        asdl_seq* decorator_list;\n        expr_ty returns;\n        string type_comment;\n\n        if (lookup_attr_id(obj, &PyId_name, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"name\\\" missing from AsyncFunctionDef\");\n            return 1;\n        }\n        else {\n            int res;\n            res = obj2ast_identifier(tmp, &name, arena);\n            if (res != 0) goto failed;\n            Py_CLEAR(tmp);\n        }\n        if (lookup_attr_id(obj, &PyId_args, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"args\\\" missing from AsyncFunctionDef\");\n            return 1;\n        }\n        else {\n            int res;\n            res = obj2ast_arguments(tmp, &args, arena);\n            if (res != 0) goto failed;\n            Py_CLEAR(tmp);\n        }\n        if (lookup_attr_id(obj, &PyId_body, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"body\\\" missing from AsyncFunctionDef\");\n            return 1;\n        }\n        else {\n            int res;\n            Py_ssize_t len;\n            Py_ssize_t i;\n            if (!PyList_Check(tmp)) {\n                PyErr_Format(PyExc_TypeError, \"AsyncFunctionDef field \\\"body\\\" must be a list, not a %.200s\", tmp->ob_type->tp_name);\n                goto failed;\n            }\n            len = PyList_GET_SIZE(tmp);\n            body = _Ta3_asdl_seq_new(len, arena);\n            if (body == NULL) goto failed;\n            for (i = 0; i < len; i++) {\n                stmt_ty val;\n                res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &val, arena);\n                if (res != 0) goto failed;\n                if (len != PyList_GET_SIZE(tmp)) {\n                    PyErr_SetString(PyExc_RuntimeError, \"AsyncFunctionDef field \\\"body\\\" changed size during iteration\");\n                    goto failed;\n                }\n                asdl_seq_SET(body, i, val);\n            }\n            Py_CLEAR(tmp);\n        }\n        if (lookup_attr_id(obj, &PyId_decorator_list, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"decorator_list\\\" missing from AsyncFunctionDef\");\n            return 1;\n        }\n        else {\n            int res;\n            Py_ssize_t len;\n            Py_ssize_t i;\n            if (!PyList_Check(tmp)) {\n                PyErr_Format(PyExc_TypeError, \"AsyncFunctionDef field \\\"decorator_list\\\" must be a list, not a %.200s\", tmp->ob_type->tp_name);\n                goto failed;\n            }\n            len = PyList_GET_SIZE(tmp);\n            decorator_list = _Ta3_asdl_seq_new(len, arena);\n            if (decorator_list == NULL) goto failed;\n            for (i = 0; i < len; i++) {\n                expr_ty val;\n                res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &val, arena);\n                if (res != 0) goto failed;\n                if (len != PyList_GET_SIZE(tmp)) {\n                    PyErr_SetString(PyExc_RuntimeError, \"AsyncFunctionDef field \\\"decorator_list\\\" changed size during iteration\");\n                    goto failed;\n                }\n                asdl_seq_SET(decorator_list, i, val);\n            }\n            Py_CLEAR(tmp);\n        }\n        if (lookup_attr_id(obj, &PyId_returns, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL || tmp == Py_None) {\n            Py_CLEAR(tmp);\n            returns = NULL;\n        }\n        else {\n            int res;\n            res = obj2ast_expr(tmp, &returns, arena);\n            if (res != 0) goto failed;\n            Py_CLEAR(tmp);\n        }\n        if (lookup_attr_id(obj, &PyId_type_comment, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL || tmp == Py_None) {\n            Py_CLEAR(tmp);\n            type_comment = NULL;\n        }\n        else {\n            int res;\n            res = obj2ast_string(tmp, &type_comment, arena);\n            if (res != 0) goto failed;\n            Py_CLEAR(tmp);\n        }\n        *out = AsyncFunctionDef(name, args, body, decorator_list, returns,\n                                type_comment, lineno, col_offset, arena);\n        if (*out == NULL) goto failed;\n        return 0;\n    }\n    isinstance = PyObject_IsInstance(obj, (PyObject*)ClassDef_type);\n    if (isinstance == -1) {\n        return 1;\n    }\n    if (isinstance) {\n        identifier name;\n        asdl_seq* bases;\n        asdl_seq* keywords;\n        asdl_seq* body;\n        asdl_seq* decorator_list;\n\n        if (lookup_attr_id(obj, &PyId_name, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"name\\\" missing from ClassDef\");\n            return 1;\n        }\n        else {\n            int res;\n            res = obj2ast_identifier(tmp, &name, arena);\n            if (res != 0) goto failed;\n            Py_CLEAR(tmp);\n        }\n        if (lookup_attr_id(obj, &PyId_bases, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"bases\\\" missing from ClassDef\");\n            return 1;\n        }\n        else {\n            int res;\n            Py_ssize_t len;\n            Py_ssize_t i;\n            if (!PyList_Check(tmp)) {\n                PyErr_Format(PyExc_TypeError, \"ClassDef field \\\"bases\\\" must be a list, not a %.200s\", tmp->ob_type->tp_name);\n                goto failed;\n            }\n            len = PyList_GET_SIZE(tmp);\n            bases = _Ta3_asdl_seq_new(len, arena);\n            if (bases == NULL) goto failed;\n            for (i = 0; i < len; i++) {\n                expr_ty val;\n                res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &val, arena);\n                if (res != 0) goto failed;\n                if (len != PyList_GET_SIZE(tmp)) {\n                    PyErr_SetString(PyExc_RuntimeError, \"ClassDef field \\\"bases\\\" changed size during iteration\");\n                    goto failed;\n                }\n                asdl_seq_SET(bases, i, val);\n            }\n            Py_CLEAR(tmp);\n        }\n        if (lookup_attr_id(obj, &PyId_keywords, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"keywords\\\" missing from ClassDef\");\n            return 1;\n        }\n        else {\n            int res;\n            Py_ssize_t len;\n            Py_ssize_t i;\n            if (!PyList_Check(tmp)) {\n                PyErr_Format(PyExc_TypeError, \"ClassDef field \\\"keywords\\\" must be a list, not a %.200s\", tmp->ob_type->tp_name);\n                goto failed;\n            }\n            len = PyList_GET_SIZE(tmp);\n            keywords = _Ta3_asdl_seq_new(len, arena);\n            if (keywords == NULL) goto failed;\n            for (i = 0; i < len; i++) {\n                keyword_ty val;\n                res = obj2ast_keyword(PyList_GET_ITEM(tmp, i), &val, arena);\n                if (res != 0) goto failed;\n                if (len != PyList_GET_SIZE(tmp)) {\n                    PyErr_SetString(PyExc_RuntimeError, \"ClassDef field \\\"keywords\\\" changed size during iteration\");\n                    goto failed;\n                }\n                asdl_seq_SET(keywords, i, val);\n            }\n            Py_CLEAR(tmp);\n        }\n        if (lookup_attr_id(obj, &PyId_body, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"body\\\" missing from ClassDef\");\n            return 1;\n        }\n        else {\n            int res;\n            Py_ssize_t len;\n            Py_ssize_t i;\n            if (!PyList_Check(tmp)) {\n                PyErr_Format(PyExc_TypeError, \"ClassDef field \\\"body\\\" must be a list, not a %.200s\", tmp->ob_type->tp_name);\n                goto failed;\n            }\n            len = PyList_GET_SIZE(tmp);\n            body = _Ta3_asdl_seq_new(len, arena);\n            if (body == NULL) goto failed;\n            for (i = 0; i < len; i++) {\n                stmt_ty val;\n                res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &val, arena);\n                if (res != 0) goto failed;\n                if (len != PyList_GET_SIZE(tmp)) {\n                    PyErr_SetString(PyExc_RuntimeError, \"ClassDef field \\\"body\\\" changed size during iteration\");\n                    goto failed;\n                }\n                asdl_seq_SET(body, i, val);\n            }\n            Py_CLEAR(tmp);\n        }\n        if (lookup_attr_id(obj, &PyId_decorator_list, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"decorator_list\\\" missing from ClassDef\");\n            return 1;\n        }\n        else {\n            int res;\n            Py_ssize_t len;\n            Py_ssize_t i;\n            if (!PyList_Check(tmp)) {\n                PyErr_Format(PyExc_TypeError, \"ClassDef field \\\"decorator_list\\\" must be a list, not a %.200s\", tmp->ob_type->tp_name);\n                goto failed;\n            }\n            len = PyList_GET_SIZE(tmp);\n            decorator_list = _Ta3_asdl_seq_new(len, arena);\n            if (decorator_list == NULL) goto failed;\n            for (i = 0; i < len; i++) {\n                expr_ty val;\n                res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &val, arena);\n                if (res != 0) goto failed;\n                if (len != PyList_GET_SIZE(tmp)) {\n                    PyErr_SetString(PyExc_RuntimeError, \"ClassDef field \\\"decorator_list\\\" changed size during iteration\");\n                    goto failed;\n                }\n                asdl_seq_SET(decorator_list, i, val);\n            }\n            Py_CLEAR(tmp);\n        }\n        *out = ClassDef(name, bases, keywords, body, decorator_list, lineno,\n                        col_offset, arena);\n        if (*out == NULL) goto failed;\n        return 0;\n    }\n    isinstance = PyObject_IsInstance(obj, (PyObject*)Return_type);\n    if (isinstance == -1) {\n        return 1;\n    }\n    if (isinstance) {\n        expr_ty value;\n\n        if (lookup_attr_id(obj, &PyId_value, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL || tmp == Py_None) {\n            Py_CLEAR(tmp);\n            value = NULL;\n        }\n        else {\n            int res;\n            res = obj2ast_expr(tmp, &value, arena);\n            if (res != 0) goto failed;\n            Py_CLEAR(tmp);\n        }\n        *out = Return(value, lineno, col_offset, arena);\n        if (*out == NULL) goto failed;\n        return 0;\n    }\n    isinstance = PyObject_IsInstance(obj, (PyObject*)Delete_type);\n    if (isinstance == -1) {\n        return 1;\n    }\n    if (isinstance) {\n        asdl_seq* targets;\n\n        if (lookup_attr_id(obj, &PyId_targets, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"targets\\\" missing from Delete\");\n            return 1;\n        }\n        else {\n            int res;\n            Py_ssize_t len;\n            Py_ssize_t i;\n            if (!PyList_Check(tmp)) {\n                PyErr_Format(PyExc_TypeError, \"Delete field \\\"targets\\\" must be a list, not a %.200s\", tmp->ob_type->tp_name);\n                goto failed;\n            }\n            len = PyList_GET_SIZE(tmp);\n            targets = _Ta3_asdl_seq_new(len, arena);\n            if (targets == NULL) goto failed;\n            for (i = 0; i < len; i++) {\n                expr_ty val;\n                res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &val, arena);\n                if (res != 0) goto failed;\n                if (len != PyList_GET_SIZE(tmp)) {\n                    PyErr_SetString(PyExc_RuntimeError, \"Delete field \\\"targets\\\" changed size during iteration\");\n                    goto failed;\n                }\n                asdl_seq_SET(targets, i, val);\n            }\n            Py_CLEAR(tmp);\n        }\n        *out = Delete(targets, lineno, col_offset, arena);\n        if (*out == NULL) goto failed;\n        return 0;\n    }\n    isinstance = PyObject_IsInstance(obj, (PyObject*)Assign_type);\n    if (isinstance == -1) {\n        return 1;\n    }\n    if (isinstance) {\n        asdl_seq* targets;\n        expr_ty value;\n        string type_comment;\n\n        if (lookup_attr_id(obj, &PyId_targets, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"targets\\\" missing from Assign\");\n            return 1;\n        }\n        else {\n            int res;\n            Py_ssize_t len;\n            Py_ssize_t i;\n            if (!PyList_Check(tmp)) {\n                PyErr_Format(PyExc_TypeError, \"Assign field \\\"targets\\\" must be a list, not a %.200s\", tmp->ob_type->tp_name);\n                goto failed;\n            }\n            len = PyList_GET_SIZE(tmp);\n            targets = _Ta3_asdl_seq_new(len, arena);\n            if (targets == NULL) goto failed;\n            for (i = 0; i < len; i++) {\n                expr_ty val;\n                res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &val, arena);\n                if (res != 0) goto failed;\n                if (len != PyList_GET_SIZE(tmp)) {\n                    PyErr_SetString(PyExc_RuntimeError, \"Assign field \\\"targets\\\" changed size during iteration\");\n                    goto failed;\n                }\n                asdl_seq_SET(targets, i, val);\n            }\n            Py_CLEAR(tmp);\n        }\n        if (lookup_attr_id(obj, &PyId_value, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"value\\\" missing from Assign\");\n            return 1;\n        }\n        else {\n            int res;\n            res = obj2ast_expr(tmp, &value, arena);\n            if (res != 0) goto failed;\n            Py_CLEAR(tmp);\n        }\n        if (lookup_attr_id(obj, &PyId_type_comment, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL || tmp == Py_None) {\n            Py_CLEAR(tmp);\n            type_comment = NULL;\n        }\n        else {\n            int res;\n            res = obj2ast_string(tmp, &type_comment, arena);\n            if (res != 0) goto failed;\n            Py_CLEAR(tmp);\n        }\n        *out = Assign(targets, value, type_comment, lineno, col_offset, arena);\n        if (*out == NULL) goto failed;\n        return 0;\n    }\n    isinstance = PyObject_IsInstance(obj, (PyObject*)AugAssign_type);\n    if (isinstance == -1) {\n        return 1;\n    }\n    if (isinstance) {\n        expr_ty target;\n        operator_ty op;\n        expr_ty value;\n\n        if (lookup_attr_id(obj, &PyId_target, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"target\\\" missing from AugAssign\");\n            return 1;\n        }\n        else {\n            int res;\n            res = obj2ast_expr(tmp, &target, arena);\n            if (res != 0) goto failed;\n            Py_CLEAR(tmp);\n        }\n        if (lookup_attr_id(obj, &PyId_op, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"op\\\" missing from AugAssign\");\n            return 1;\n        }\n        else {\n            int res;\n            res = obj2ast_operator(tmp, &op, arena);\n            if (res != 0) goto failed;\n            Py_CLEAR(tmp);\n        }\n        if (lookup_attr_id(obj, &PyId_value, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"value\\\" missing from AugAssign\");\n            return 1;\n        }\n        else {\n            int res;\n            res = obj2ast_expr(tmp, &value, arena);\n            if (res != 0) goto failed;\n            Py_CLEAR(tmp);\n        }\n        *out = AugAssign(target, op, value, lineno, col_offset, arena);\n        if (*out == NULL) goto failed;\n        return 0;\n    }\n    isinstance = PyObject_IsInstance(obj, (PyObject*)AnnAssign_type);\n    if (isinstance == -1) {\n        return 1;\n    }\n    if (isinstance) {\n        expr_ty target;\n        expr_ty annotation;\n        expr_ty value;\n        int simple;\n\n        if (lookup_attr_id(obj, &PyId_target, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"target\\\" missing from AnnAssign\");\n            return 1;\n        }\n        else {\n            int res;\n            res = obj2ast_expr(tmp, &target, arena);\n            if (res != 0) goto failed;\n            Py_CLEAR(tmp);\n        }\n        if (lookup_attr_id(obj, &PyId_annotation, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"annotation\\\" missing from AnnAssign\");\n            return 1;\n        }\n        else {\n            int res;\n            res = obj2ast_expr(tmp, &annotation, arena);\n            if (res != 0) goto failed;\n            Py_CLEAR(tmp);\n        }\n        if (lookup_attr_id(obj, &PyId_value, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL || tmp == Py_None) {\n            Py_CLEAR(tmp);\n            value = NULL;\n        }\n        else {\n            int res;\n            res = obj2ast_expr(tmp, &value, arena);\n            if (res != 0) goto failed;\n            Py_CLEAR(tmp);\n        }\n        if (lookup_attr_id(obj, &PyId_simple, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"simple\\\" missing from AnnAssign\");\n            return 1;\n        }\n        else {\n            int res;\n            res = obj2ast_int(tmp, &simple, arena);\n            if (res != 0) goto failed;\n            Py_CLEAR(tmp);\n        }\n        *out = AnnAssign(target, annotation, value, simple, lineno, col_offset,\n                         arena);\n        if (*out == NULL) goto failed;\n        return 0;\n    }\n    isinstance = PyObject_IsInstance(obj, (PyObject*)For_type);\n    if (isinstance == -1) {\n        return 1;\n    }\n    if (isinstance) {\n        expr_ty target;\n        expr_ty iter;\n        asdl_seq* body;\n        asdl_seq* orelse;\n        string type_comment;\n\n        if (lookup_attr_id(obj, &PyId_target, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"target\\\" missing from For\");\n            return 1;\n        }\n        else {\n            int res;\n            res = obj2ast_expr(tmp, &target, arena);\n            if (res != 0) goto failed;\n            Py_CLEAR(tmp);\n        }\n        if (lookup_attr_id(obj, &PyId_iter, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"iter\\\" missing from For\");\n            return 1;\n        }\n        else {\n            int res;\n            res = obj2ast_expr(tmp, &iter, arena);\n            if (res != 0) goto failed;\n            Py_CLEAR(tmp);\n        }\n        if (lookup_attr_id(obj, &PyId_body, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"body\\\" missing from For\");\n            return 1;\n        }\n        else {\n            int res;\n            Py_ssize_t len;\n            Py_ssize_t i;\n            if (!PyList_Check(tmp)) {\n                PyErr_Format(PyExc_TypeError, \"For field \\\"body\\\" must be a list, not a %.200s\", tmp->ob_type->tp_name);\n                goto failed;\n            }\n            len = PyList_GET_SIZE(tmp);\n            body = _Ta3_asdl_seq_new(len, arena);\n            if (body == NULL) goto failed;\n            for (i = 0; i < len; i++) {\n                stmt_ty val;\n                res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &val, arena);\n                if (res != 0) goto failed;\n                if (len != PyList_GET_SIZE(tmp)) {\n                    PyErr_SetString(PyExc_RuntimeError, \"For field \\\"body\\\" changed size during iteration\");\n                    goto failed;\n                }\n                asdl_seq_SET(body, i, val);\n            }\n            Py_CLEAR(tmp);\n        }\n        if (lookup_attr_id(obj, &PyId_orelse, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"orelse\\\" missing from For\");\n            return 1;\n        }\n        else {\n            int res;\n            Py_ssize_t len;\n            Py_ssize_t i;\n            if (!PyList_Check(tmp)) {\n                PyErr_Format(PyExc_TypeError, \"For field \\\"orelse\\\" must be a list, not a %.200s\", tmp->ob_type->tp_name);\n                goto failed;\n            }\n            len = PyList_GET_SIZE(tmp);\n            orelse = _Ta3_asdl_seq_new(len, arena);\n            if (orelse == NULL) goto failed;\n            for (i = 0; i < len; i++) {\n                stmt_ty val;\n                res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &val, arena);\n                if (res != 0) goto failed;\n                if (len != PyList_GET_SIZE(tmp)) {\n                    PyErr_SetString(PyExc_RuntimeError, \"For field \\\"orelse\\\" changed size during iteration\");\n                    goto failed;\n                }\n                asdl_seq_SET(orelse, i, val);\n            }\n            Py_CLEAR(tmp);\n        }\n        if (lookup_attr_id(obj, &PyId_type_comment, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL || tmp == Py_None) {\n            Py_CLEAR(tmp);\n            type_comment = NULL;\n        }\n        else {\n            int res;\n            res = obj2ast_string(tmp, &type_comment, arena);\n            if (res != 0) goto failed;\n            Py_CLEAR(tmp);\n        }\n        *out = For(target, iter, body, orelse, type_comment, lineno,\n                   col_offset, arena);\n        if (*out == NULL) goto failed;\n        return 0;\n    }\n    isinstance = PyObject_IsInstance(obj, (PyObject*)AsyncFor_type);\n    if (isinstance == -1) {\n        return 1;\n    }\n    if (isinstance) {\n        expr_ty target;\n        expr_ty iter;\n        asdl_seq* body;\n        asdl_seq* orelse;\n        string type_comment;\n\n        if (lookup_attr_id(obj, &PyId_target, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"target\\\" missing from AsyncFor\");\n            return 1;\n        }\n        else {\n            int res;\n            res = obj2ast_expr(tmp, &target, arena);\n            if (res != 0) goto failed;\n            Py_CLEAR(tmp);\n        }\n        if (lookup_attr_id(obj, &PyId_iter, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"iter\\\" missing from AsyncFor\");\n            return 1;\n        }\n        else {\n            int res;\n            res = obj2ast_expr(tmp, &iter, arena);\n            if (res != 0) goto failed;\n            Py_CLEAR(tmp);\n        }\n        if (lookup_attr_id(obj, &PyId_body, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"body\\\" missing from AsyncFor\");\n            return 1;\n        }\n        else {\n            int res;\n            Py_ssize_t len;\n            Py_ssize_t i;\n            if (!PyList_Check(tmp)) {\n                PyErr_Format(PyExc_TypeError, \"AsyncFor field \\\"body\\\" must be a list, not a %.200s\", tmp->ob_type->tp_name);\n                goto failed;\n            }\n            len = PyList_GET_SIZE(tmp);\n            body = _Ta3_asdl_seq_new(len, arena);\n            if (body == NULL) goto failed;\n            for (i = 0; i < len; i++) {\n                stmt_ty val;\n                res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &val, arena);\n                if (res != 0) goto failed;\n                if (len != PyList_GET_SIZE(tmp)) {\n                    PyErr_SetString(PyExc_RuntimeError, \"AsyncFor field \\\"body\\\" changed size during iteration\");\n                    goto failed;\n                }\n                asdl_seq_SET(body, i, val);\n            }\n            Py_CLEAR(tmp);\n        }\n        if (lookup_attr_id(obj, &PyId_orelse, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"orelse\\\" missing from AsyncFor\");\n            return 1;\n        }\n        else {\n            int res;\n            Py_ssize_t len;\n            Py_ssize_t i;\n            if (!PyList_Check(tmp)) {\n                PyErr_Format(PyExc_TypeError, \"AsyncFor field \\\"orelse\\\" must be a list, not a %.200s\", tmp->ob_type->tp_name);\n                goto failed;\n            }\n            len = PyList_GET_SIZE(tmp);\n            orelse = _Ta3_asdl_seq_new(len, arena);\n            if (orelse == NULL) goto failed;\n            for (i = 0; i < len; i++) {\n                stmt_ty val;\n                res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &val, arena);\n                if (res != 0) goto failed;\n                if (len != PyList_GET_SIZE(tmp)) {\n                    PyErr_SetString(PyExc_RuntimeError, \"AsyncFor field \\\"orelse\\\" changed size during iteration\");\n                    goto failed;\n                }\n                asdl_seq_SET(orelse, i, val);\n            }\n            Py_CLEAR(tmp);\n        }\n        if (lookup_attr_id(obj, &PyId_type_comment, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL || tmp == Py_None) {\n            Py_CLEAR(tmp);\n            type_comment = NULL;\n        }\n        else {\n            int res;\n            res = obj2ast_string(tmp, &type_comment, arena);\n            if (res != 0) goto failed;\n            Py_CLEAR(tmp);\n        }\n        *out = AsyncFor(target, iter, body, orelse, type_comment, lineno,\n                        col_offset, arena);\n        if (*out == NULL) goto failed;\n        return 0;\n    }\n    isinstance = PyObject_IsInstance(obj, (PyObject*)While_type);\n    if (isinstance == -1) {\n        return 1;\n    }\n    if (isinstance) {\n        expr_ty test;\n        asdl_seq* body;\n        asdl_seq* orelse;\n\n        if (lookup_attr_id(obj, &PyId_test, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"test\\\" missing from While\");\n            return 1;\n        }\n        else {\n            int res;\n            res = obj2ast_expr(tmp, &test, arena);\n            if (res != 0) goto failed;\n            Py_CLEAR(tmp);\n        }\n        if (lookup_attr_id(obj, &PyId_body, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"body\\\" missing from While\");\n            return 1;\n        }\n        else {\n            int res;\n            Py_ssize_t len;\n            Py_ssize_t i;\n            if (!PyList_Check(tmp)) {\n                PyErr_Format(PyExc_TypeError, \"While field \\\"body\\\" must be a list, not a %.200s\", tmp->ob_type->tp_name);\n                goto failed;\n            }\n            len = PyList_GET_SIZE(tmp);\n            body = _Ta3_asdl_seq_new(len, arena);\n            if (body == NULL) goto failed;\n            for (i = 0; i < len; i++) {\n                stmt_ty val;\n                res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &val, arena);\n                if (res != 0) goto failed;\n                if (len != PyList_GET_SIZE(tmp)) {\n                    PyErr_SetString(PyExc_RuntimeError, \"While field \\\"body\\\" changed size during iteration\");\n                    goto failed;\n                }\n                asdl_seq_SET(body, i, val);\n            }\n            Py_CLEAR(tmp);\n        }\n        if (lookup_attr_id(obj, &PyId_orelse, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"orelse\\\" missing from While\");\n            return 1;\n        }\n        else {\n            int res;\n            Py_ssize_t len;\n            Py_ssize_t i;\n            if (!PyList_Check(tmp)) {\n                PyErr_Format(PyExc_TypeError, \"While field \\\"orelse\\\" must be a list, not a %.200s\", tmp->ob_type->tp_name);\n                goto failed;\n            }\n            len = PyList_GET_SIZE(tmp);\n            orelse = _Ta3_asdl_seq_new(len, arena);\n            if (orelse == NULL) goto failed;\n            for (i = 0; i < len; i++) {\n                stmt_ty val;\n                res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &val, arena);\n                if (res != 0) goto failed;\n                if (len != PyList_GET_SIZE(tmp)) {\n                    PyErr_SetString(PyExc_RuntimeError, \"While field \\\"orelse\\\" changed size during iteration\");\n                    goto failed;\n                }\n                asdl_seq_SET(orelse, i, val);\n            }\n            Py_CLEAR(tmp);\n        }\n        *out = While(test, body, orelse, lineno, col_offset, arena);\n        if (*out == NULL) goto failed;\n        return 0;\n    }\n    isinstance = PyObject_IsInstance(obj, (PyObject*)If_type);\n    if (isinstance == -1) {\n        return 1;\n    }\n    if (isinstance) {\n        expr_ty test;\n        asdl_seq* body;\n        asdl_seq* orelse;\n\n        if (lookup_attr_id(obj, &PyId_test, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"test\\\" missing from If\");\n            return 1;\n        }\n        else {\n            int res;\n            res = obj2ast_expr(tmp, &test, arena);\n            if (res != 0) goto failed;\n            Py_CLEAR(tmp);\n        }\n        if (lookup_attr_id(obj, &PyId_body, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"body\\\" missing from If\");\n            return 1;\n        }\n        else {\n            int res;\n            Py_ssize_t len;\n            Py_ssize_t i;\n            if (!PyList_Check(tmp)) {\n                PyErr_Format(PyExc_TypeError, \"If field \\\"body\\\" must be a list, not a %.200s\", tmp->ob_type->tp_name);\n                goto failed;\n            }\n            len = PyList_GET_SIZE(tmp);\n            body = _Ta3_asdl_seq_new(len, arena);\n            if (body == NULL) goto failed;\n            for (i = 0; i < len; i++) {\n                stmt_ty val;\n                res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &val, arena);\n                if (res != 0) goto failed;\n                if (len != PyList_GET_SIZE(tmp)) {\n                    PyErr_SetString(PyExc_RuntimeError, \"If field \\\"body\\\" changed size during iteration\");\n                    goto failed;\n                }\n                asdl_seq_SET(body, i, val);\n            }\n            Py_CLEAR(tmp);\n        }\n        if (lookup_attr_id(obj, &PyId_orelse, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"orelse\\\" missing from If\");\n            return 1;\n        }\n        else {\n            int res;\n            Py_ssize_t len;\n            Py_ssize_t i;\n            if (!PyList_Check(tmp)) {\n                PyErr_Format(PyExc_TypeError, \"If field \\\"orelse\\\" must be a list, not a %.200s\", tmp->ob_type->tp_name);\n                goto failed;\n            }\n            len = PyList_GET_SIZE(tmp);\n            orelse = _Ta3_asdl_seq_new(len, arena);\n            if (orelse == NULL) goto failed;\n            for (i = 0; i < len; i++) {\n                stmt_ty val;\n                res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &val, arena);\n                if (res != 0) goto failed;\n                if (len != PyList_GET_SIZE(tmp)) {\n                    PyErr_SetString(PyExc_RuntimeError, \"If field \\\"orelse\\\" changed size during iteration\");\n                    goto failed;\n                }\n                asdl_seq_SET(orelse, i, val);\n            }\n            Py_CLEAR(tmp);\n        }\n        *out = If(test, body, orelse, lineno, col_offset, arena);\n        if (*out == NULL) goto failed;\n        return 0;\n    }\n    isinstance = PyObject_IsInstance(obj, (PyObject*)With_type);\n    if (isinstance == -1) {\n        return 1;\n    }\n    if (isinstance) {\n        asdl_seq* items;\n        asdl_seq* body;\n        string type_comment;\n\n        if (lookup_attr_id(obj, &PyId_items, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"items\\\" missing from With\");\n            return 1;\n        }\n        else {\n            int res;\n            Py_ssize_t len;\n            Py_ssize_t i;\n            if (!PyList_Check(tmp)) {\n                PyErr_Format(PyExc_TypeError, \"With field \\\"items\\\" must be a list, not a %.200s\", tmp->ob_type->tp_name);\n                goto failed;\n            }\n            len = PyList_GET_SIZE(tmp);\n            items = _Ta3_asdl_seq_new(len, arena);\n            if (items == NULL) goto failed;\n            for (i = 0; i < len; i++) {\n                withitem_ty val;\n                res = obj2ast_withitem(PyList_GET_ITEM(tmp, i), &val, arena);\n                if (res != 0) goto failed;\n                if (len != PyList_GET_SIZE(tmp)) {\n                    PyErr_SetString(PyExc_RuntimeError, \"With field \\\"items\\\" changed size during iteration\");\n                    goto failed;\n                }\n                asdl_seq_SET(items, i, val);\n            }\n            Py_CLEAR(tmp);\n        }\n        if (lookup_attr_id(obj, &PyId_body, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"body\\\" missing from With\");\n            return 1;\n        }\n        else {\n            int res;\n            Py_ssize_t len;\n            Py_ssize_t i;\n            if (!PyList_Check(tmp)) {\n                PyErr_Format(PyExc_TypeError, \"With field \\\"body\\\" must be a list, not a %.200s\", tmp->ob_type->tp_name);\n                goto failed;\n            }\n            len = PyList_GET_SIZE(tmp);\n            body = _Ta3_asdl_seq_new(len, arena);\n            if (body == NULL) goto failed;\n            for (i = 0; i < len; i++) {\n                stmt_ty val;\n                res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &val, arena);\n                if (res != 0) goto failed;\n                if (len != PyList_GET_SIZE(tmp)) {\n                    PyErr_SetString(PyExc_RuntimeError, \"With field \\\"body\\\" changed size during iteration\");\n                    goto failed;\n                }\n                asdl_seq_SET(body, i, val);\n            }\n            Py_CLEAR(tmp);\n        }\n        if (lookup_attr_id(obj, &PyId_type_comment, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL || tmp == Py_None) {\n            Py_CLEAR(tmp);\n            type_comment = NULL;\n        }\n        else {\n            int res;\n            res = obj2ast_string(tmp, &type_comment, arena);\n            if (res != 0) goto failed;\n            Py_CLEAR(tmp);\n        }\n        *out = With(items, body, type_comment, lineno, col_offset, arena);\n        if (*out == NULL) goto failed;\n        return 0;\n    }\n    isinstance = PyObject_IsInstance(obj, (PyObject*)AsyncWith_type);\n    if (isinstance == -1) {\n        return 1;\n    }\n    if (isinstance) {\n        asdl_seq* items;\n        asdl_seq* body;\n        string type_comment;\n\n        if (lookup_attr_id(obj, &PyId_items, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"items\\\" missing from AsyncWith\");\n            return 1;\n        }\n        else {\n            int res;\n            Py_ssize_t len;\n            Py_ssize_t i;\n            if (!PyList_Check(tmp)) {\n                PyErr_Format(PyExc_TypeError, \"AsyncWith field \\\"items\\\" must be a list, not a %.200s\", tmp->ob_type->tp_name);\n                goto failed;\n            }\n            len = PyList_GET_SIZE(tmp);\n            items = _Ta3_asdl_seq_new(len, arena);\n            if (items == NULL) goto failed;\n            for (i = 0; i < len; i++) {\n                withitem_ty val;\n                res = obj2ast_withitem(PyList_GET_ITEM(tmp, i), &val, arena);\n                if (res != 0) goto failed;\n                if (len != PyList_GET_SIZE(tmp)) {\n                    PyErr_SetString(PyExc_RuntimeError, \"AsyncWith field \\\"items\\\" changed size during iteration\");\n                    goto failed;\n                }\n                asdl_seq_SET(items, i, val);\n            }\n            Py_CLEAR(tmp);\n        }\n        if (lookup_attr_id(obj, &PyId_body, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"body\\\" missing from AsyncWith\");\n            return 1;\n        }\n        else {\n            int res;\n            Py_ssize_t len;\n            Py_ssize_t i;\n            if (!PyList_Check(tmp)) {\n                PyErr_Format(PyExc_TypeError, \"AsyncWith field \\\"body\\\" must be a list, not a %.200s\", tmp->ob_type->tp_name);\n                goto failed;\n            }\n            len = PyList_GET_SIZE(tmp);\n            body = _Ta3_asdl_seq_new(len, arena);\n            if (body == NULL) goto failed;\n            for (i = 0; i < len; i++) {\n                stmt_ty val;\n                res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &val, arena);\n                if (res != 0) goto failed;\n                if (len != PyList_GET_SIZE(tmp)) {\n                    PyErr_SetString(PyExc_RuntimeError, \"AsyncWith field \\\"body\\\" changed size during iteration\");\n                    goto failed;\n                }\n                asdl_seq_SET(body, i, val);\n            }\n            Py_CLEAR(tmp);\n        }\n        if (lookup_attr_id(obj, &PyId_type_comment, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL || tmp == Py_None) {\n            Py_CLEAR(tmp);\n            type_comment = NULL;\n        }\n        else {\n            int res;\n            res = obj2ast_string(tmp, &type_comment, arena);\n            if (res != 0) goto failed;\n            Py_CLEAR(tmp);\n        }\n        *out = AsyncWith(items, body, type_comment, lineno, col_offset, arena);\n        if (*out == NULL) goto failed;\n        return 0;\n    }\n    isinstance = PyObject_IsInstance(obj, (PyObject*)Raise_type);\n    if (isinstance == -1) {\n        return 1;\n    }\n    if (isinstance) {\n        expr_ty exc;\n        expr_ty cause;\n\n        if (lookup_attr_id(obj, &PyId_exc, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL || tmp == Py_None) {\n            Py_CLEAR(tmp);\n            exc = NULL;\n        }\n        else {\n            int res;\n            res = obj2ast_expr(tmp, &exc, arena);\n            if (res != 0) goto failed;\n            Py_CLEAR(tmp);\n        }\n        if (lookup_attr_id(obj, &PyId_cause, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL || tmp == Py_None) {\n            Py_CLEAR(tmp);\n            cause = NULL;\n        }\n        else {\n            int res;\n            res = obj2ast_expr(tmp, &cause, arena);\n            if (res != 0) goto failed;\n            Py_CLEAR(tmp);\n        }\n        *out = Raise(exc, cause, lineno, col_offset, arena);\n        if (*out == NULL) goto failed;\n        return 0;\n    }\n    isinstance = PyObject_IsInstance(obj, (PyObject*)Try_type);\n    if (isinstance == -1) {\n        return 1;\n    }\n    if (isinstance) {\n        asdl_seq* body;\n        asdl_seq* handlers;\n        asdl_seq* orelse;\n        asdl_seq* finalbody;\n\n        if (lookup_attr_id(obj, &PyId_body, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"body\\\" missing from Try\");\n            return 1;\n        }\n        else {\n            int res;\n            Py_ssize_t len;\n            Py_ssize_t i;\n            if (!PyList_Check(tmp)) {\n                PyErr_Format(PyExc_TypeError, \"Try field \\\"body\\\" must be a list, not a %.200s\", tmp->ob_type->tp_name);\n                goto failed;\n            }\n            len = PyList_GET_SIZE(tmp);\n            body = _Ta3_asdl_seq_new(len, arena);\n            if (body == NULL) goto failed;\n            for (i = 0; i < len; i++) {\n                stmt_ty val;\n                res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &val, arena);\n                if (res != 0) goto failed;\n                if (len != PyList_GET_SIZE(tmp)) {\n                    PyErr_SetString(PyExc_RuntimeError, \"Try field \\\"body\\\" changed size during iteration\");\n                    goto failed;\n                }\n                asdl_seq_SET(body, i, val);\n            }\n            Py_CLEAR(tmp);\n        }\n        if (lookup_attr_id(obj, &PyId_handlers, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"handlers\\\" missing from Try\");\n            return 1;\n        }\n        else {\n            int res;\n            Py_ssize_t len;\n            Py_ssize_t i;\n            if (!PyList_Check(tmp)) {\n                PyErr_Format(PyExc_TypeError, \"Try field \\\"handlers\\\" must be a list, not a %.200s\", tmp->ob_type->tp_name);\n                goto failed;\n            }\n            len = PyList_GET_SIZE(tmp);\n            handlers = _Ta3_asdl_seq_new(len, arena);\n            if (handlers == NULL) goto failed;\n            for (i = 0; i < len; i++) {\n                excepthandler_ty val;\n                res = obj2ast_excepthandler(PyList_GET_ITEM(tmp, i), &val, arena);\n                if (res != 0) goto failed;\n                if (len != PyList_GET_SIZE(tmp)) {\n                    PyErr_SetString(PyExc_RuntimeError, \"Try field \\\"handlers\\\" changed size during iteration\");\n                    goto failed;\n                }\n                asdl_seq_SET(handlers, i, val);\n            }\n            Py_CLEAR(tmp);\n        }\n        if (lookup_attr_id(obj, &PyId_orelse, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"orelse\\\" missing from Try\");\n            return 1;\n        }\n        else {\n            int res;\n            Py_ssize_t len;\n            Py_ssize_t i;\n            if (!PyList_Check(tmp)) {\n                PyErr_Format(PyExc_TypeError, \"Try field \\\"orelse\\\" must be a list, not a %.200s\", tmp->ob_type->tp_name);\n                goto failed;\n            }\n            len = PyList_GET_SIZE(tmp);\n            orelse = _Ta3_asdl_seq_new(len, arena);\n            if (orelse == NULL) goto failed;\n            for (i = 0; i < len; i++) {\n                stmt_ty val;\n                res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &val, arena);\n                if (res != 0) goto failed;\n                if (len != PyList_GET_SIZE(tmp)) {\n                    PyErr_SetString(PyExc_RuntimeError, \"Try field \\\"orelse\\\" changed size during iteration\");\n                    goto failed;\n                }\n                asdl_seq_SET(orelse, i, val);\n            }\n            Py_CLEAR(tmp);\n        }\n        if (lookup_attr_id(obj, &PyId_finalbody, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"finalbody\\\" missing from Try\");\n            return 1;\n        }\n        else {\n            int res;\n            Py_ssize_t len;\n            Py_ssize_t i;\n            if (!PyList_Check(tmp)) {\n                PyErr_Format(PyExc_TypeError, \"Try field \\\"finalbody\\\" must be a list, not a %.200s\", tmp->ob_type->tp_name);\n                goto failed;\n            }\n            len = PyList_GET_SIZE(tmp);\n            finalbody = _Ta3_asdl_seq_new(len, arena);\n            if (finalbody == NULL) goto failed;\n            for (i = 0; i < len; i++) {\n                stmt_ty val;\n                res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &val, arena);\n                if (res != 0) goto failed;\n                if (len != PyList_GET_SIZE(tmp)) {\n                    PyErr_SetString(PyExc_RuntimeError, \"Try field \\\"finalbody\\\" changed size during iteration\");\n                    goto failed;\n                }\n                asdl_seq_SET(finalbody, i, val);\n            }\n            Py_CLEAR(tmp);\n        }\n        *out = Try(body, handlers, orelse, finalbody, lineno, col_offset,\n                   arena);\n        if (*out == NULL) goto failed;\n        return 0;\n    }\n    isinstance = PyObject_IsInstance(obj, (PyObject*)Assert_type);\n    if (isinstance == -1) {\n        return 1;\n    }\n    if (isinstance) {\n        expr_ty test;\n        expr_ty msg;\n\n        if (lookup_attr_id(obj, &PyId_test, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"test\\\" missing from Assert\");\n            return 1;\n        }\n        else {\n            int res;\n            res = obj2ast_expr(tmp, &test, arena);\n            if (res != 0) goto failed;\n            Py_CLEAR(tmp);\n        }\n        if (lookup_attr_id(obj, &PyId_msg, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL || tmp == Py_None) {\n            Py_CLEAR(tmp);\n            msg = NULL;\n        }\n        else {\n            int res;\n            res = obj2ast_expr(tmp, &msg, arena);\n            if (res != 0) goto failed;\n            Py_CLEAR(tmp);\n        }\n        *out = Assert(test, msg, lineno, col_offset, arena);\n        if (*out == NULL) goto failed;\n        return 0;\n    }\n    isinstance = PyObject_IsInstance(obj, (PyObject*)Import_type);\n    if (isinstance == -1) {\n        return 1;\n    }\n    if (isinstance) {\n        asdl_seq* names;\n\n        if (lookup_attr_id(obj, &PyId_names, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"names\\\" missing from Import\");\n            return 1;\n        }\n        else {\n            int res;\n            Py_ssize_t len;\n            Py_ssize_t i;\n            if (!PyList_Check(tmp)) {\n                PyErr_Format(PyExc_TypeError, \"Import field \\\"names\\\" must be a list, not a %.200s\", tmp->ob_type->tp_name);\n                goto failed;\n            }\n            len = PyList_GET_SIZE(tmp);\n            names = _Ta3_asdl_seq_new(len, arena);\n            if (names == NULL) goto failed;\n            for (i = 0; i < len; i++) {\n                alias_ty val;\n                res = obj2ast_alias(PyList_GET_ITEM(tmp, i), &val, arena);\n                if (res != 0) goto failed;\n                if (len != PyList_GET_SIZE(tmp)) {\n                    PyErr_SetString(PyExc_RuntimeError, \"Import field \\\"names\\\" changed size during iteration\");\n                    goto failed;\n                }\n                asdl_seq_SET(names, i, val);\n            }\n            Py_CLEAR(tmp);\n        }\n        *out = Import(names, lineno, col_offset, arena);\n        if (*out == NULL) goto failed;\n        return 0;\n    }\n    isinstance = PyObject_IsInstance(obj, (PyObject*)ImportFrom_type);\n    if (isinstance == -1) {\n        return 1;\n    }\n    if (isinstance) {\n        identifier module;\n        asdl_seq* names;\n        int level;\n\n        if (lookup_attr_id(obj, &PyId_module, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL || tmp == Py_None) {\n            Py_CLEAR(tmp);\n            module = NULL;\n        }\n        else {\n            int res;\n            res = obj2ast_identifier(tmp, &module, arena);\n            if (res != 0) goto failed;\n            Py_CLEAR(tmp);\n        }\n        if (lookup_attr_id(obj, &PyId_names, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"names\\\" missing from ImportFrom\");\n            return 1;\n        }\n        else {\n            int res;\n            Py_ssize_t len;\n            Py_ssize_t i;\n            if (!PyList_Check(tmp)) {\n                PyErr_Format(PyExc_TypeError, \"ImportFrom field \\\"names\\\" must be a list, not a %.200s\", tmp->ob_type->tp_name);\n                goto failed;\n            }\n            len = PyList_GET_SIZE(tmp);\n            names = _Ta3_asdl_seq_new(len, arena);\n            if (names == NULL) goto failed;\n            for (i = 0; i < len; i++) {\n                alias_ty val;\n                res = obj2ast_alias(PyList_GET_ITEM(tmp, i), &val, arena);\n                if (res != 0) goto failed;\n                if (len != PyList_GET_SIZE(tmp)) {\n                    PyErr_SetString(PyExc_RuntimeError, \"ImportFrom field \\\"names\\\" changed size during iteration\");\n                    goto failed;\n                }\n                asdl_seq_SET(names, i, val);\n            }\n            Py_CLEAR(tmp);\n        }\n        if (lookup_attr_id(obj, &PyId_level, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL || tmp == Py_None) {\n            Py_CLEAR(tmp);\n            level = 0;\n        }\n        else {\n            int res;\n            res = obj2ast_int(tmp, &level, arena);\n            if (res != 0) goto failed;\n            Py_CLEAR(tmp);\n        }\n        *out = ImportFrom(module, names, level, lineno, col_offset, arena);\n        if (*out == NULL) goto failed;\n        return 0;\n    }\n    isinstance = PyObject_IsInstance(obj, (PyObject*)Global_type);\n    if (isinstance == -1) {\n        return 1;\n    }\n    if (isinstance) {\n        asdl_seq* names;\n\n        if (lookup_attr_id(obj, &PyId_names, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"names\\\" missing from Global\");\n            return 1;\n        }\n        else {\n            int res;\n            Py_ssize_t len;\n            Py_ssize_t i;\n            if (!PyList_Check(tmp)) {\n                PyErr_Format(PyExc_TypeError, \"Global field \\\"names\\\" must be a list, not a %.200s\", tmp->ob_type->tp_name);\n                goto failed;\n            }\n            len = PyList_GET_SIZE(tmp);\n            names = _Ta3_asdl_seq_new(len, arena);\n            if (names == NULL) goto failed;\n            for (i = 0; i < len; i++) {\n                identifier val;\n                res = obj2ast_identifier(PyList_GET_ITEM(tmp, i), &val, arena);\n                if (res != 0) goto failed;\n                if (len != PyList_GET_SIZE(tmp)) {\n                    PyErr_SetString(PyExc_RuntimeError, \"Global field \\\"names\\\" changed size during iteration\");\n                    goto failed;\n                }\n                asdl_seq_SET(names, i, val);\n            }\n            Py_CLEAR(tmp);\n        }\n        *out = Global(names, lineno, col_offset, arena);\n        if (*out == NULL) goto failed;\n        return 0;\n    }\n    isinstance = PyObject_IsInstance(obj, (PyObject*)Nonlocal_type);\n    if (isinstance == -1) {\n        return 1;\n    }\n    if (isinstance) {\n        asdl_seq* names;\n\n        if (lookup_attr_id(obj, &PyId_names, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"names\\\" missing from Nonlocal\");\n            return 1;\n        }\n        else {\n            int res;\n            Py_ssize_t len;\n            Py_ssize_t i;\n            if (!PyList_Check(tmp)) {\n                PyErr_Format(PyExc_TypeError, \"Nonlocal field \\\"names\\\" must be a list, not a %.200s\", tmp->ob_type->tp_name);\n                goto failed;\n            }\n            len = PyList_GET_SIZE(tmp);\n            names = _Ta3_asdl_seq_new(len, arena);\n            if (names == NULL) goto failed;\n            for (i = 0; i < len; i++) {\n                identifier val;\n                res = obj2ast_identifier(PyList_GET_ITEM(tmp, i), &val, arena);\n                if (res != 0) goto failed;\n                if (len != PyList_GET_SIZE(tmp)) {\n                    PyErr_SetString(PyExc_RuntimeError, \"Nonlocal field \\\"names\\\" changed size during iteration\");\n                    goto failed;\n                }\n                asdl_seq_SET(names, i, val);\n            }\n            Py_CLEAR(tmp);\n        }\n        *out = Nonlocal(names, lineno, col_offset, arena);\n        if (*out == NULL) goto failed;\n        return 0;\n    }\n    isinstance = PyObject_IsInstance(obj, (PyObject*)Expr_type);\n    if (isinstance == -1) {\n        return 1;\n    }\n    if (isinstance) {\n        expr_ty value;\n\n        if (lookup_attr_id(obj, &PyId_value, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"value\\\" missing from Expr\");\n            return 1;\n        }\n        else {\n            int res;\n            res = obj2ast_expr(tmp, &value, arena);\n            if (res != 0) goto failed;\n            Py_CLEAR(tmp);\n        }\n        *out = Expr(value, lineno, col_offset, arena);\n        if (*out == NULL) goto failed;\n        return 0;\n    }\n    isinstance = PyObject_IsInstance(obj, (PyObject*)Pass_type);\n    if (isinstance == -1) {\n        return 1;\n    }\n    if (isinstance) {\n\n        *out = Pass(lineno, col_offset, arena);\n        if (*out == NULL) goto failed;\n        return 0;\n    }\n    isinstance = PyObject_IsInstance(obj, (PyObject*)Break_type);\n    if (isinstance == -1) {\n        return 1;\n    }\n    if (isinstance) {\n\n        *out = Break(lineno, col_offset, arena);\n        if (*out == NULL) goto failed;\n        return 0;\n    }\n    isinstance = PyObject_IsInstance(obj, (PyObject*)Continue_type);\n    if (isinstance == -1) {\n        return 1;\n    }\n    if (isinstance) {\n\n        *out = Continue(lineno, col_offset, arena);\n        if (*out == NULL) goto failed;\n        return 0;\n    }\n\n    PyErr_Format(PyExc_TypeError, \"expected some sort of stmt, but got %R\", obj);\n    failed:\n    Py_XDECREF(tmp);\n    return 1;\n}\n\nint\nobj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)\n{\n    int isinstance;\n\n    PyObject *tmp = NULL;\n    int lineno;\n    int col_offset;\n\n    if (obj == Py_None) {\n        *out = NULL;\n        return 0;\n    }\n    if (lookup_attr_id(obj, &PyId_lineno, &tmp) < 0) {\n        return 1;\n    }\n    if (tmp == NULL) {\n        PyErr_SetString(PyExc_TypeError, \"required field \\\"lineno\\\" missing from expr\");\n        return 1;\n    }\n    else {\n        int res;\n        res = obj2ast_int(tmp, &lineno, arena);\n        if (res != 0) goto failed;\n        Py_CLEAR(tmp);\n    }\n    if (lookup_attr_id(obj, &PyId_col_offset, &tmp) < 0) {\n        return 1;\n    }\n    if (tmp == NULL) {\n        PyErr_SetString(PyExc_TypeError, \"required field \\\"col_offset\\\" missing from expr\");\n        return 1;\n    }\n    else {\n        int res;\n        res = obj2ast_int(tmp, &col_offset, arena);\n        if (res != 0) goto failed;\n        Py_CLEAR(tmp);\n    }\n    isinstance = PyObject_IsInstance(obj, (PyObject*)BoolOp_type);\n    if (isinstance == -1) {\n        return 1;\n    }\n    if (isinstance) {\n        boolop_ty op;\n        asdl_seq* values;\n\n        if (lookup_attr_id(obj, &PyId_op, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"op\\\" missing from BoolOp\");\n            return 1;\n        }\n        else {\n            int res;\n            res = obj2ast_boolop(tmp, &op, arena);\n            if (res != 0) goto failed;\n            Py_CLEAR(tmp);\n        }\n        if (lookup_attr_id(obj, &PyId_values, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"values\\\" missing from BoolOp\");\n            return 1;\n        }\n        else {\n            int res;\n            Py_ssize_t len;\n            Py_ssize_t i;\n            if (!PyList_Check(tmp)) {\n                PyErr_Format(PyExc_TypeError, \"BoolOp field \\\"values\\\" must be a list, not a %.200s\", tmp->ob_type->tp_name);\n                goto failed;\n            }\n            len = PyList_GET_SIZE(tmp);\n            values = _Ta3_asdl_seq_new(len, arena);\n            if (values == NULL) goto failed;\n            for (i = 0; i < len; i++) {\n                expr_ty val;\n                res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &val, arena);\n                if (res != 0) goto failed;\n                if (len != PyList_GET_SIZE(tmp)) {\n                    PyErr_SetString(PyExc_RuntimeError, \"BoolOp field \\\"values\\\" changed size during iteration\");\n                    goto failed;\n                }\n                asdl_seq_SET(values, i, val);\n            }\n            Py_CLEAR(tmp);\n        }\n        *out = BoolOp(op, values, lineno, col_offset, arena);\n        if (*out == NULL) goto failed;\n        return 0;\n    }\n    isinstance = PyObject_IsInstance(obj, (PyObject*)BinOp_type);\n    if (isinstance == -1) {\n        return 1;\n    }\n    if (isinstance) {\n        expr_ty left;\n        operator_ty op;\n        expr_ty right;\n\n        if (lookup_attr_id(obj, &PyId_left, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"left\\\" missing from BinOp\");\n            return 1;\n        }\n        else {\n            int res;\n            res = obj2ast_expr(tmp, &left, arena);\n            if (res != 0) goto failed;\n            Py_CLEAR(tmp);\n        }\n        if (lookup_attr_id(obj, &PyId_op, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"op\\\" missing from BinOp\");\n            return 1;\n        }\n        else {\n            int res;\n            res = obj2ast_operator(tmp, &op, arena);\n            if (res != 0) goto failed;\n            Py_CLEAR(tmp);\n        }\n        if (lookup_attr_id(obj, &PyId_right, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"right\\\" missing from BinOp\");\n            return 1;\n        }\n        else {\n            int res;\n            res = obj2ast_expr(tmp, &right, arena);\n            if (res != 0) goto failed;\n            Py_CLEAR(tmp);\n        }\n        *out = BinOp(left, op, right, lineno, col_offset, arena);\n        if (*out == NULL) goto failed;\n        return 0;\n    }\n    isinstance = PyObject_IsInstance(obj, (PyObject*)UnaryOp_type);\n    if (isinstance == -1) {\n        return 1;\n    }\n    if (isinstance) {\n        unaryop_ty op;\n        expr_ty operand;\n\n        if (lookup_attr_id(obj, &PyId_op, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"op\\\" missing from UnaryOp\");\n            return 1;\n        }\n        else {\n            int res;\n            res = obj2ast_unaryop(tmp, &op, arena);\n            if (res != 0) goto failed;\n            Py_CLEAR(tmp);\n        }\n        if (lookup_attr_id(obj, &PyId_operand, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"operand\\\" missing from UnaryOp\");\n            return 1;\n        }\n        else {\n            int res;\n            res = obj2ast_expr(tmp, &operand, arena);\n            if (res != 0) goto failed;\n            Py_CLEAR(tmp);\n        }\n        *out = UnaryOp(op, operand, lineno, col_offset, arena);\n        if (*out == NULL) goto failed;\n        return 0;\n    }\n    isinstance = PyObject_IsInstance(obj, (PyObject*)Lambda_type);\n    if (isinstance == -1) {\n        return 1;\n    }\n    if (isinstance) {\n        arguments_ty args;\n        expr_ty body;\n\n        if (lookup_attr_id(obj, &PyId_args, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"args\\\" missing from Lambda\");\n            return 1;\n        }\n        else {\n            int res;\n            res = obj2ast_arguments(tmp, &args, arena);\n            if (res != 0) goto failed;\n            Py_CLEAR(tmp);\n        }\n        if (lookup_attr_id(obj, &PyId_body, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"body\\\" missing from Lambda\");\n            return 1;\n        }\n        else {\n            int res;\n            res = obj2ast_expr(tmp, &body, arena);\n            if (res != 0) goto failed;\n            Py_CLEAR(tmp);\n        }\n        *out = Lambda(args, body, lineno, col_offset, arena);\n        if (*out == NULL) goto failed;\n        return 0;\n    }\n    isinstance = PyObject_IsInstance(obj, (PyObject*)IfExp_type);\n    if (isinstance == -1) {\n        return 1;\n    }\n    if (isinstance) {\n        expr_ty test;\n        expr_ty body;\n        expr_ty orelse;\n\n        if (lookup_attr_id(obj, &PyId_test, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"test\\\" missing from IfExp\");\n            return 1;\n        }\n        else {\n            int res;\n            res = obj2ast_expr(tmp, &test, arena);\n            if (res != 0) goto failed;\n            Py_CLEAR(tmp);\n        }\n        if (lookup_attr_id(obj, &PyId_body, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"body\\\" missing from IfExp\");\n            return 1;\n        }\n        else {\n            int res;\n            res = obj2ast_expr(tmp, &body, arena);\n            if (res != 0) goto failed;\n            Py_CLEAR(tmp);\n        }\n        if (lookup_attr_id(obj, &PyId_orelse, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"orelse\\\" missing from IfExp\");\n            return 1;\n        }\n        else {\n            int res;\n            res = obj2ast_expr(tmp, &orelse, arena);\n            if (res != 0) goto failed;\n            Py_CLEAR(tmp);\n        }\n        *out = IfExp(test, body, orelse, lineno, col_offset, arena);\n        if (*out == NULL) goto failed;\n        return 0;\n    }\n    isinstance = PyObject_IsInstance(obj, (PyObject*)Dict_type);\n    if (isinstance == -1) {\n        return 1;\n    }\n    if (isinstance) {\n        asdl_seq* keys;\n        asdl_seq* values;\n\n        if (lookup_attr_id(obj, &PyId_keys, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"keys\\\" missing from Dict\");\n            return 1;\n        }\n        else {\n            int res;\n            Py_ssize_t len;\n            Py_ssize_t i;\n            if (!PyList_Check(tmp)) {\n                PyErr_Format(PyExc_TypeError, \"Dict field \\\"keys\\\" must be a list, not a %.200s\", tmp->ob_type->tp_name);\n                goto failed;\n            }\n            len = PyList_GET_SIZE(tmp);\n            keys = _Ta3_asdl_seq_new(len, arena);\n            if (keys == NULL) goto failed;\n            for (i = 0; i < len; i++) {\n                expr_ty val;\n                res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &val, arena);\n                if (res != 0) goto failed;\n                if (len != PyList_GET_SIZE(tmp)) {\n                    PyErr_SetString(PyExc_RuntimeError, \"Dict field \\\"keys\\\" changed size during iteration\");\n                    goto failed;\n                }\n                asdl_seq_SET(keys, i, val);\n            }\n            Py_CLEAR(tmp);\n        }\n        if (lookup_attr_id(obj, &PyId_values, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"values\\\" missing from Dict\");\n            return 1;\n        }\n        else {\n            int res;\n            Py_ssize_t len;\n            Py_ssize_t i;\n            if (!PyList_Check(tmp)) {\n                PyErr_Format(PyExc_TypeError, \"Dict field \\\"values\\\" must be a list, not a %.200s\", tmp->ob_type->tp_name);\n                goto failed;\n            }\n            len = PyList_GET_SIZE(tmp);\n            values = _Ta3_asdl_seq_new(len, arena);\n            if (values == NULL) goto failed;\n            for (i = 0; i < len; i++) {\n                expr_ty val;\n                res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &val, arena);\n                if (res != 0) goto failed;\n                if (len != PyList_GET_SIZE(tmp)) {\n                    PyErr_SetString(PyExc_RuntimeError, \"Dict field \\\"values\\\" changed size during iteration\");\n                    goto failed;\n                }\n                asdl_seq_SET(values, i, val);\n            }\n            Py_CLEAR(tmp);\n        }\n        *out = Dict(keys, values, lineno, col_offset, arena);\n        if (*out == NULL) goto failed;\n        return 0;\n    }\n    isinstance = PyObject_IsInstance(obj, (PyObject*)Set_type);\n    if (isinstance == -1) {\n        return 1;\n    }\n    if (isinstance) {\n        asdl_seq* elts;\n\n        if (lookup_attr_id(obj, &PyId_elts, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"elts\\\" missing from Set\");\n            return 1;\n        }\n        else {\n            int res;\n            Py_ssize_t len;\n            Py_ssize_t i;\n            if (!PyList_Check(tmp)) {\n                PyErr_Format(PyExc_TypeError, \"Set field \\\"elts\\\" must be a list, not a %.200s\", tmp->ob_type->tp_name);\n                goto failed;\n            }\n            len = PyList_GET_SIZE(tmp);\n            elts = _Ta3_asdl_seq_new(len, arena);\n            if (elts == NULL) goto failed;\n            for (i = 0; i < len; i++) {\n                expr_ty val;\n                res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &val, arena);\n                if (res != 0) goto failed;\n                if (len != PyList_GET_SIZE(tmp)) {\n                    PyErr_SetString(PyExc_RuntimeError, \"Set field \\\"elts\\\" changed size during iteration\");\n                    goto failed;\n                }\n                asdl_seq_SET(elts, i, val);\n            }\n            Py_CLEAR(tmp);\n        }\n        *out = Set(elts, lineno, col_offset, arena);\n        if (*out == NULL) goto failed;\n        return 0;\n    }\n    isinstance = PyObject_IsInstance(obj, (PyObject*)ListComp_type);\n    if (isinstance == -1) {\n        return 1;\n    }\n    if (isinstance) {\n        expr_ty elt;\n        asdl_seq* generators;\n\n        if (lookup_attr_id(obj, &PyId_elt, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"elt\\\" missing from ListComp\");\n            return 1;\n        }\n        else {\n            int res;\n            res = obj2ast_expr(tmp, &elt, arena);\n            if (res != 0) goto failed;\n            Py_CLEAR(tmp);\n        }\n        if (lookup_attr_id(obj, &PyId_generators, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"generators\\\" missing from ListComp\");\n            return 1;\n        }\n        else {\n            int res;\n            Py_ssize_t len;\n            Py_ssize_t i;\n            if (!PyList_Check(tmp)) {\n                PyErr_Format(PyExc_TypeError, \"ListComp field \\\"generators\\\" must be a list, not a %.200s\", tmp->ob_type->tp_name);\n                goto failed;\n            }\n            len = PyList_GET_SIZE(tmp);\n            generators = _Ta3_asdl_seq_new(len, arena);\n            if (generators == NULL) goto failed;\n            for (i = 0; i < len; i++) {\n                comprehension_ty val;\n                res = obj2ast_comprehension(PyList_GET_ITEM(tmp, i), &val, arena);\n                if (res != 0) goto failed;\n                if (len != PyList_GET_SIZE(tmp)) {\n                    PyErr_SetString(PyExc_RuntimeError, \"ListComp field \\\"generators\\\" changed size during iteration\");\n                    goto failed;\n                }\n                asdl_seq_SET(generators, i, val);\n            }\n            Py_CLEAR(tmp);\n        }\n        *out = ListComp(elt, generators, lineno, col_offset, arena);\n        if (*out == NULL) goto failed;\n        return 0;\n    }\n    isinstance = PyObject_IsInstance(obj, (PyObject*)SetComp_type);\n    if (isinstance == -1) {\n        return 1;\n    }\n    if (isinstance) {\n        expr_ty elt;\n        asdl_seq* generators;\n\n        if (lookup_attr_id(obj, &PyId_elt, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"elt\\\" missing from SetComp\");\n            return 1;\n        }\n        else {\n            int res;\n            res = obj2ast_expr(tmp, &elt, arena);\n            if (res != 0) goto failed;\n            Py_CLEAR(tmp);\n        }\n        if (lookup_attr_id(obj, &PyId_generators, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"generators\\\" missing from SetComp\");\n            return 1;\n        }\n        else {\n            int res;\n            Py_ssize_t len;\n            Py_ssize_t i;\n            if (!PyList_Check(tmp)) {\n                PyErr_Format(PyExc_TypeError, \"SetComp field \\\"generators\\\" must be a list, not a %.200s\", tmp->ob_type->tp_name);\n                goto failed;\n            }\n            len = PyList_GET_SIZE(tmp);\n            generators = _Ta3_asdl_seq_new(len, arena);\n            if (generators == NULL) goto failed;\n            for (i = 0; i < len; i++) {\n                comprehension_ty val;\n                res = obj2ast_comprehension(PyList_GET_ITEM(tmp, i), &val, arena);\n                if (res != 0) goto failed;\n                if (len != PyList_GET_SIZE(tmp)) {\n                    PyErr_SetString(PyExc_RuntimeError, \"SetComp field \\\"generators\\\" changed size during iteration\");\n                    goto failed;\n                }\n                asdl_seq_SET(generators, i, val);\n            }\n            Py_CLEAR(tmp);\n        }\n        *out = SetComp(elt, generators, lineno, col_offset, arena);\n        if (*out == NULL) goto failed;\n        return 0;\n    }\n    isinstance = PyObject_IsInstance(obj, (PyObject*)DictComp_type);\n    if (isinstance == -1) {\n        return 1;\n    }\n    if (isinstance) {\n        expr_ty key;\n        expr_ty value;\n        asdl_seq* generators;\n\n        if (lookup_attr_id(obj, &PyId_key, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"key\\\" missing from DictComp\");\n            return 1;\n        }\n        else {\n            int res;\n            res = obj2ast_expr(tmp, &key, arena);\n            if (res != 0) goto failed;\n            Py_CLEAR(tmp);\n        }\n        if (lookup_attr_id(obj, &PyId_value, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"value\\\" missing from DictComp\");\n            return 1;\n        }\n        else {\n            int res;\n            res = obj2ast_expr(tmp, &value, arena);\n            if (res != 0) goto failed;\n            Py_CLEAR(tmp);\n        }\n        if (lookup_attr_id(obj, &PyId_generators, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"generators\\\" missing from DictComp\");\n            return 1;\n        }\n        else {\n            int res;\n            Py_ssize_t len;\n            Py_ssize_t i;\n            if (!PyList_Check(tmp)) {\n                PyErr_Format(PyExc_TypeError, \"DictComp field \\\"generators\\\" must be a list, not a %.200s\", tmp->ob_type->tp_name);\n                goto failed;\n            }\n            len = PyList_GET_SIZE(tmp);\n            generators = _Ta3_asdl_seq_new(len, arena);\n            if (generators == NULL) goto failed;\n            for (i = 0; i < len; i++) {\n                comprehension_ty val;\n                res = obj2ast_comprehension(PyList_GET_ITEM(tmp, i), &val, arena);\n                if (res != 0) goto failed;\n                if (len != PyList_GET_SIZE(tmp)) {\n                    PyErr_SetString(PyExc_RuntimeError, \"DictComp field \\\"generators\\\" changed size during iteration\");\n                    goto failed;\n                }\n                asdl_seq_SET(generators, i, val);\n            }\n            Py_CLEAR(tmp);\n        }\n        *out = DictComp(key, value, generators, lineno, col_offset, arena);\n        if (*out == NULL) goto failed;\n        return 0;\n    }\n    isinstance = PyObject_IsInstance(obj, (PyObject*)GeneratorExp_type);\n    if (isinstance == -1) {\n        return 1;\n    }\n    if (isinstance) {\n        expr_ty elt;\n        asdl_seq* generators;\n\n        if (lookup_attr_id(obj, &PyId_elt, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"elt\\\" missing from GeneratorExp\");\n            return 1;\n        }\n        else {\n            int res;\n            res = obj2ast_expr(tmp, &elt, arena);\n            if (res != 0) goto failed;\n            Py_CLEAR(tmp);\n        }\n        if (lookup_attr_id(obj, &PyId_generators, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"generators\\\" missing from GeneratorExp\");\n            return 1;\n        }\n        else {\n            int res;\n            Py_ssize_t len;\n            Py_ssize_t i;\n            if (!PyList_Check(tmp)) {\n                PyErr_Format(PyExc_TypeError, \"GeneratorExp field \\\"generators\\\" must be a list, not a %.200s\", tmp->ob_type->tp_name);\n                goto failed;\n            }\n            len = PyList_GET_SIZE(tmp);\n            generators = _Ta3_asdl_seq_new(len, arena);\n            if (generators == NULL) goto failed;\n            for (i = 0; i < len; i++) {\n                comprehension_ty val;\n                res = obj2ast_comprehension(PyList_GET_ITEM(tmp, i), &val, arena);\n                if (res != 0) goto failed;\n                if (len != PyList_GET_SIZE(tmp)) {\n                    PyErr_SetString(PyExc_RuntimeError, \"GeneratorExp field \\\"generators\\\" changed size during iteration\");\n                    goto failed;\n                }\n                asdl_seq_SET(generators, i, val);\n            }\n            Py_CLEAR(tmp);\n        }\n        *out = GeneratorExp(elt, generators, lineno, col_offset, arena);\n        if (*out == NULL) goto failed;\n        return 0;\n    }\n    isinstance = PyObject_IsInstance(obj, (PyObject*)Await_type);\n    if (isinstance == -1) {\n        return 1;\n    }\n    if (isinstance) {\n        expr_ty value;\n\n        if (lookup_attr_id(obj, &PyId_value, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"value\\\" missing from Await\");\n            return 1;\n        }\n        else {\n            int res;\n            res = obj2ast_expr(tmp, &value, arena);\n            if (res != 0) goto failed;\n            Py_CLEAR(tmp);\n        }\n        *out = Await(value, lineno, col_offset, arena);\n        if (*out == NULL) goto failed;\n        return 0;\n    }\n    isinstance = PyObject_IsInstance(obj, (PyObject*)Yield_type);\n    if (isinstance == -1) {\n        return 1;\n    }\n    if (isinstance) {\n        expr_ty value;\n\n        if (lookup_attr_id(obj, &PyId_value, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL || tmp == Py_None) {\n            Py_CLEAR(tmp);\n            value = NULL;\n        }\n        else {\n            int res;\n            res = obj2ast_expr(tmp, &value, arena);\n            if (res != 0) goto failed;\n            Py_CLEAR(tmp);\n        }\n        *out = Yield(value, lineno, col_offset, arena);\n        if (*out == NULL) goto failed;\n        return 0;\n    }\n    isinstance = PyObject_IsInstance(obj, (PyObject*)YieldFrom_type);\n    if (isinstance == -1) {\n        return 1;\n    }\n    if (isinstance) {\n        expr_ty value;\n\n        if (lookup_attr_id(obj, &PyId_value, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"value\\\" missing from YieldFrom\");\n            return 1;\n        }\n        else {\n            int res;\n            res = obj2ast_expr(tmp, &value, arena);\n            if (res != 0) goto failed;\n            Py_CLEAR(tmp);\n        }\n        *out = YieldFrom(value, lineno, col_offset, arena);\n        if (*out == NULL) goto failed;\n        return 0;\n    }\n    isinstance = PyObject_IsInstance(obj, (PyObject*)Compare_type);\n    if (isinstance == -1) {\n        return 1;\n    }\n    if (isinstance) {\n        expr_ty left;\n        asdl_int_seq* ops;\n        asdl_seq* comparators;\n\n        if (lookup_attr_id(obj, &PyId_left, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"left\\\" missing from Compare\");\n            return 1;\n        }\n        else {\n            int res;\n            res = obj2ast_expr(tmp, &left, arena);\n            if (res != 0) goto failed;\n            Py_CLEAR(tmp);\n        }\n        if (lookup_attr_id(obj, &PyId_ops, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"ops\\\" missing from Compare\");\n            return 1;\n        }\n        else {\n            int res;\n            Py_ssize_t len;\n            Py_ssize_t i;\n            if (!PyList_Check(tmp)) {\n                PyErr_Format(PyExc_TypeError, \"Compare field \\\"ops\\\" must be a list, not a %.200s\", tmp->ob_type->tp_name);\n                goto failed;\n            }\n            len = PyList_GET_SIZE(tmp);\n            ops = _Ta3_asdl_int_seq_new(len, arena);\n            if (ops == NULL) goto failed;\n            for (i = 0; i < len; i++) {\n                cmpop_ty val;\n                res = obj2ast_cmpop(PyList_GET_ITEM(tmp, i), &val, arena);\n                if (res != 0) goto failed;\n                if (len != PyList_GET_SIZE(tmp)) {\n                    PyErr_SetString(PyExc_RuntimeError, \"Compare field \\\"ops\\\" changed size during iteration\");\n                    goto failed;\n                }\n                asdl_seq_SET(ops, i, val);\n            }\n            Py_CLEAR(tmp);\n        }\n        if (lookup_attr_id(obj, &PyId_comparators, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"comparators\\\" missing from Compare\");\n            return 1;\n        }\n        else {\n            int res;\n            Py_ssize_t len;\n            Py_ssize_t i;\n            if (!PyList_Check(tmp)) {\n                PyErr_Format(PyExc_TypeError, \"Compare field \\\"comparators\\\" must be a list, not a %.200s\", tmp->ob_type->tp_name);\n                goto failed;\n            }\n            len = PyList_GET_SIZE(tmp);\n            comparators = _Ta3_asdl_seq_new(len, arena);\n            if (comparators == NULL) goto failed;\n            for (i = 0; i < len; i++) {\n                expr_ty val;\n                res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &val, arena);\n                if (res != 0) goto failed;\n                if (len != PyList_GET_SIZE(tmp)) {\n                    PyErr_SetString(PyExc_RuntimeError, \"Compare field \\\"comparators\\\" changed size during iteration\");\n                    goto failed;\n                }\n                asdl_seq_SET(comparators, i, val);\n            }\n            Py_CLEAR(tmp);\n        }\n        *out = Compare(left, ops, comparators, lineno, col_offset, arena);\n        if (*out == NULL) goto failed;\n        return 0;\n    }\n    isinstance = PyObject_IsInstance(obj, (PyObject*)Call_type);\n    if (isinstance == -1) {\n        return 1;\n    }\n    if (isinstance) {\n        expr_ty func;\n        asdl_seq* args;\n        asdl_seq* keywords;\n\n        if (lookup_attr_id(obj, &PyId_func, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"func\\\" missing from Call\");\n            return 1;\n        }\n        else {\n            int res;\n            res = obj2ast_expr(tmp, &func, arena);\n            if (res != 0) goto failed;\n            Py_CLEAR(tmp);\n        }\n        if (lookup_attr_id(obj, &PyId_args, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"args\\\" missing from Call\");\n            return 1;\n        }\n        else {\n            int res;\n            Py_ssize_t len;\n            Py_ssize_t i;\n            if (!PyList_Check(tmp)) {\n                PyErr_Format(PyExc_TypeError, \"Call field \\\"args\\\" must be a list, not a %.200s\", tmp->ob_type->tp_name);\n                goto failed;\n            }\n            len = PyList_GET_SIZE(tmp);\n            args = _Ta3_asdl_seq_new(len, arena);\n            if (args == NULL) goto failed;\n            for (i = 0; i < len; i++) {\n                expr_ty val;\n                res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &val, arena);\n                if (res != 0) goto failed;\n                if (len != PyList_GET_SIZE(tmp)) {\n                    PyErr_SetString(PyExc_RuntimeError, \"Call field \\\"args\\\" changed size during iteration\");\n                    goto failed;\n                }\n                asdl_seq_SET(args, i, val);\n            }\n            Py_CLEAR(tmp);\n        }\n        if (lookup_attr_id(obj, &PyId_keywords, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"keywords\\\" missing from Call\");\n            return 1;\n        }\n        else {\n            int res;\n            Py_ssize_t len;\n            Py_ssize_t i;\n            if (!PyList_Check(tmp)) {\n                PyErr_Format(PyExc_TypeError, \"Call field \\\"keywords\\\" must be a list, not a %.200s\", tmp->ob_type->tp_name);\n                goto failed;\n            }\n            len = PyList_GET_SIZE(tmp);\n            keywords = _Ta3_asdl_seq_new(len, arena);\n            if (keywords == NULL) goto failed;\n            for (i = 0; i < len; i++) {\n                keyword_ty val;\n                res = obj2ast_keyword(PyList_GET_ITEM(tmp, i), &val, arena);\n                if (res != 0) goto failed;\n                if (len != PyList_GET_SIZE(tmp)) {\n                    PyErr_SetString(PyExc_RuntimeError, \"Call field \\\"keywords\\\" changed size during iteration\");\n                    goto failed;\n                }\n                asdl_seq_SET(keywords, i, val);\n            }\n            Py_CLEAR(tmp);\n        }\n        *out = Call(func, args, keywords, lineno, col_offset, arena);\n        if (*out == NULL) goto failed;\n        return 0;\n    }\n    isinstance = PyObject_IsInstance(obj, (PyObject*)Num_type);\n    if (isinstance == -1) {\n        return 1;\n    }\n    if (isinstance) {\n        object n;\n\n        if (lookup_attr_id(obj, &PyId_n, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"n\\\" missing from Num\");\n            return 1;\n        }\n        else {\n            int res;\n            res = obj2ast_object(tmp, &n, arena);\n            if (res != 0) goto failed;\n            Py_CLEAR(tmp);\n        }\n        *out = Num(n, lineno, col_offset, arena);\n        if (*out == NULL) goto failed;\n        return 0;\n    }\n    isinstance = PyObject_IsInstance(obj, (PyObject*)Str_type);\n    if (isinstance == -1) {\n        return 1;\n    }\n    if (isinstance) {\n        string s;\n        string kind;\n\n        if (lookup_attr_id(obj, &PyId_s, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"s\\\" missing from Str\");\n            return 1;\n        }\n        else {\n            int res;\n            res = obj2ast_string(tmp, &s, arena);\n            if (res != 0) goto failed;\n            Py_CLEAR(tmp);\n        }\n        if (lookup_attr_id(obj, &PyId_kind, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"kind\\\" missing from Str\");\n            return 1;\n        }\n        else {\n            int res;\n            res = obj2ast_string(tmp, &kind, arena);\n            if (res != 0) goto failed;\n            Py_CLEAR(tmp);\n        }\n        *out = Str(s, kind, lineno, col_offset, arena);\n        if (*out == NULL) goto failed;\n        return 0;\n    }\n    isinstance = PyObject_IsInstance(obj, (PyObject*)FormattedValue_type);\n    if (isinstance == -1) {\n        return 1;\n    }\n    if (isinstance) {\n        expr_ty value;\n        int conversion;\n        expr_ty format_spec;\n\n        if (lookup_attr_id(obj, &PyId_value, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"value\\\" missing from FormattedValue\");\n            return 1;\n        }\n        else {\n            int res;\n            res = obj2ast_expr(tmp, &value, arena);\n            if (res != 0) goto failed;\n            Py_CLEAR(tmp);\n        }\n        if (lookup_attr_id(obj, &PyId_conversion, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL || tmp == Py_None) {\n            Py_CLEAR(tmp);\n            conversion = 0;\n        }\n        else {\n            int res;\n            res = obj2ast_int(tmp, &conversion, arena);\n            if (res != 0) goto failed;\n            Py_CLEAR(tmp);\n        }\n        if (lookup_attr_id(obj, &PyId_format_spec, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL || tmp == Py_None) {\n            Py_CLEAR(tmp);\n            format_spec = NULL;\n        }\n        else {\n            int res;\n            res = obj2ast_expr(tmp, &format_spec, arena);\n            if (res != 0) goto failed;\n            Py_CLEAR(tmp);\n        }\n        *out = FormattedValue(value, conversion, format_spec, lineno,\n                              col_offset, arena);\n        if (*out == NULL) goto failed;\n        return 0;\n    }\n    isinstance = PyObject_IsInstance(obj, (PyObject*)JoinedStr_type);\n    if (isinstance == -1) {\n        return 1;\n    }\n    if (isinstance) {\n        asdl_seq* values;\n\n        if (lookup_attr_id(obj, &PyId_values, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"values\\\" missing from JoinedStr\");\n            return 1;\n        }\n        else {\n            int res;\n            Py_ssize_t len;\n            Py_ssize_t i;\n            if (!PyList_Check(tmp)) {\n                PyErr_Format(PyExc_TypeError, \"JoinedStr field \\\"values\\\" must be a list, not a %.200s\", tmp->ob_type->tp_name);\n                goto failed;\n            }\n            len = PyList_GET_SIZE(tmp);\n            values = _Ta3_asdl_seq_new(len, arena);\n            if (values == NULL) goto failed;\n            for (i = 0; i < len; i++) {\n                expr_ty val;\n                res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &val, arena);\n                if (res != 0) goto failed;\n                if (len != PyList_GET_SIZE(tmp)) {\n                    PyErr_SetString(PyExc_RuntimeError, \"JoinedStr field \\\"values\\\" changed size during iteration\");\n                    goto failed;\n                }\n                asdl_seq_SET(values, i, val);\n            }\n            Py_CLEAR(tmp);\n        }\n        *out = JoinedStr(values, lineno, col_offset, arena);\n        if (*out == NULL) goto failed;\n        return 0;\n    }\n    isinstance = PyObject_IsInstance(obj, (PyObject*)Bytes_type);\n    if (isinstance == -1) {\n        return 1;\n    }\n    if (isinstance) {\n        bytes s;\n        string kind;\n\n        if (lookup_attr_id(obj, &PyId_s, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"s\\\" missing from Bytes\");\n            return 1;\n        }\n        else {\n            int res;\n            res = obj2ast_bytes(tmp, &s, arena);\n            if (res != 0) goto failed;\n            Py_CLEAR(tmp);\n        }\n        if (lookup_attr_id(obj, &PyId_kind, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"kind\\\" missing from Bytes\");\n            return 1;\n        }\n        else {\n            int res;\n            res = obj2ast_string(tmp, &kind, arena);\n            if (res != 0) goto failed;\n            Py_CLEAR(tmp);\n        }\n        *out = Bytes(s, kind, lineno, col_offset, arena);\n        if (*out == NULL) goto failed;\n        return 0;\n    }\n    isinstance = PyObject_IsInstance(obj, (PyObject*)NameConstant_type);\n    if (isinstance == -1) {\n        return 1;\n    }\n    if (isinstance) {\n        singleton value;\n\n        if (lookup_attr_id(obj, &PyId_value, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"value\\\" missing from NameConstant\");\n            return 1;\n        }\n        else {\n            int res;\n            res = obj2ast_singleton(tmp, &value, arena);\n            if (res != 0) goto failed;\n            Py_CLEAR(tmp);\n        }\n        *out = NameConstant(value, lineno, col_offset, arena);\n        if (*out == NULL) goto failed;\n        return 0;\n    }\n    isinstance = PyObject_IsInstance(obj, (PyObject*)Ellipsis_type);\n    if (isinstance == -1) {\n        return 1;\n    }\n    if (isinstance) {\n\n        *out = Ellipsis(lineno, col_offset, arena);\n        if (*out == NULL) goto failed;\n        return 0;\n    }\n    isinstance = PyObject_IsInstance(obj, (PyObject*)Constant_type);\n    if (isinstance == -1) {\n        return 1;\n    }\n    if (isinstance) {\n        constant value;\n\n        if (lookup_attr_id(obj, &PyId_value, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"value\\\" missing from Constant\");\n            return 1;\n        }\n        else {\n            int res;\n            res = obj2ast_constant(tmp, &value, arena);\n            if (res != 0) goto failed;\n            Py_CLEAR(tmp);\n        }\n        *out = Constant(value, lineno, col_offset, arena);\n        if (*out == NULL) goto failed;\n        return 0;\n    }\n    isinstance = PyObject_IsInstance(obj, (PyObject*)Attribute_type);\n    if (isinstance == -1) {\n        return 1;\n    }\n    if (isinstance) {\n        expr_ty value;\n        identifier attr;\n        expr_context_ty ctx;\n\n        if (lookup_attr_id(obj, &PyId_value, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"value\\\" missing from Attribute\");\n            return 1;\n        }\n        else {\n            int res;\n            res = obj2ast_expr(tmp, &value, arena);\n            if (res != 0) goto failed;\n            Py_CLEAR(tmp);\n        }\n        if (lookup_attr_id(obj, &PyId_attr, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"attr\\\" missing from Attribute\");\n            return 1;\n        }\n        else {\n            int res;\n            res = obj2ast_identifier(tmp, &attr, arena);\n            if (res != 0) goto failed;\n            Py_CLEAR(tmp);\n        }\n        if (lookup_attr_id(obj, &PyId_ctx, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"ctx\\\" missing from Attribute\");\n            return 1;\n        }\n        else {\n            int res;\n            res = obj2ast_expr_context(tmp, &ctx, arena);\n            if (res != 0) goto failed;\n            Py_CLEAR(tmp);\n        }\n        *out = Attribute(value, attr, ctx, lineno, col_offset, arena);\n        if (*out == NULL) goto failed;\n        return 0;\n    }\n    isinstance = PyObject_IsInstance(obj, (PyObject*)Subscript_type);\n    if (isinstance == -1) {\n        return 1;\n    }\n    if (isinstance) {\n        expr_ty value;\n        slice_ty slice;\n        expr_context_ty ctx;\n\n        if (lookup_attr_id(obj, &PyId_value, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"value\\\" missing from Subscript\");\n            return 1;\n        }\n        else {\n            int res;\n            res = obj2ast_expr(tmp, &value, arena);\n            if (res != 0) goto failed;\n            Py_CLEAR(tmp);\n        }\n        if (lookup_attr_id(obj, &PyId_slice, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"slice\\\" missing from Subscript\");\n            return 1;\n        }\n        else {\n            int res;\n            res = obj2ast_slice(tmp, &slice, arena);\n            if (res != 0) goto failed;\n            Py_CLEAR(tmp);\n        }\n        if (lookup_attr_id(obj, &PyId_ctx, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"ctx\\\" missing from Subscript\");\n            return 1;\n        }\n        else {\n            int res;\n            res = obj2ast_expr_context(tmp, &ctx, arena);\n            if (res != 0) goto failed;\n            Py_CLEAR(tmp);\n        }\n        *out = Subscript(value, slice, ctx, lineno, col_offset, arena);\n        if (*out == NULL) goto failed;\n        return 0;\n    }\n    isinstance = PyObject_IsInstance(obj, (PyObject*)Starred_type);\n    if (isinstance == -1) {\n        return 1;\n    }\n    if (isinstance) {\n        expr_ty value;\n        expr_context_ty ctx;\n\n        if (lookup_attr_id(obj, &PyId_value, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"value\\\" missing from Starred\");\n            return 1;\n        }\n        else {\n            int res;\n            res = obj2ast_expr(tmp, &value, arena);\n            if (res != 0) goto failed;\n            Py_CLEAR(tmp);\n        }\n        if (lookup_attr_id(obj, &PyId_ctx, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"ctx\\\" missing from Starred\");\n            return 1;\n        }\n        else {\n            int res;\n            res = obj2ast_expr_context(tmp, &ctx, arena);\n            if (res != 0) goto failed;\n            Py_CLEAR(tmp);\n        }\n        *out = Starred(value, ctx, lineno, col_offset, arena);\n        if (*out == NULL) goto failed;\n        return 0;\n    }\n    isinstance = PyObject_IsInstance(obj, (PyObject*)Name_type);\n    if (isinstance == -1) {\n        return 1;\n    }\n    if (isinstance) {\n        identifier id;\n        expr_context_ty ctx;\n\n        if (lookup_attr_id(obj, &PyId_id, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"id\\\" missing from Name\");\n            return 1;\n        }\n        else {\n            int res;\n            res = obj2ast_identifier(tmp, &id, arena);\n            if (res != 0) goto failed;\n            Py_CLEAR(tmp);\n        }\n        if (lookup_attr_id(obj, &PyId_ctx, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"ctx\\\" missing from Name\");\n            return 1;\n        }\n        else {\n            int res;\n            res = obj2ast_expr_context(tmp, &ctx, arena);\n            if (res != 0) goto failed;\n            Py_CLEAR(tmp);\n        }\n        *out = Name(id, ctx, lineno, col_offset, arena);\n        if (*out == NULL) goto failed;\n        return 0;\n    }\n    isinstance = PyObject_IsInstance(obj, (PyObject*)List_type);\n    if (isinstance == -1) {\n        return 1;\n    }\n    if (isinstance) {\n        asdl_seq* elts;\n        expr_context_ty ctx;\n\n        if (lookup_attr_id(obj, &PyId_elts, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"elts\\\" missing from List\");\n            return 1;\n        }\n        else {\n            int res;\n            Py_ssize_t len;\n            Py_ssize_t i;\n            if (!PyList_Check(tmp)) {\n                PyErr_Format(PyExc_TypeError, \"List field \\\"elts\\\" must be a list, not a %.200s\", tmp->ob_type->tp_name);\n                goto failed;\n            }\n            len = PyList_GET_SIZE(tmp);\n            elts = _Ta3_asdl_seq_new(len, arena);\n            if (elts == NULL) goto failed;\n            for (i = 0; i < len; i++) {\n                expr_ty val;\n                res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &val, arena);\n                if (res != 0) goto failed;\n                if (len != PyList_GET_SIZE(tmp)) {\n                    PyErr_SetString(PyExc_RuntimeError, \"List field \\\"elts\\\" changed size during iteration\");\n                    goto failed;\n                }\n                asdl_seq_SET(elts, i, val);\n            }\n            Py_CLEAR(tmp);\n        }\n        if (lookup_attr_id(obj, &PyId_ctx, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"ctx\\\" missing from List\");\n            return 1;\n        }\n        else {\n            int res;\n            res = obj2ast_expr_context(tmp, &ctx, arena);\n            if (res != 0) goto failed;\n            Py_CLEAR(tmp);\n        }\n        *out = List(elts, ctx, lineno, col_offset, arena);\n        if (*out == NULL) goto failed;\n        return 0;\n    }\n    isinstance = PyObject_IsInstance(obj, (PyObject*)Tuple_type);\n    if (isinstance == -1) {\n        return 1;\n    }\n    if (isinstance) {\n        asdl_seq* elts;\n        expr_context_ty ctx;\n\n        if (lookup_attr_id(obj, &PyId_elts, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"elts\\\" missing from Tuple\");\n            return 1;\n        }\n        else {\n            int res;\n            Py_ssize_t len;\n            Py_ssize_t i;\n            if (!PyList_Check(tmp)) {\n                PyErr_Format(PyExc_TypeError, \"Tuple field \\\"elts\\\" must be a list, not a %.200s\", tmp->ob_type->tp_name);\n                goto failed;\n            }\n            len = PyList_GET_SIZE(tmp);\n            elts = _Ta3_asdl_seq_new(len, arena);\n            if (elts == NULL) goto failed;\n            for (i = 0; i < len; i++) {\n                expr_ty val;\n                res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &val, arena);\n                if (res != 0) goto failed;\n                if (len != PyList_GET_SIZE(tmp)) {\n                    PyErr_SetString(PyExc_RuntimeError, \"Tuple field \\\"elts\\\" changed size during iteration\");\n                    goto failed;\n                }\n                asdl_seq_SET(elts, i, val);\n            }\n            Py_CLEAR(tmp);\n        }\n        if (lookup_attr_id(obj, &PyId_ctx, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"ctx\\\" missing from Tuple\");\n            return 1;\n        }\n        else {\n            int res;\n            res = obj2ast_expr_context(tmp, &ctx, arena);\n            if (res != 0) goto failed;\n            Py_CLEAR(tmp);\n        }\n        *out = Tuple(elts, ctx, lineno, col_offset, arena);\n        if (*out == NULL) goto failed;\n        return 0;\n    }\n\n    PyErr_Format(PyExc_TypeError, \"expected some sort of expr, but got %R\", obj);\n    failed:\n    Py_XDECREF(tmp);\n    return 1;\n}\n\nint\nobj2ast_expr_context(PyObject* obj, expr_context_ty* out, PyArena* arena)\n{\n    int isinstance;\n\n    isinstance = PyObject_IsInstance(obj, (PyObject *)Load_type);\n    if (isinstance == -1) {\n        return 1;\n    }\n    if (isinstance) {\n        *out = Load;\n        return 0;\n    }\n    isinstance = PyObject_IsInstance(obj, (PyObject *)Store_type);\n    if (isinstance == -1) {\n        return 1;\n    }\n    if (isinstance) {\n        *out = Store;\n        return 0;\n    }\n    isinstance = PyObject_IsInstance(obj, (PyObject *)Del_type);\n    if (isinstance == -1) {\n        return 1;\n    }\n    if (isinstance) {\n        *out = Del;\n        return 0;\n    }\n    isinstance = PyObject_IsInstance(obj, (PyObject *)AugLoad_type);\n    if (isinstance == -1) {\n        return 1;\n    }\n    if (isinstance) {\n        *out = AugLoad;\n        return 0;\n    }\n    isinstance = PyObject_IsInstance(obj, (PyObject *)AugStore_type);\n    if (isinstance == -1) {\n        return 1;\n    }\n    if (isinstance) {\n        *out = AugStore;\n        return 0;\n    }\n    isinstance = PyObject_IsInstance(obj, (PyObject *)Param_type);\n    if (isinstance == -1) {\n        return 1;\n    }\n    if (isinstance) {\n        *out = Param;\n        return 0;\n    }\n\n    PyErr_Format(PyExc_TypeError, \"expected some sort of expr_context, but got %R\", obj);\n    return 1;\n}\n\nint\nobj2ast_slice(PyObject* obj, slice_ty* out, PyArena* arena)\n{\n    int isinstance;\n\n    PyObject *tmp = NULL;\n\n    if (obj == Py_None) {\n        *out = NULL;\n        return 0;\n    }\n    isinstance = PyObject_IsInstance(obj, (PyObject*)Slice_type);\n    if (isinstance == -1) {\n        return 1;\n    }\n    if (isinstance) {\n        expr_ty lower;\n        expr_ty upper;\n        expr_ty step;\n\n        if (lookup_attr_id(obj, &PyId_lower, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL || tmp == Py_None) {\n            Py_CLEAR(tmp);\n            lower = NULL;\n        }\n        else {\n            int res;\n            res = obj2ast_expr(tmp, &lower, arena);\n            if (res != 0) goto failed;\n            Py_CLEAR(tmp);\n        }\n        if (lookup_attr_id(obj, &PyId_upper, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL || tmp == Py_None) {\n            Py_CLEAR(tmp);\n            upper = NULL;\n        }\n        else {\n            int res;\n            res = obj2ast_expr(tmp, &upper, arena);\n            if (res != 0) goto failed;\n            Py_CLEAR(tmp);\n        }\n        if (lookup_attr_id(obj, &PyId_step, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL || tmp == Py_None) {\n            Py_CLEAR(tmp);\n            step = NULL;\n        }\n        else {\n            int res;\n            res = obj2ast_expr(tmp, &step, arena);\n            if (res != 0) goto failed;\n            Py_CLEAR(tmp);\n        }\n        *out = Slice(lower, upper, step, arena);\n        if (*out == NULL) goto failed;\n        return 0;\n    }\n    isinstance = PyObject_IsInstance(obj, (PyObject*)ExtSlice_type);\n    if (isinstance == -1) {\n        return 1;\n    }\n    if (isinstance) {\n        asdl_seq* dims;\n\n        if (lookup_attr_id(obj, &PyId_dims, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"dims\\\" missing from ExtSlice\");\n            return 1;\n        }\n        else {\n            int res;\n            Py_ssize_t len;\n            Py_ssize_t i;\n            if (!PyList_Check(tmp)) {\n                PyErr_Format(PyExc_TypeError, \"ExtSlice field \\\"dims\\\" must be a list, not a %.200s\", tmp->ob_type->tp_name);\n                goto failed;\n            }\n            len = PyList_GET_SIZE(tmp);\n            dims = _Ta3_asdl_seq_new(len, arena);\n            if (dims == NULL) goto failed;\n            for (i = 0; i < len; i++) {\n                slice_ty val;\n                res = obj2ast_slice(PyList_GET_ITEM(tmp, i), &val, arena);\n                if (res != 0) goto failed;\n                if (len != PyList_GET_SIZE(tmp)) {\n                    PyErr_SetString(PyExc_RuntimeError, \"ExtSlice field \\\"dims\\\" changed size during iteration\");\n                    goto failed;\n                }\n                asdl_seq_SET(dims, i, val);\n            }\n            Py_CLEAR(tmp);\n        }\n        *out = ExtSlice(dims, arena);\n        if (*out == NULL) goto failed;\n        return 0;\n    }\n    isinstance = PyObject_IsInstance(obj, (PyObject*)Index_type);\n    if (isinstance == -1) {\n        return 1;\n    }\n    if (isinstance) {\n        expr_ty value;\n\n        if (lookup_attr_id(obj, &PyId_value, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"value\\\" missing from Index\");\n            return 1;\n        }\n        else {\n            int res;\n            res = obj2ast_expr(tmp, &value, arena);\n            if (res != 0) goto failed;\n            Py_CLEAR(tmp);\n        }\n        *out = Index(value, arena);\n        if (*out == NULL) goto failed;\n        return 0;\n    }\n\n    PyErr_Format(PyExc_TypeError, \"expected some sort of slice, but got %R\", obj);\n    failed:\n    Py_XDECREF(tmp);\n    return 1;\n}\n\nint\nobj2ast_boolop(PyObject* obj, boolop_ty* out, PyArena* arena)\n{\n    int isinstance;\n\n    isinstance = PyObject_IsInstance(obj, (PyObject *)And_type);\n    if (isinstance == -1) {\n        return 1;\n    }\n    if (isinstance) {\n        *out = And;\n        return 0;\n    }\n    isinstance = PyObject_IsInstance(obj, (PyObject *)Or_type);\n    if (isinstance == -1) {\n        return 1;\n    }\n    if (isinstance) {\n        *out = Or;\n        return 0;\n    }\n\n    PyErr_Format(PyExc_TypeError, \"expected some sort of boolop, but got %R\", obj);\n    return 1;\n}\n\nint\nobj2ast_operator(PyObject* obj, operator_ty* out, PyArena* arena)\n{\n    int isinstance;\n\n    isinstance = PyObject_IsInstance(obj, (PyObject *)Add_type);\n    if (isinstance == -1) {\n        return 1;\n    }\n    if (isinstance) {\n        *out = Add;\n        return 0;\n    }\n    isinstance = PyObject_IsInstance(obj, (PyObject *)Sub_type);\n    if (isinstance == -1) {\n        return 1;\n    }\n    if (isinstance) {\n        *out = Sub;\n        return 0;\n    }\n    isinstance = PyObject_IsInstance(obj, (PyObject *)Mult_type);\n    if (isinstance == -1) {\n        return 1;\n    }\n    if (isinstance) {\n        *out = Mult;\n        return 0;\n    }\n    isinstance = PyObject_IsInstance(obj, (PyObject *)MatMult_type);\n    if (isinstance == -1) {\n        return 1;\n    }\n    if (isinstance) {\n        *out = MatMult;\n        return 0;\n    }\n    isinstance = PyObject_IsInstance(obj, (PyObject *)Div_type);\n    if (isinstance == -1) {\n        return 1;\n    }\n    if (isinstance) {\n        *out = Div;\n        return 0;\n    }\n    isinstance = PyObject_IsInstance(obj, (PyObject *)Mod_type);\n    if (isinstance == -1) {\n        return 1;\n    }\n    if (isinstance) {\n        *out = Mod;\n        return 0;\n    }\n    isinstance = PyObject_IsInstance(obj, (PyObject *)Pow_type);\n    if (isinstance == -1) {\n        return 1;\n    }\n    if (isinstance) {\n        *out = Pow;\n        return 0;\n    }\n    isinstance = PyObject_IsInstance(obj, (PyObject *)LShift_type);\n    if (isinstance == -1) {\n        return 1;\n    }\n    if (isinstance) {\n        *out = LShift;\n        return 0;\n    }\n    isinstance = PyObject_IsInstance(obj, (PyObject *)RShift_type);\n    if (isinstance == -1) {\n        return 1;\n    }\n    if (isinstance) {\n        *out = RShift;\n        return 0;\n    }\n    isinstance = PyObject_IsInstance(obj, (PyObject *)BitOr_type);\n    if (isinstance == -1) {\n        return 1;\n    }\n    if (isinstance) {\n        *out = BitOr;\n        return 0;\n    }\n    isinstance = PyObject_IsInstance(obj, (PyObject *)BitXor_type);\n    if (isinstance == -1) {\n        return 1;\n    }\n    if (isinstance) {\n        *out = BitXor;\n        return 0;\n    }\n    isinstance = PyObject_IsInstance(obj, (PyObject *)BitAnd_type);\n    if (isinstance == -1) {\n        return 1;\n    }\n    if (isinstance) {\n        *out = BitAnd;\n        return 0;\n    }\n    isinstance = PyObject_IsInstance(obj, (PyObject *)FloorDiv_type);\n    if (isinstance == -1) {\n        return 1;\n    }\n    if (isinstance) {\n        *out = FloorDiv;\n        return 0;\n    }\n\n    PyErr_Format(PyExc_TypeError, \"expected some sort of operator, but got %R\", obj);\n    return 1;\n}\n\nint\nobj2ast_unaryop(PyObject* obj, unaryop_ty* out, PyArena* arena)\n{\n    int isinstance;\n\n    isinstance = PyObject_IsInstance(obj, (PyObject *)Invert_type);\n    if (isinstance == -1) {\n        return 1;\n    }\n    if (isinstance) {\n        *out = Invert;\n        return 0;\n    }\n    isinstance = PyObject_IsInstance(obj, (PyObject *)Not_type);\n    if (isinstance == -1) {\n        return 1;\n    }\n    if (isinstance) {\n        *out = Not;\n        return 0;\n    }\n    isinstance = PyObject_IsInstance(obj, (PyObject *)UAdd_type);\n    if (isinstance == -1) {\n        return 1;\n    }\n    if (isinstance) {\n        *out = UAdd;\n        return 0;\n    }\n    isinstance = PyObject_IsInstance(obj, (PyObject *)USub_type);\n    if (isinstance == -1) {\n        return 1;\n    }\n    if (isinstance) {\n        *out = USub;\n        return 0;\n    }\n\n    PyErr_Format(PyExc_TypeError, \"expected some sort of unaryop, but got %R\", obj);\n    return 1;\n}\n\nint\nobj2ast_cmpop(PyObject* obj, cmpop_ty* out, PyArena* arena)\n{\n    int isinstance;\n\n    isinstance = PyObject_IsInstance(obj, (PyObject *)Eq_type);\n    if (isinstance == -1) {\n        return 1;\n    }\n    if (isinstance) {\n        *out = Eq;\n        return 0;\n    }\n    isinstance = PyObject_IsInstance(obj, (PyObject *)NotEq_type);\n    if (isinstance == -1) {\n        return 1;\n    }\n    if (isinstance) {\n        *out = NotEq;\n        return 0;\n    }\n    isinstance = PyObject_IsInstance(obj, (PyObject *)Lt_type);\n    if (isinstance == -1) {\n        return 1;\n    }\n    if (isinstance) {\n        *out = Lt;\n        return 0;\n    }\n    isinstance = PyObject_IsInstance(obj, (PyObject *)LtE_type);\n    if (isinstance == -1) {\n        return 1;\n    }\n    if (isinstance) {\n        *out = LtE;\n        return 0;\n    }\n    isinstance = PyObject_IsInstance(obj, (PyObject *)Gt_type);\n    if (isinstance == -1) {\n        return 1;\n    }\n    if (isinstance) {\n        *out = Gt;\n        return 0;\n    }\n    isinstance = PyObject_IsInstance(obj, (PyObject *)GtE_type);\n    if (isinstance == -1) {\n        return 1;\n    }\n    if (isinstance) {\n        *out = GtE;\n        return 0;\n    }\n    isinstance = PyObject_IsInstance(obj, (PyObject *)Is_type);\n    if (isinstance == -1) {\n        return 1;\n    }\n    if (isinstance) {\n        *out = Is;\n        return 0;\n    }\n    isinstance = PyObject_IsInstance(obj, (PyObject *)IsNot_type);\n    if (isinstance == -1) {\n        return 1;\n    }\n    if (isinstance) {\n        *out = IsNot;\n        return 0;\n    }\n    isinstance = PyObject_IsInstance(obj, (PyObject *)In_type);\n    if (isinstance == -1) {\n        return 1;\n    }\n    if (isinstance) {\n        *out = In;\n        return 0;\n    }\n    isinstance = PyObject_IsInstance(obj, (PyObject *)NotIn_type);\n    if (isinstance == -1) {\n        return 1;\n    }\n    if (isinstance) {\n        *out = NotIn;\n        return 0;\n    }\n\n    PyErr_Format(PyExc_TypeError, \"expected some sort of cmpop, but got %R\", obj);\n    return 1;\n}\n\nint\nobj2ast_comprehension(PyObject* obj, comprehension_ty* out, PyArena* arena)\n{\n    PyObject* tmp = NULL;\n    expr_ty target;\n    expr_ty iter;\n    asdl_seq* ifs;\n    int is_async;\n\n    if (lookup_attr_id(obj, &PyId_target, &tmp) < 0) {\n        return 1;\n    }\n    if (tmp == NULL) {\n        PyErr_SetString(PyExc_TypeError, \"required field \\\"target\\\" missing from comprehension\");\n        return 1;\n    }\n    else {\n        int res;\n        res = obj2ast_expr(tmp, &target, arena);\n        if (res != 0) goto failed;\n        Py_CLEAR(tmp);\n    }\n    if (lookup_attr_id(obj, &PyId_iter, &tmp) < 0) {\n        return 1;\n    }\n    if (tmp == NULL) {\n        PyErr_SetString(PyExc_TypeError, \"required field \\\"iter\\\" missing from comprehension\");\n        return 1;\n    }\n    else {\n        int res;\n        res = obj2ast_expr(tmp, &iter, arena);\n        if (res != 0) goto failed;\n        Py_CLEAR(tmp);\n    }\n    if (lookup_attr_id(obj, &PyId_ifs, &tmp) < 0) {\n        return 1;\n    }\n    if (tmp == NULL) {\n        PyErr_SetString(PyExc_TypeError, \"required field \\\"ifs\\\" missing from comprehension\");\n        return 1;\n    }\n    else {\n        int res;\n        Py_ssize_t len;\n        Py_ssize_t i;\n        if (!PyList_Check(tmp)) {\n            PyErr_Format(PyExc_TypeError, \"comprehension field \\\"ifs\\\" must be a list, not a %.200s\", tmp->ob_type->tp_name);\n            goto failed;\n        }\n        len = PyList_GET_SIZE(tmp);\n        ifs = _Ta3_asdl_seq_new(len, arena);\n        if (ifs == NULL) goto failed;\n        for (i = 0; i < len; i++) {\n            expr_ty val;\n            res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &val, arena);\n            if (res != 0) goto failed;\n            if (len != PyList_GET_SIZE(tmp)) {\n                PyErr_SetString(PyExc_RuntimeError, \"comprehension field \\\"ifs\\\" changed size during iteration\");\n                goto failed;\n            }\n            asdl_seq_SET(ifs, i, val);\n        }\n        Py_CLEAR(tmp);\n    }\n    if (lookup_attr_id(obj, &PyId_is_async, &tmp) < 0) {\n        return 1;\n    }\n    if (tmp == NULL) {\n        PyErr_SetString(PyExc_TypeError, \"required field \\\"is_async\\\" missing from comprehension\");\n        return 1;\n    }\n    else {\n        int res;\n        res = obj2ast_int(tmp, &is_async, arena);\n        if (res != 0) goto failed;\n        Py_CLEAR(tmp);\n    }\n    *out = comprehension(target, iter, ifs, is_async, arena);\n    return 0;\nfailed:\n    Py_XDECREF(tmp);\n    return 1;\n}\n\nint\nobj2ast_excepthandler(PyObject* obj, excepthandler_ty* out, PyArena* arena)\n{\n    int isinstance;\n\n    PyObject *tmp = NULL;\n    int lineno;\n    int col_offset;\n\n    if (obj == Py_None) {\n        *out = NULL;\n        return 0;\n    }\n    if (lookup_attr_id(obj, &PyId_lineno, &tmp) < 0) {\n        return 1;\n    }\n    if (tmp == NULL) {\n        PyErr_SetString(PyExc_TypeError, \"required field \\\"lineno\\\" missing from excepthandler\");\n        return 1;\n    }\n    else {\n        int res;\n        res = obj2ast_int(tmp, &lineno, arena);\n        if (res != 0) goto failed;\n        Py_CLEAR(tmp);\n    }\n    if (lookup_attr_id(obj, &PyId_col_offset, &tmp) < 0) {\n        return 1;\n    }\n    if (tmp == NULL) {\n        PyErr_SetString(PyExc_TypeError, \"required field \\\"col_offset\\\" missing from excepthandler\");\n        return 1;\n    }\n    else {\n        int res;\n        res = obj2ast_int(tmp, &col_offset, arena);\n        if (res != 0) goto failed;\n        Py_CLEAR(tmp);\n    }\n    isinstance = PyObject_IsInstance(obj, (PyObject*)ExceptHandler_type);\n    if (isinstance == -1) {\n        return 1;\n    }\n    if (isinstance) {\n        expr_ty type;\n        identifier name;\n        asdl_seq* body;\n\n        if (lookup_attr_id(obj, &PyId_type, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL || tmp == Py_None) {\n            Py_CLEAR(tmp);\n            type = NULL;\n        }\n        else {\n            int res;\n            res = obj2ast_expr(tmp, &type, arena);\n            if (res != 0) goto failed;\n            Py_CLEAR(tmp);\n        }\n        if (lookup_attr_id(obj, &PyId_name, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL || tmp == Py_None) {\n            Py_CLEAR(tmp);\n            name = NULL;\n        }\n        else {\n            int res;\n            res = obj2ast_identifier(tmp, &name, arena);\n            if (res != 0) goto failed;\n            Py_CLEAR(tmp);\n        }\n        if (lookup_attr_id(obj, &PyId_body, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"body\\\" missing from ExceptHandler\");\n            return 1;\n        }\n        else {\n            int res;\n            Py_ssize_t len;\n            Py_ssize_t i;\n            if (!PyList_Check(tmp)) {\n                PyErr_Format(PyExc_TypeError, \"ExceptHandler field \\\"body\\\" must be a list, not a %.200s\", tmp->ob_type->tp_name);\n                goto failed;\n            }\n            len = PyList_GET_SIZE(tmp);\n            body = _Ta3_asdl_seq_new(len, arena);\n            if (body == NULL) goto failed;\n            for (i = 0; i < len; i++) {\n                stmt_ty val;\n                res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &val, arena);\n                if (res != 0) goto failed;\n                if (len != PyList_GET_SIZE(tmp)) {\n                    PyErr_SetString(PyExc_RuntimeError, \"ExceptHandler field \\\"body\\\" changed size during iteration\");\n                    goto failed;\n                }\n                asdl_seq_SET(body, i, val);\n            }\n            Py_CLEAR(tmp);\n        }\n        *out = ExceptHandler(type, name, body, lineno, col_offset, arena);\n        if (*out == NULL) goto failed;\n        return 0;\n    }\n\n    PyErr_Format(PyExc_TypeError, \"expected some sort of excepthandler, but got %R\", obj);\n    failed:\n    Py_XDECREF(tmp);\n    return 1;\n}\n\nint\nobj2ast_arguments(PyObject* obj, arguments_ty* out, PyArena* arena)\n{\n    PyObject* tmp = NULL;\n    asdl_seq* args;\n    arg_ty vararg;\n    asdl_seq* kwonlyargs;\n    asdl_seq* kw_defaults;\n    arg_ty kwarg;\n    asdl_seq* defaults;\n\n    if (lookup_attr_id(obj, &PyId_args, &tmp) < 0) {\n        return 1;\n    }\n    if (tmp == NULL) {\n        PyErr_SetString(PyExc_TypeError, \"required field \\\"args\\\" missing from arguments\");\n        return 1;\n    }\n    else {\n        int res;\n        Py_ssize_t len;\n        Py_ssize_t i;\n        if (!PyList_Check(tmp)) {\n            PyErr_Format(PyExc_TypeError, \"arguments field \\\"args\\\" must be a list, not a %.200s\", tmp->ob_type->tp_name);\n            goto failed;\n        }\n        len = PyList_GET_SIZE(tmp);\n        args = _Ta3_asdl_seq_new(len, arena);\n        if (args == NULL) goto failed;\n        for (i = 0; i < len; i++) {\n            arg_ty val;\n            res = obj2ast_arg(PyList_GET_ITEM(tmp, i), &val, arena);\n            if (res != 0) goto failed;\n            if (len != PyList_GET_SIZE(tmp)) {\n                PyErr_SetString(PyExc_RuntimeError, \"arguments field \\\"args\\\" changed size during iteration\");\n                goto failed;\n            }\n            asdl_seq_SET(args, i, val);\n        }\n        Py_CLEAR(tmp);\n    }\n    if (lookup_attr_id(obj, &PyId_vararg, &tmp) < 0) {\n        return 1;\n    }\n    if (tmp == NULL || tmp == Py_None) {\n        Py_CLEAR(tmp);\n        vararg = NULL;\n    }\n    else {\n        int res;\n        res = obj2ast_arg(tmp, &vararg, arena);\n        if (res != 0) goto failed;\n        Py_CLEAR(tmp);\n    }\n    if (lookup_attr_id(obj, &PyId_kwonlyargs, &tmp) < 0) {\n        return 1;\n    }\n    if (tmp == NULL) {\n        PyErr_SetString(PyExc_TypeError, \"required field \\\"kwonlyargs\\\" missing from arguments\");\n        return 1;\n    }\n    else {\n        int res;\n        Py_ssize_t len;\n        Py_ssize_t i;\n        if (!PyList_Check(tmp)) {\n            PyErr_Format(PyExc_TypeError, \"arguments field \\\"kwonlyargs\\\" must be a list, not a %.200s\", tmp->ob_type->tp_name);\n            goto failed;\n        }\n        len = PyList_GET_SIZE(tmp);\n        kwonlyargs = _Ta3_asdl_seq_new(len, arena);\n        if (kwonlyargs == NULL) goto failed;\n        for (i = 0; i < len; i++) {\n            arg_ty val;\n            res = obj2ast_arg(PyList_GET_ITEM(tmp, i), &val, arena);\n            if (res != 0) goto failed;\n            if (len != PyList_GET_SIZE(tmp)) {\n                PyErr_SetString(PyExc_RuntimeError, \"arguments field \\\"kwonlyargs\\\" changed size during iteration\");\n                goto failed;\n            }\n            asdl_seq_SET(kwonlyargs, i, val);\n        }\n        Py_CLEAR(tmp);\n    }\n    if (lookup_attr_id(obj, &PyId_kw_defaults, &tmp) < 0) {\n        return 1;\n    }\n    if (tmp == NULL) {\n        PyErr_SetString(PyExc_TypeError, \"required field \\\"kw_defaults\\\" missing from arguments\");\n        return 1;\n    }\n    else {\n        int res;\n        Py_ssize_t len;\n        Py_ssize_t i;\n        if (!PyList_Check(tmp)) {\n            PyErr_Format(PyExc_TypeError, \"arguments field \\\"kw_defaults\\\" must be a list, not a %.200s\", tmp->ob_type->tp_name);\n            goto failed;\n        }\n        len = PyList_GET_SIZE(tmp);\n        kw_defaults = _Ta3_asdl_seq_new(len, arena);\n        if (kw_defaults == NULL) goto failed;\n        for (i = 0; i < len; i++) {\n            expr_ty val;\n            res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &val, arena);\n            if (res != 0) goto failed;\n            if (len != PyList_GET_SIZE(tmp)) {\n                PyErr_SetString(PyExc_RuntimeError, \"arguments field \\\"kw_defaults\\\" changed size during iteration\");\n                goto failed;\n            }\n            asdl_seq_SET(kw_defaults, i, val);\n        }\n        Py_CLEAR(tmp);\n    }\n    if (lookup_attr_id(obj, &PyId_kwarg, &tmp) < 0) {\n        return 1;\n    }\n    if (tmp == NULL || tmp == Py_None) {\n        Py_CLEAR(tmp);\n        kwarg = NULL;\n    }\n    else {\n        int res;\n        res = obj2ast_arg(tmp, &kwarg, arena);\n        if (res != 0) goto failed;\n        Py_CLEAR(tmp);\n    }\n    if (lookup_attr_id(obj, &PyId_defaults, &tmp) < 0) {\n        return 1;\n    }\n    if (tmp == NULL) {\n        PyErr_SetString(PyExc_TypeError, \"required field \\\"defaults\\\" missing from arguments\");\n        return 1;\n    }\n    else {\n        int res;\n        Py_ssize_t len;\n        Py_ssize_t i;\n        if (!PyList_Check(tmp)) {\n            PyErr_Format(PyExc_TypeError, \"arguments field \\\"defaults\\\" must be a list, not a %.200s\", tmp->ob_type->tp_name);\n            goto failed;\n        }\n        len = PyList_GET_SIZE(tmp);\n        defaults = _Ta3_asdl_seq_new(len, arena);\n        if (defaults == NULL) goto failed;\n        for (i = 0; i < len; i++) {\n            expr_ty val;\n            res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &val, arena);\n            if (res != 0) goto failed;\n            if (len != PyList_GET_SIZE(tmp)) {\n                PyErr_SetString(PyExc_RuntimeError, \"arguments field \\\"defaults\\\" changed size during iteration\");\n                goto failed;\n            }\n            asdl_seq_SET(defaults, i, val);\n        }\n        Py_CLEAR(tmp);\n    }\n    *out = arguments(args, vararg, kwonlyargs, kw_defaults, kwarg, defaults,\n                     arena);\n    return 0;\nfailed:\n    Py_XDECREF(tmp);\n    return 1;\n}\n\nint\nobj2ast_arg(PyObject* obj, arg_ty* out, PyArena* arena)\n{\n    PyObject* tmp = NULL;\n    identifier arg;\n    expr_ty annotation;\n    string type_comment;\n    int lineno;\n    int col_offset;\n\n    if (lookup_attr_id(obj, &PyId_arg, &tmp) < 0) {\n        return 1;\n    }\n    if (tmp == NULL) {\n        PyErr_SetString(PyExc_TypeError, \"required field \\\"arg\\\" missing from arg\");\n        return 1;\n    }\n    else {\n        int res;\n        res = obj2ast_identifier(tmp, &arg, arena);\n        if (res != 0) goto failed;\n        Py_CLEAR(tmp);\n    }\n    if (lookup_attr_id(obj, &PyId_annotation, &tmp) < 0) {\n        return 1;\n    }\n    if (tmp == NULL || tmp == Py_None) {\n        Py_CLEAR(tmp);\n        annotation = NULL;\n    }\n    else {\n        int res;\n        res = obj2ast_expr(tmp, &annotation, arena);\n        if (res != 0) goto failed;\n        Py_CLEAR(tmp);\n    }\n    if (lookup_attr_id(obj, &PyId_type_comment, &tmp) < 0) {\n        return 1;\n    }\n    if (tmp == NULL || tmp == Py_None) {\n        Py_CLEAR(tmp);\n        type_comment = NULL;\n    }\n    else {\n        int res;\n        res = obj2ast_string(tmp, &type_comment, arena);\n        if (res != 0) goto failed;\n        Py_CLEAR(tmp);\n    }\n    if (lookup_attr_id(obj, &PyId_lineno, &tmp) < 0) {\n        return 1;\n    }\n    if (tmp == NULL) {\n        PyErr_SetString(PyExc_TypeError, \"required field \\\"lineno\\\" missing from arg\");\n        return 1;\n    }\n    else {\n        int res;\n        res = obj2ast_int(tmp, &lineno, arena);\n        if (res != 0) goto failed;\n        Py_CLEAR(tmp);\n    }\n    if (lookup_attr_id(obj, &PyId_col_offset, &tmp) < 0) {\n        return 1;\n    }\n    if (tmp == NULL) {\n        PyErr_SetString(PyExc_TypeError, \"required field \\\"col_offset\\\" missing from arg\");\n        return 1;\n    }\n    else {\n        int res;\n        res = obj2ast_int(tmp, &col_offset, arena);\n        if (res != 0) goto failed;\n        Py_CLEAR(tmp);\n    }\n    *out = arg(arg, annotation, type_comment, lineno, col_offset, arena);\n    return 0;\nfailed:\n    Py_XDECREF(tmp);\n    return 1;\n}\n\nint\nobj2ast_keyword(PyObject* obj, keyword_ty* out, PyArena* arena)\n{\n    PyObject* tmp = NULL;\n    identifier arg;\n    expr_ty value;\n\n    if (lookup_attr_id(obj, &PyId_arg, &tmp) < 0) {\n        return 1;\n    }\n    if (tmp == NULL || tmp == Py_None) {\n        Py_CLEAR(tmp);\n        arg = NULL;\n    }\n    else {\n        int res;\n        res = obj2ast_identifier(tmp, &arg, arena);\n        if (res != 0) goto failed;\n        Py_CLEAR(tmp);\n    }\n    if (lookup_attr_id(obj, &PyId_value, &tmp) < 0) {\n        return 1;\n    }\n    if (tmp == NULL) {\n        PyErr_SetString(PyExc_TypeError, \"required field \\\"value\\\" missing from keyword\");\n        return 1;\n    }\n    else {\n        int res;\n        res = obj2ast_expr(tmp, &value, arena);\n        if (res != 0) goto failed;\n        Py_CLEAR(tmp);\n    }\n    *out = keyword(arg, value, arena);\n    return 0;\nfailed:\n    Py_XDECREF(tmp);\n    return 1;\n}\n\nint\nobj2ast_alias(PyObject* obj, alias_ty* out, PyArena* arena)\n{\n    PyObject* tmp = NULL;\n    identifier name;\n    identifier asname;\n\n    if (lookup_attr_id(obj, &PyId_name, &tmp) < 0) {\n        return 1;\n    }\n    if (tmp == NULL) {\n        PyErr_SetString(PyExc_TypeError, \"required field \\\"name\\\" missing from alias\");\n        return 1;\n    }\n    else {\n        int res;\n        res = obj2ast_identifier(tmp, &name, arena);\n        if (res != 0) goto failed;\n        Py_CLEAR(tmp);\n    }\n    if (lookup_attr_id(obj, &PyId_asname, &tmp) < 0) {\n        return 1;\n    }\n    if (tmp == NULL || tmp == Py_None) {\n        Py_CLEAR(tmp);\n        asname = NULL;\n    }\n    else {\n        int res;\n        res = obj2ast_identifier(tmp, &asname, arena);\n        if (res != 0) goto failed;\n        Py_CLEAR(tmp);\n    }\n    *out = alias(name, asname, arena);\n    return 0;\nfailed:\n    Py_XDECREF(tmp);\n    return 1;\n}\n\nint\nobj2ast_withitem(PyObject* obj, withitem_ty* out, PyArena* arena)\n{\n    PyObject* tmp = NULL;\n    expr_ty context_expr;\n    expr_ty optional_vars;\n\n    if (lookup_attr_id(obj, &PyId_context_expr, &tmp) < 0) {\n        return 1;\n    }\n    if (tmp == NULL) {\n        PyErr_SetString(PyExc_TypeError, \"required field \\\"context_expr\\\" missing from withitem\");\n        return 1;\n    }\n    else {\n        int res;\n        res = obj2ast_expr(tmp, &context_expr, arena);\n        if (res != 0) goto failed;\n        Py_CLEAR(tmp);\n    }\n    if (lookup_attr_id(obj, &PyId_optional_vars, &tmp) < 0) {\n        return 1;\n    }\n    if (tmp == NULL || tmp == Py_None) {\n        Py_CLEAR(tmp);\n        optional_vars = NULL;\n    }\n    else {\n        int res;\n        res = obj2ast_expr(tmp, &optional_vars, arena);\n        if (res != 0) goto failed;\n        Py_CLEAR(tmp);\n    }\n    *out = withitem(context_expr, optional_vars, arena);\n    return 0;\nfailed:\n    Py_XDECREF(tmp);\n    return 1;\n}\n\nint\nobj2ast_type_ignore(PyObject* obj, type_ignore_ty* out, PyArena* arena)\n{\n    int isinstance;\n\n    PyObject *tmp = NULL;\n\n    if (obj == Py_None) {\n        *out = NULL;\n        return 0;\n    }\n    isinstance = PyObject_IsInstance(obj, (PyObject*)TypeIgnore_type);\n    if (isinstance == -1) {\n        return 1;\n    }\n    if (isinstance) {\n        int lineno;\n        string tag;\n\n        if (lookup_attr_id(obj, &PyId_lineno, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"lineno\\\" missing from TypeIgnore\");\n            return 1;\n        }\n        else {\n            int res;\n            res = obj2ast_int(tmp, &lineno, arena);\n            if (res != 0) goto failed;\n            Py_CLEAR(tmp);\n        }\n        if (lookup_attr_id(obj, &PyId_tag, &tmp) < 0) {\n            return 1;\n        }\n        if (tmp == NULL) {\n            PyErr_SetString(PyExc_TypeError, \"required field \\\"tag\\\" missing from TypeIgnore\");\n            return 1;\n        }\n        else {\n            int res;\n            res = obj2ast_string(tmp, &tag, arena);\n            if (res != 0) goto failed;\n            Py_CLEAR(tmp);\n        }\n        *out = TypeIgnore(lineno, tag, arena);\n        if (*out == NULL) goto failed;\n        return 0;\n    }\n\n    PyErr_Format(PyExc_TypeError, \"expected some sort of type_ignore, but got %R\", obj);\n    failed:\n    Py_XDECREF(tmp);\n    return 1;\n}\n\n\nPyObject *ast3_parse(PyObject *self, PyObject *args);\nstatic PyMethodDef ast3_methods[] = {\n    {\"_parse\",  ast3_parse, METH_VARARGS, \"Parse string into typed AST.\"},\n    {NULL, NULL, 0, NULL}\n};\nstatic struct PyModuleDef _astmodule = {\n    PyModuleDef_HEAD_INIT, \"_ast3\", NULL, 0, ast3_methods\n};\nPyMODINIT_FUNC\nPyInit__ast3(void)\n{\n    PyObject *m, *d;\n    if (!init_types()) return NULL;\n    m = PyModule_Create(&_astmodule);\n    if (!m) return NULL;\n    d = PyModule_GetDict(m);\n    if (PyDict_SetItemString(d, \"AST\", (PyObject*)&AST_type) < 0) return NULL;\n    if (PyModule_AddIntMacro(m, PyCF_ONLY_AST) < 0)\n        return NULL;\n    if (PyDict_SetItemString(d, \"mod\", (PyObject*)mod_type) < 0) return NULL;\n    if (PyDict_SetItemString(d, \"Module\", (PyObject*)Module_type) < 0) return\n        NULL;\n    if (PyDict_SetItemString(d, \"Interactive\", (PyObject*)Interactive_type) <\n        0) return NULL;\n    if (PyDict_SetItemString(d, \"Expression\", (PyObject*)Expression_type) < 0)\n        return NULL;\n    if (PyDict_SetItemString(d, \"FunctionType\", (PyObject*)FunctionType_type) <\n        0) return NULL;\n    if (PyDict_SetItemString(d, \"Suite\", (PyObject*)Suite_type) < 0) return\n        NULL;\n    if (PyDict_SetItemString(d, \"stmt\", (PyObject*)stmt_type) < 0) return NULL;\n    if (PyDict_SetItemString(d, \"FunctionDef\", (PyObject*)FunctionDef_type) <\n        0) return NULL;\n    if (PyDict_SetItemString(d, \"AsyncFunctionDef\",\n        (PyObject*)AsyncFunctionDef_type) < 0) return NULL;\n    if (PyDict_SetItemString(d, \"ClassDef\", (PyObject*)ClassDef_type) < 0)\n        return NULL;\n    if (PyDict_SetItemString(d, \"Return\", (PyObject*)Return_type) < 0) return\n        NULL;\n    if (PyDict_SetItemString(d, \"Delete\", (PyObject*)Delete_type) < 0) return\n        NULL;\n    if (PyDict_SetItemString(d, \"Assign\", (PyObject*)Assign_type) < 0) return\n        NULL;\n    if (PyDict_SetItemString(d, \"AugAssign\", (PyObject*)AugAssign_type) < 0)\n        return NULL;\n    if (PyDict_SetItemString(d, \"AnnAssign\", (PyObject*)AnnAssign_type) < 0)\n        return NULL;\n    if (PyDict_SetItemString(d, \"For\", (PyObject*)For_type) < 0) return NULL;\n    if (PyDict_SetItemString(d, \"AsyncFor\", (PyObject*)AsyncFor_type) < 0)\n        return NULL;\n    if (PyDict_SetItemString(d, \"While\", (PyObject*)While_type) < 0) return\n        NULL;\n    if (PyDict_SetItemString(d, \"If\", (PyObject*)If_type) < 0) return NULL;\n    if (PyDict_SetItemString(d, \"With\", (PyObject*)With_type) < 0) return NULL;\n    if (PyDict_SetItemString(d, \"AsyncWith\", (PyObject*)AsyncWith_type) < 0)\n        return NULL;\n    if (PyDict_SetItemString(d, \"Raise\", (PyObject*)Raise_type) < 0) return\n        NULL;\n    if (PyDict_SetItemString(d, \"Try\", (PyObject*)Try_type) < 0) return NULL;\n    if (PyDict_SetItemString(d, \"Assert\", (PyObject*)Assert_type) < 0) return\n        NULL;\n    if (PyDict_SetItemString(d, \"Import\", (PyObject*)Import_type) < 0) return\n        NULL;\n    if (PyDict_SetItemString(d, \"ImportFrom\", (PyObject*)ImportFrom_type) < 0)\n        return NULL;\n    if (PyDict_SetItemString(d, \"Global\", (PyObject*)Global_type) < 0) return\n        NULL;\n    if (PyDict_SetItemString(d, \"Nonlocal\", (PyObject*)Nonlocal_type) < 0)\n        return NULL;\n    if (PyDict_SetItemString(d, \"Expr\", (PyObject*)Expr_type) < 0) return NULL;\n    if (PyDict_SetItemString(d, \"Pass\", (PyObject*)Pass_type) < 0) return NULL;\n    if (PyDict_SetItemString(d, \"Break\", (PyObject*)Break_type) < 0) return\n        NULL;\n    if (PyDict_SetItemString(d, \"Continue\", (PyObject*)Continue_type) < 0)\n        return NULL;\n    if (PyDict_SetItemString(d, \"expr\", (PyObject*)expr_type) < 0) return NULL;\n    if (PyDict_SetItemString(d, \"BoolOp\", (PyObject*)BoolOp_type) < 0) return\n        NULL;\n    if (PyDict_SetItemString(d, \"BinOp\", (PyObject*)BinOp_type) < 0) return\n        NULL;\n    if (PyDict_SetItemString(d, \"UnaryOp\", (PyObject*)UnaryOp_type) < 0) return\n        NULL;\n    if (PyDict_SetItemString(d, \"Lambda\", (PyObject*)Lambda_type) < 0) return\n        NULL;\n    if (PyDict_SetItemString(d, \"IfExp\", (PyObject*)IfExp_type) < 0) return\n        NULL;\n    if (PyDict_SetItemString(d, \"Dict\", (PyObject*)Dict_type) < 0) return NULL;\n    if (PyDict_SetItemString(d, \"Set\", (PyObject*)Set_type) < 0) return NULL;\n    if (PyDict_SetItemString(d, \"ListComp\", (PyObject*)ListComp_type) < 0)\n        return NULL;\n    if (PyDict_SetItemString(d, \"SetComp\", (PyObject*)SetComp_type) < 0) return\n        NULL;\n    if (PyDict_SetItemString(d, \"DictComp\", (PyObject*)DictComp_type) < 0)\n        return NULL;\n    if (PyDict_SetItemString(d, \"GeneratorExp\", (PyObject*)GeneratorExp_type) <\n        0) return NULL;\n    if (PyDict_SetItemString(d, \"Await\", (PyObject*)Await_type) < 0) return\n        NULL;\n    if (PyDict_SetItemString(d, \"Yield\", (PyObject*)Yield_type) < 0) return\n        NULL;\n    if (PyDict_SetItemString(d, \"YieldFrom\", (PyObject*)YieldFrom_type) < 0)\n        return NULL;\n    if (PyDict_SetItemString(d, \"Compare\", (PyObject*)Compare_type) < 0) return\n        NULL;\n    if (PyDict_SetItemString(d, \"Call\", (PyObject*)Call_type) < 0) return NULL;\n    if (PyDict_SetItemString(d, \"Num\", (PyObject*)Num_type) < 0) return NULL;\n    if (PyDict_SetItemString(d, \"Str\", (PyObject*)Str_type) < 0) return NULL;\n    if (PyDict_SetItemString(d, \"FormattedValue\",\n        (PyObject*)FormattedValue_type) < 0) return NULL;\n    if (PyDict_SetItemString(d, \"JoinedStr\", (PyObject*)JoinedStr_type) < 0)\n        return NULL;\n    if (PyDict_SetItemString(d, \"Bytes\", (PyObject*)Bytes_type) < 0) return\n        NULL;\n    if (PyDict_SetItemString(d, \"NameConstant\", (PyObject*)NameConstant_type) <\n        0) return NULL;\n    if (PyDict_SetItemString(d, \"Ellipsis\", (PyObject*)Ellipsis_type) < 0)\n        return NULL;\n    if (PyDict_SetItemString(d, \"Constant\", (PyObject*)Constant_type) < 0)\n        return NULL;\n    if (PyDict_SetItemString(d, \"Attribute\", (PyObject*)Attribute_type) < 0)\n        return NULL;\n    if (PyDict_SetItemString(d, \"Subscript\", (PyObject*)Subscript_type) < 0)\n        return NULL;\n    if (PyDict_SetItemString(d, \"Starred\", (PyObject*)Starred_type) < 0) return\n        NULL;\n    if (PyDict_SetItemString(d, \"Name\", (PyObject*)Name_type) < 0) return NULL;\n    if (PyDict_SetItemString(d, \"List\", (PyObject*)List_type) < 0) return NULL;\n    if (PyDict_SetItemString(d, \"Tuple\", (PyObject*)Tuple_type) < 0) return\n        NULL;\n    if (PyDict_SetItemString(d, \"expr_context\", (PyObject*)expr_context_type) <\n        0) return NULL;\n    if (PyDict_SetItemString(d, \"Load\", (PyObject*)Load_type) < 0) return NULL;\n    if (PyDict_SetItemString(d, \"Store\", (PyObject*)Store_type) < 0) return\n        NULL;\n    if (PyDict_SetItemString(d, \"Del\", (PyObject*)Del_type) < 0) return NULL;\n    if (PyDict_SetItemString(d, \"AugLoad\", (PyObject*)AugLoad_type) < 0) return\n        NULL;\n    if (PyDict_SetItemString(d, \"AugStore\", (PyObject*)AugStore_type) < 0)\n        return NULL;\n    if (PyDict_SetItemString(d, \"Param\", (PyObject*)Param_type) < 0) return\n        NULL;\n    if (PyDict_SetItemString(d, \"slice\", (PyObject*)slice_type) < 0) return\n        NULL;\n    if (PyDict_SetItemString(d, \"Slice\", (PyObject*)Slice_type) < 0) return\n        NULL;\n    if (PyDict_SetItemString(d, \"ExtSlice\", (PyObject*)ExtSlice_type) < 0)\n        return NULL;\n    if (PyDict_SetItemString(d, \"Index\", (PyObject*)Index_type) < 0) return\n        NULL;\n    if (PyDict_SetItemString(d, \"boolop\", (PyObject*)boolop_type) < 0) return\n        NULL;\n    if (PyDict_SetItemString(d, \"And\", (PyObject*)And_type) < 0) return NULL;\n    if (PyDict_SetItemString(d, \"Or\", (PyObject*)Or_type) < 0) return NULL;\n    if (PyDict_SetItemString(d, \"operator\", (PyObject*)operator_type) < 0)\n        return NULL;\n    if (PyDict_SetItemString(d, \"Add\", (PyObject*)Add_type) < 0) return NULL;\n    if (PyDict_SetItemString(d, \"Sub\", (PyObject*)Sub_type) < 0) return NULL;\n    if (PyDict_SetItemString(d, \"Mult\", (PyObject*)Mult_type) < 0) return NULL;\n    if (PyDict_SetItemString(d, \"MatMult\", (PyObject*)MatMult_type) < 0) return\n        NULL;\n    if (PyDict_SetItemString(d, \"Div\", (PyObject*)Div_type) < 0) return NULL;\n    if (PyDict_SetItemString(d, \"Mod\", (PyObject*)Mod_type) < 0) return NULL;\n    if (PyDict_SetItemString(d, \"Pow\", (PyObject*)Pow_type) < 0) return NULL;\n    if (PyDict_SetItemString(d, \"LShift\", (PyObject*)LShift_type) < 0) return\n        NULL;\n    if (PyDict_SetItemString(d, \"RShift\", (PyObject*)RShift_type) < 0) return\n        NULL;\n    if (PyDict_SetItemString(d, \"BitOr\", (PyObject*)BitOr_type) < 0) return\n        NULL;\n    if (PyDict_SetItemString(d, \"BitXor\", (PyObject*)BitXor_type) < 0) return\n        NULL;\n    if (PyDict_SetItemString(d, \"BitAnd\", (PyObject*)BitAnd_type) < 0) return\n        NULL;\n    if (PyDict_SetItemString(d, \"FloorDiv\", (PyObject*)FloorDiv_type) < 0)\n        return NULL;\n    if (PyDict_SetItemString(d, \"unaryop\", (PyObject*)unaryop_type) < 0) return\n        NULL;\n    if (PyDict_SetItemString(d, \"Invert\", (PyObject*)Invert_type) < 0) return\n        NULL;\n    if (PyDict_SetItemString(d, \"Not\", (PyObject*)Not_type) < 0) return NULL;\n    if (PyDict_SetItemString(d, \"UAdd\", (PyObject*)UAdd_type) < 0) return NULL;\n    if (PyDict_SetItemString(d, \"USub\", (PyObject*)USub_type) < 0) return NULL;\n    if (PyDict_SetItemString(d, \"cmpop\", (PyObject*)cmpop_type) < 0) return\n        NULL;\n    if (PyDict_SetItemString(d, \"Eq\", (PyObject*)Eq_type) < 0) return NULL;\n    if (PyDict_SetItemString(d, \"NotEq\", (PyObject*)NotEq_type) < 0) return\n        NULL;\n    if (PyDict_SetItemString(d, \"Lt\", (PyObject*)Lt_type) < 0) return NULL;\n    if (PyDict_SetItemString(d, \"LtE\", (PyObject*)LtE_type) < 0) return NULL;\n    if (PyDict_SetItemString(d, \"Gt\", (PyObject*)Gt_type) < 0) return NULL;\n    if (PyDict_SetItemString(d, \"GtE\", (PyObject*)GtE_type) < 0) return NULL;\n    if (PyDict_SetItemString(d, \"Is\", (PyObject*)Is_type) < 0) return NULL;\n    if (PyDict_SetItemString(d, \"IsNot\", (PyObject*)IsNot_type) < 0) return\n        NULL;\n    if (PyDict_SetItemString(d, \"In\", (PyObject*)In_type) < 0) return NULL;\n    if (PyDict_SetItemString(d, \"NotIn\", (PyObject*)NotIn_type) < 0) return\n        NULL;\n    if (PyDict_SetItemString(d, \"comprehension\", (PyObject*)comprehension_type)\n        < 0) return NULL;\n    if (PyDict_SetItemString(d, \"excepthandler\", (PyObject*)excepthandler_type)\n        < 0) return NULL;\n    if (PyDict_SetItemString(d, \"ExceptHandler\", (PyObject*)ExceptHandler_type)\n        < 0) return NULL;\n    if (PyDict_SetItemString(d, \"arguments\", (PyObject*)arguments_type) < 0)\n        return NULL;\n    if (PyDict_SetItemString(d, \"arg\", (PyObject*)arg_type) < 0) return NULL;\n    if (PyDict_SetItemString(d, \"keyword\", (PyObject*)keyword_type) < 0) return\n        NULL;\n    if (PyDict_SetItemString(d, \"alias\", (PyObject*)alias_type) < 0) return\n        NULL;\n    if (PyDict_SetItemString(d, \"withitem\", (PyObject*)withitem_type) < 0)\n        return NULL;\n    if (PyDict_SetItemString(d, \"type_ignore\", (PyObject*)type_ignore_type) <\n        0) return NULL;\n    if (PyDict_SetItemString(d, \"TypeIgnore\", (PyObject*)TypeIgnore_type) < 0)\n        return NULL;\n    return m;\n}\n\n\nPyObject* Ta3AST_mod2obj(mod_ty t)\n{\n    if (!init_types())\n        return NULL;\n    return ast2obj_mod(t);\n}\n\n/* mode is 0 for \"exec\", 1 for \"eval\" and 2 for \"single\" input */\nmod_ty Ta3AST_obj2mod(PyObject* ast, PyArena* arena, int mode)\n{\n    mod_ty res;\n    PyObject *req_type[3];\n    char *req_name[] = {\"Module\", \"Expression\", \"Interactive\"};\n    int isinstance;\n\n    req_type[0] = (PyObject*)Module_type;\n    req_type[1] = (PyObject*)Expression_type;\n    req_type[2] = (PyObject*)Interactive_type;\n\n    assert(0 <= mode && mode <= 2);\n\n    if (!init_types())\n        return NULL;\n\n    isinstance = PyObject_IsInstance(ast, req_type[mode]);\n    if (isinstance == -1)\n        return NULL;\n    if (!isinstance) {\n        PyErr_Format(PyExc_TypeError, \"expected %s node, got %.400s\",\n                     req_name[mode], Py_TYPE(ast)->tp_name);\n        return NULL;\n    }\n    if (obj2ast_mod(ast, &res, arena) != 0)\n        return NULL;\n    else\n        return res;\n}\n\nint Ta3AST_Check(PyObject* obj)\n{\n    if (!init_types())\n        return -1;\n    return PyObject_IsInstance(obj, (PyObject*)&AST_type);\n}\n\n\n"
  },
  {
    "path": "ast3/Python/asdl.c",
    "content": "#include \"Python.h\"\n#include \"../Include/asdl.h\"\n\nasdl_seq *\n_Ta3_asdl_seq_new(Py_ssize_t size, PyArena *arena)\n{\n    asdl_seq *seq = NULL;\n    size_t n;\n\n    /* check size is sane */\n    if (size < 0 ||\n        (size && (((size_t)size - 1) > (SIZE_MAX / sizeof(void *))))) {\n        PyErr_NoMemory();\n        return NULL;\n    }\n    n = (size ? (sizeof(void *) * (size - 1)) : 0);\n\n    /* check if size can be added safely */\n    if (n > SIZE_MAX - sizeof(asdl_seq)) {\n        PyErr_NoMemory();\n        return NULL;\n    }\n    n += sizeof(asdl_seq);\n\n    seq = (asdl_seq *)PyArena_Malloc(arena, n);\n    if (!seq) {\n        PyErr_NoMemory();\n        return NULL;\n    }\n    memset(seq, 0, n);\n    seq->size = size;\n    return seq;\n}\n\nasdl_int_seq *\n_Ta3_asdl_int_seq_new(Py_ssize_t size, PyArena *arena)\n{\n    asdl_int_seq *seq = NULL;\n    size_t n;\n\n    /* check size is sane */\n    if (size < 0 ||\n        (size && (((size_t)size - 1) > (SIZE_MAX / sizeof(void *))))) {\n            PyErr_NoMemory();\n            return NULL;\n    }\n    n = (size ? (sizeof(void *) * (size - 1)) : 0);\n\n    /* check if size can be added safely */\n    if (n > SIZE_MAX - sizeof(asdl_seq)) {\n        PyErr_NoMemory();\n        return NULL;\n    }\n    n += sizeof(asdl_seq);\n\n    seq = (asdl_int_seq *)PyArena_Malloc(arena, n);\n    if (!seq) {\n        PyErr_NoMemory();\n        return NULL;\n    }\n    memset(seq, 0, n);\n    seq->size = size;\n    return seq;\n}\n"
  },
  {
    "path": "ast3/Python/ast.c",
    "content": "/*\n * This file includes functions to transform a concrete syntax tree (CST) to\n * an abstract syntax tree (AST). The main function is Ta3AST_FromNode().\n *\n */\n#include \"Python.h\"\n#include \"../Include/Python-ast.h\"\n#include \"../Include/node.h\"\n#include \"../Include/ast.h\"\n#include \"../Include/token.h\"\n#include \"pythonrun.h\"\n\n#include <assert.h>\n\n// VS 2010 doesn't have <stdbool.h>...\n#ifndef __bool_true_false_are_defined\ntypedef int bool;\n#define false 0\n#define true 1\n#endif\n\n\n#if PY_MINOR_VERSION < 6\nstatic PyObject *\n_PyObject_FastCall(PyObject *func, PyObject *const *args, int nargs)\n{\n    PyObject *t, *res;\n    int i;\n\n    t = PyTuple_New(nargs);\n    if (t == NULL) {\n        return NULL;\n    }\n    for (i = 0; i < nargs; i++) {\n        Py_INCREF(args[i]);\n        if (PyTuple_SetItem(t, i, args[i]) < 0) {\n            Py_DECREF(t);\n            return NULL;\n        }\n    }\n    res = PyObject_CallObject(func, t);\n    Py_DECREF(t);\n    return res;\n}\n#endif\n\n#if PY_MINOR_VERSION < 6\n#define _PyUnicode_EqualToASCIIString(a, b) (PyUnicode_CompareWithASCIIString((a), (b)) == 0)\n\nstatic PyObject *\n_PyBytes_DecodeEscape(const char *s,\n                      Py_ssize_t len,\n                      const char *errors,\n                      Py_ssize_t unicode,\n                      const char *recode_encoding,\n                      const char **first_invalid_escape)\n{\n    *first_invalid_escape = NULL;\n    return PyBytes_DecodeEscape(s, len, errors, unicode, recode_encoding);\n}\n\n#endif\n\nPyObject *\n_PyUnicode_DecodeUnicodeEscape(const char *s,\n                               Py_ssize_t size,\n                               const char *errors,\n                               const char **first_invalid_escape)\n{\n    *first_invalid_escape = NULL;\n    return PyUnicode_DecodeUnicodeEscape(s, size, errors);\n}\n\nstatic int validate_stmts(asdl_seq *);\nstatic int validate_exprs(asdl_seq *, expr_context_ty, int);\nstatic int validate_nonempty_seq(asdl_seq *, const char *, const char *);\nstatic int validate_stmt(stmt_ty);\nstatic int validate_expr(expr_ty, expr_context_ty);\n\nvoid\n_Ta3Parser_UpdateFlags(PyCompilerFlags *flags, int *iflags, int feature_version);\nnode *\nTa3Parser_SimpleParseStringFlagsFilename(const char *str, const char *filename,\n                                         int start, int flags);\n\nstatic int\nvalidate_comprehension(asdl_seq *gens)\n{\n    int i;\n    if (!asdl_seq_LEN(gens)) {\n        PyErr_SetString(PyExc_ValueError, \"comprehension with no generators\");\n        return 0;\n    }\n    for (i = 0; i < asdl_seq_LEN(gens); i++) {\n        comprehension_ty comp = asdl_seq_GET(gens, i);\n        if (!validate_expr(comp->target, Store) ||\n            !validate_expr(comp->iter, Load) ||\n            !validate_exprs(comp->ifs, Load, 0))\n            return 0;\n    }\n    return 1;\n}\n\nstatic int\nvalidate_slice(slice_ty slice)\n{\n    switch (slice->kind) {\n    case Slice_kind:\n        return (!slice->v.Slice.lower || validate_expr(slice->v.Slice.lower, Load)) &&\n            (!slice->v.Slice.upper || validate_expr(slice->v.Slice.upper, Load)) &&\n            (!slice->v.Slice.step || validate_expr(slice->v.Slice.step, Load));\n    case ExtSlice_kind: {\n        int i;\n        if (!validate_nonempty_seq(slice->v.ExtSlice.dims, \"dims\", \"ExtSlice\"))\n            return 0;\n        for (i = 0; i < asdl_seq_LEN(slice->v.ExtSlice.dims); i++)\n            if (!validate_slice(asdl_seq_GET(slice->v.ExtSlice.dims, i)))\n                return 0;\n        return 1;\n    }\n    case Index_kind:\n        return validate_expr(slice->v.Index.value, Load);\n    default:\n        PyErr_SetString(PyExc_SystemError, \"unknown slice node\");\n        return 0;\n    }\n}\n\nstatic int\nvalidate_keywords(asdl_seq *keywords)\n{\n    int i;\n    for (i = 0; i < asdl_seq_LEN(keywords); i++)\n        if (!validate_expr(((keyword_ty)asdl_seq_GET(keywords, i))->value, Load))\n            return 0;\n    return 1;\n}\n\nstatic int\nvalidate_args(asdl_seq *args)\n{\n    int i;\n    for (i = 0; i < asdl_seq_LEN(args); i++) {\n        arg_ty arg = asdl_seq_GET(args, i);\n        if (arg->annotation && !validate_expr(arg->annotation, Load))\n            return 0;\n    }\n    return 1;\n}\n\nstatic const char *\nexpr_context_name(expr_context_ty ctx)\n{\n    switch (ctx) {\n    case Load:\n        return \"Load\";\n    case Store:\n        return \"Store\";\n    case Del:\n        return \"Del\";\n    case AugLoad:\n        return \"AugLoad\";\n    case AugStore:\n        return \"AugStore\";\n    case Param:\n        return \"Param\";\n    default:\n        abort();\n    }\n}\n\nstatic int\nvalidate_arguments(arguments_ty args)\n{\n    if (!validate_args(args->args))\n        return 0;\n    if (args->vararg && args->vararg->annotation\n        && !validate_expr(args->vararg->annotation, Load)) {\n            return 0;\n    }\n    if (!validate_args(args->kwonlyargs))\n        return 0;\n    if (args->kwarg && args->kwarg->annotation\n        && !validate_expr(args->kwarg->annotation, Load)) {\n            return 0;\n    }\n    if (asdl_seq_LEN(args->defaults) > asdl_seq_LEN(args->args)) {\n        PyErr_SetString(PyExc_ValueError, \"more positional defaults than args on arguments\");\n        return 0;\n    }\n    if (asdl_seq_LEN(args->kw_defaults) != asdl_seq_LEN(args->kwonlyargs)) {\n        PyErr_SetString(PyExc_ValueError, \"length of kwonlyargs is not the same as \"\n                        \"kw_defaults on arguments\");\n        return 0;\n    }\n    return validate_exprs(args->defaults, Load, 0) && validate_exprs(args->kw_defaults, Load, 1);\n}\n\nstatic int\nvalidate_constant(PyObject *value)\n{\n    if (value == Py_None || value == Py_Ellipsis)\n        return 1;\n\n    if (PyLong_CheckExact(value)\n            || PyFloat_CheckExact(value)\n            || PyComplex_CheckExact(value)\n            || PyBool_Check(value)\n            || PyUnicode_CheckExact(value)\n            || PyBytes_CheckExact(value))\n        return 1;\n\n    if (PyTuple_CheckExact(value) || PyFrozenSet_CheckExact(value)) {\n        PyObject *it;\n\n        it = PyObject_GetIter(value);\n        if (it == NULL)\n            return 0;\n\n        while (1) {\n            PyObject *item = PyIter_Next(it);\n            if (item == NULL) {\n                if (PyErr_Occurred()) {\n                    Py_DECREF(it);\n                    return 0;\n                }\n                break;\n            }\n\n            if (!validate_constant(item)) {\n                Py_DECREF(it);\n                Py_DECREF(item);\n                return 0;\n            }\n            Py_DECREF(item);\n        }\n\n        Py_DECREF(it);\n        return 1;\n    }\n\n    return 0;\n}\n\nstatic int\nvalidate_expr(expr_ty exp, expr_context_ty ctx)\n{\n    int check_ctx = 1;\n    expr_context_ty actual_ctx;\n\n    /* First check expression context. */\n    switch (exp->kind) {\n    case Attribute_kind:\n        actual_ctx = exp->v.Attribute.ctx;\n        break;\n    case Subscript_kind:\n        actual_ctx = exp->v.Subscript.ctx;\n        break;\n    case Starred_kind:\n        actual_ctx = exp->v.Starred.ctx;\n        break;\n    case Name_kind:\n        actual_ctx = exp->v.Name.ctx;\n        break;\n    case List_kind:\n        actual_ctx = exp->v.List.ctx;\n        break;\n    case Tuple_kind:\n        actual_ctx = exp->v.Tuple.ctx;\n        break;\n    default:\n        if (ctx != Load) {\n            PyErr_Format(PyExc_ValueError, \"expression which can't be \"\n                         \"assigned to in %s context\", expr_context_name(ctx));\n            return 0;\n        }\n        check_ctx = 0;\n        /* set actual_ctx to prevent gcc warning */\n        actual_ctx = 0;\n    }\n    if (check_ctx && actual_ctx != ctx) {\n        PyErr_Format(PyExc_ValueError, \"expression must have %s context but has %s instead\",\n                     expr_context_name(ctx), expr_context_name(actual_ctx));\n        return 0;\n    }\n\n    /* Now validate expression. */\n    switch (exp->kind) {\n    case BoolOp_kind:\n        if (asdl_seq_LEN(exp->v.BoolOp.values) < 2) {\n            PyErr_SetString(PyExc_ValueError, \"BoolOp with less than 2 values\");\n            return 0;\n        }\n        return validate_exprs(exp->v.BoolOp.values, Load, 0);\n    case BinOp_kind:\n        return validate_expr(exp->v.BinOp.left, Load) &&\n            validate_expr(exp->v.BinOp.right, Load);\n    case UnaryOp_kind:\n        return validate_expr(exp->v.UnaryOp.operand, Load);\n    case Lambda_kind:\n        return validate_arguments(exp->v.Lambda.args) &&\n            validate_expr(exp->v.Lambda.body, Load);\n    case IfExp_kind:\n        return validate_expr(exp->v.IfExp.test, Load) &&\n            validate_expr(exp->v.IfExp.body, Load) &&\n            validate_expr(exp->v.IfExp.orelse, Load);\n    case Dict_kind:\n        if (asdl_seq_LEN(exp->v.Dict.keys) != asdl_seq_LEN(exp->v.Dict.values)) {\n            PyErr_SetString(PyExc_ValueError,\n                            \"Dict doesn't have the same number of keys as values\");\n            return 0;\n        }\n        /* null_ok=1 for keys expressions to allow dict unpacking to work in\n           dict literals, i.e. ``{**{a:b}}`` */\n        return validate_exprs(exp->v.Dict.keys, Load, /*null_ok=*/ 1) &&\n            validate_exprs(exp->v.Dict.values, Load, /*null_ok=*/ 0);\n    case Set_kind:\n        return validate_exprs(exp->v.Set.elts, Load, 0);\n#define COMP(NAME) \\\n        case NAME ## _kind: \\\n            return validate_comprehension(exp->v.NAME.generators) && \\\n                validate_expr(exp->v.NAME.elt, Load);\n    COMP(ListComp)\n    COMP(SetComp)\n    COMP(GeneratorExp)\n#undef COMP\n    case DictComp_kind:\n        return validate_comprehension(exp->v.DictComp.generators) &&\n            validate_expr(exp->v.DictComp.key, Load) &&\n            validate_expr(exp->v.DictComp.value, Load);\n    case Yield_kind:\n        return !exp->v.Yield.value || validate_expr(exp->v.Yield.value, Load);\n    case YieldFrom_kind:\n        return validate_expr(exp->v.YieldFrom.value, Load);\n    case Await_kind:\n        return validate_expr(exp->v.Await.value, Load);\n    case Compare_kind:\n        if (!asdl_seq_LEN(exp->v.Compare.comparators)) {\n            PyErr_SetString(PyExc_ValueError, \"Compare with no comparators\");\n            return 0;\n        }\n        if (asdl_seq_LEN(exp->v.Compare.comparators) !=\n            asdl_seq_LEN(exp->v.Compare.ops)) {\n            PyErr_SetString(PyExc_ValueError, \"Compare has a different number \"\n                            \"of comparators and operands\");\n            return 0;\n        }\n        return validate_exprs(exp->v.Compare.comparators, Load, 0) &&\n            validate_expr(exp->v.Compare.left, Load);\n    case Call_kind:\n        return validate_expr(exp->v.Call.func, Load) &&\n            validate_exprs(exp->v.Call.args, Load, 0) &&\n            validate_keywords(exp->v.Call.keywords);\n    case Constant_kind:\n        if (!validate_constant(exp->v.Constant.value)) {\n            PyErr_Format(PyExc_TypeError,\n                         \"got an invalid type in Constant: %s\",\n                         Py_TYPE(exp->v.Constant.value)->tp_name);\n            return 0;\n        }\n        return 1;\n    case Num_kind: {\n        PyObject *n = exp->v.Num.n;\n        if (!PyLong_CheckExact(n) && !PyFloat_CheckExact(n) &&\n            !PyComplex_CheckExact(n)) {\n            PyErr_SetString(PyExc_TypeError, \"non-numeric type in Num\");\n            return 0;\n        }\n        return 1;\n    }\n    case Str_kind: {\n        PyObject *s = exp->v.Str.s;\n        if (!PyUnicode_CheckExact(s)) {\n            PyErr_SetString(PyExc_TypeError, \"non-string type in Str\");\n            return 0;\n        }\n        return 1;\n    }\n    case JoinedStr_kind:\n        return validate_exprs(exp->v.JoinedStr.values, Load, 0);\n    case FormattedValue_kind:\n        if (validate_expr(exp->v.FormattedValue.value, Load) == 0)\n            return 0;\n        if (exp->v.FormattedValue.format_spec)\n            return validate_expr(exp->v.FormattedValue.format_spec, Load);\n        return 1;\n    case Bytes_kind: {\n        PyObject *b = exp->v.Bytes.s;\n        if (!PyBytes_CheckExact(b)) {\n            PyErr_SetString(PyExc_TypeError, \"non-bytes type in Bytes\");\n            return 0;\n        }\n        return 1;\n    }\n    case Attribute_kind:\n        return validate_expr(exp->v.Attribute.value, Load);\n    case Subscript_kind:\n        return validate_slice(exp->v.Subscript.slice) &&\n            validate_expr(exp->v.Subscript.value, Load);\n    case Starred_kind:\n        return validate_expr(exp->v.Starred.value, ctx);\n    case List_kind:\n        return validate_exprs(exp->v.List.elts, ctx, 0);\n    case Tuple_kind:\n        return validate_exprs(exp->v.Tuple.elts, ctx, 0);\n    /* These last cases don't have any checking. */\n    case Name_kind:\n    case NameConstant_kind:\n    case Ellipsis_kind:\n        return 1;\n    default:\n        PyErr_SetString(PyExc_SystemError, \"unexpected expression\");\n        return 0;\n    }\n}\n\nstatic int\nvalidate_nonempty_seq(asdl_seq *seq, const char *what, const char *owner)\n{\n    if (asdl_seq_LEN(seq))\n        return 1;\n    PyErr_Format(PyExc_ValueError, \"empty %s on %s\", what, owner);\n    return 0;\n}\n\nstatic int\nvalidate_assignlist(asdl_seq *targets, expr_context_ty ctx)\n{\n    return validate_nonempty_seq(targets, \"targets\", ctx == Del ? \"Delete\" : \"Assign\") &&\n        validate_exprs(targets, ctx, 0);\n}\n\nstatic int\nvalidate_body(asdl_seq *body, const char *owner)\n{\n    return validate_nonempty_seq(body, \"body\", owner) && validate_stmts(body);\n}\n\nstatic int\nvalidate_stmt(stmt_ty stmt)\n{\n    int i;\n    switch (stmt->kind) {\n    case FunctionDef_kind:\n        return validate_body(stmt->v.FunctionDef.body, \"FunctionDef\") &&\n            validate_arguments(stmt->v.FunctionDef.args) &&\n            validate_exprs(stmt->v.FunctionDef.decorator_list, Load, 0) &&\n            (!stmt->v.FunctionDef.returns ||\n             validate_expr(stmt->v.FunctionDef.returns, Load));\n    case ClassDef_kind:\n        return validate_body(stmt->v.ClassDef.body, \"ClassDef\") &&\n            validate_exprs(stmt->v.ClassDef.bases, Load, 0) &&\n            validate_keywords(stmt->v.ClassDef.keywords) &&\n            validate_exprs(stmt->v.ClassDef.decorator_list, Load, 0);\n    case Return_kind:\n        return !stmt->v.Return.value || validate_expr(stmt->v.Return.value, Load);\n    case Delete_kind:\n        return validate_assignlist(stmt->v.Delete.targets, Del);\n    case Assign_kind:\n        return validate_assignlist(stmt->v.Assign.targets, Store) &&\n            validate_expr(stmt->v.Assign.value, Load);\n    case AugAssign_kind:\n        return validate_expr(stmt->v.AugAssign.target, Store) &&\n            validate_expr(stmt->v.AugAssign.value, Load);\n    case AnnAssign_kind:\n        if (stmt->v.AnnAssign.target->kind != Name_kind &&\n            stmt->v.AnnAssign.simple) {\n            PyErr_SetString(PyExc_TypeError,\n                            \"AnnAssign with simple non-Name target\");\n            return 0;\n        }\n        return validate_expr(stmt->v.AnnAssign.target, Store) &&\n               (!stmt->v.AnnAssign.value ||\n                validate_expr(stmt->v.AnnAssign.value, Load)) &&\n               validate_expr(stmt->v.AnnAssign.annotation, Load);\n    case For_kind:\n        return validate_expr(stmt->v.For.target, Store) &&\n            validate_expr(stmt->v.For.iter, Load) &&\n            validate_body(stmt->v.For.body, \"For\") &&\n            validate_stmts(stmt->v.For.orelse);\n    case AsyncFor_kind:\n        return validate_expr(stmt->v.AsyncFor.target, Store) &&\n            validate_expr(stmt->v.AsyncFor.iter, Load) &&\n            validate_body(stmt->v.AsyncFor.body, \"AsyncFor\") &&\n            validate_stmts(stmt->v.AsyncFor.orelse);\n    case While_kind:\n        return validate_expr(stmt->v.While.test, Load) &&\n            validate_body(stmt->v.While.body, \"While\") &&\n            validate_stmts(stmt->v.While.orelse);\n    case If_kind:\n        return validate_expr(stmt->v.If.test, Load) &&\n            validate_body(stmt->v.If.body, \"If\") &&\n            validate_stmts(stmt->v.If.orelse);\n    case With_kind:\n        if (!validate_nonempty_seq(stmt->v.With.items, \"items\", \"With\"))\n            return 0;\n        for (i = 0; i < asdl_seq_LEN(stmt->v.With.items); i++) {\n            withitem_ty item = asdl_seq_GET(stmt->v.With.items, i);\n            if (!validate_expr(item->context_expr, Load) ||\n                (item->optional_vars && !validate_expr(item->optional_vars, Store)))\n                return 0;\n        }\n        return validate_body(stmt->v.With.body, \"With\");\n    case AsyncWith_kind:\n        if (!validate_nonempty_seq(stmt->v.AsyncWith.items, \"items\", \"AsyncWith\"))\n            return 0;\n        for (i = 0; i < asdl_seq_LEN(stmt->v.AsyncWith.items); i++) {\n            withitem_ty item = asdl_seq_GET(stmt->v.AsyncWith.items, i);\n            if (!validate_expr(item->context_expr, Load) ||\n                (item->optional_vars && !validate_expr(item->optional_vars, Store)))\n                return 0;\n        }\n        return validate_body(stmt->v.AsyncWith.body, \"AsyncWith\");\n    case Raise_kind:\n        if (stmt->v.Raise.exc) {\n            return validate_expr(stmt->v.Raise.exc, Load) &&\n                (!stmt->v.Raise.cause || validate_expr(stmt->v.Raise.cause, Load));\n        }\n        if (stmt->v.Raise.cause) {\n            PyErr_SetString(PyExc_ValueError, \"Raise with cause but no exception\");\n            return 0;\n        }\n        return 1;\n    case Try_kind:\n        if (!validate_body(stmt->v.Try.body, \"Try\"))\n            return 0;\n        if (!asdl_seq_LEN(stmt->v.Try.handlers) &&\n            !asdl_seq_LEN(stmt->v.Try.finalbody)) {\n            PyErr_SetString(PyExc_ValueError, \"Try has neither except handlers nor finalbody\");\n            return 0;\n        }\n        if (!asdl_seq_LEN(stmt->v.Try.handlers) &&\n            asdl_seq_LEN(stmt->v.Try.orelse)) {\n            PyErr_SetString(PyExc_ValueError, \"Try has orelse but no except handlers\");\n            return 0;\n        }\n        for (i = 0; i < asdl_seq_LEN(stmt->v.Try.handlers); i++) {\n            excepthandler_ty handler = asdl_seq_GET(stmt->v.Try.handlers, i);\n            if ((handler->v.ExceptHandler.type &&\n                 !validate_expr(handler->v.ExceptHandler.type, Load)) ||\n                !validate_body(handler->v.ExceptHandler.body, \"ExceptHandler\"))\n                return 0;\n        }\n        return (!asdl_seq_LEN(stmt->v.Try.finalbody) ||\n                validate_stmts(stmt->v.Try.finalbody)) &&\n            (!asdl_seq_LEN(stmt->v.Try.orelse) ||\n             validate_stmts(stmt->v.Try.orelse));\n    case Assert_kind:\n        return validate_expr(stmt->v.Assert.test, Load) &&\n            (!stmt->v.Assert.msg || validate_expr(stmt->v.Assert.msg, Load));\n    case Import_kind:\n        return validate_nonempty_seq(stmt->v.Import.names, \"names\", \"Import\");\n    case ImportFrom_kind:\n        if (stmt->v.ImportFrom.level < 0) {\n            PyErr_SetString(PyExc_ValueError, \"Negative ImportFrom level\");\n            return 0;\n        }\n        return validate_nonempty_seq(stmt->v.ImportFrom.names, \"names\", \"ImportFrom\");\n    case Global_kind:\n        return validate_nonempty_seq(stmt->v.Global.names, \"names\", \"Global\");\n    case Nonlocal_kind:\n        return validate_nonempty_seq(stmt->v.Nonlocal.names, \"names\", \"Nonlocal\");\n    case Expr_kind:\n        return validate_expr(stmt->v.Expr.value, Load);\n    case AsyncFunctionDef_kind:\n        return validate_body(stmt->v.AsyncFunctionDef.body, \"AsyncFunctionDef\") &&\n            validate_arguments(stmt->v.AsyncFunctionDef.args) &&\n            validate_exprs(stmt->v.AsyncFunctionDef.decorator_list, Load, 0) &&\n            (!stmt->v.AsyncFunctionDef.returns ||\n             validate_expr(stmt->v.AsyncFunctionDef.returns, Load));\n    case Pass_kind:\n    case Break_kind:\n    case Continue_kind:\n        return 1;\n    default:\n        PyErr_SetString(PyExc_SystemError, \"unexpected statement\");\n        return 0;\n    }\n}\n\nstatic int\nvalidate_stmts(asdl_seq *seq)\n{\n    int i;\n    for (i = 0; i < asdl_seq_LEN(seq); i++) {\n        stmt_ty stmt = asdl_seq_GET(seq, i);\n        if (stmt) {\n            if (!validate_stmt(stmt))\n                return 0;\n        }\n        else {\n            PyErr_SetString(PyExc_ValueError,\n                            \"None disallowed in statement list\");\n            return 0;\n        }\n    }\n    return 1;\n}\n\nstatic int\nvalidate_exprs(asdl_seq *exprs, expr_context_ty ctx, int null_ok)\n{\n    int i;\n    for (i = 0; i < asdl_seq_LEN(exprs); i++) {\n        expr_ty expr = asdl_seq_GET(exprs, i);\n        if (expr) {\n            if (!validate_expr(expr, ctx))\n                return 0;\n        }\n        else if (!null_ok) {\n            PyErr_SetString(PyExc_ValueError,\n                            \"None disallowed in expression list\");\n            return 0;\n        }\n\n    }\n    return 1;\n}\n\nint\nTa3AST_Validate(mod_ty mod)\n{\n    int res = 0;\n\n    switch (mod->kind) {\n    case Module_kind:\n        res = validate_stmts(mod->v.Module.body);\n        break;\n    case Interactive_kind:\n        res = validate_stmts(mod->v.Interactive.body);\n        break;\n    case Expression_kind:\n        res = validate_expr(mod->v.Expression.body, Load);\n        break;\n    case Suite_kind:\n        PyErr_SetString(PyExc_ValueError, \"Suite is not valid in the CPython compiler\");\n        break;\n    default:\n        PyErr_SetString(PyExc_SystemError, \"impossible module node\");\n        res = 0;\n        break;\n    }\n    return res;\n}\n\n/* This is done here, so defines like \"test\" don't interfere with AST use above. */\n#include \"../Include/grammar.h\"\n#include \"../Include/parsetok.h\"\n#include \"../Include/graminit.h\"\n\n/* Data structure used internally */\nstruct compiling {\n    PyArena *c_arena; /* Arena for allocating memory. */\n    PyObject *c_filename; /* filename */\n    PyObject *c_normalize; /* Normalization function from unicodedata. */\n    int c_feature_version; /* Latest minior version of Python for allowed features */\n};\n\nstatic asdl_seq *seq_for_testlist(struct compiling *, const node *);\nstatic expr_ty ast_for_expr(struct compiling *, const node *);\nstatic stmt_ty ast_for_stmt(struct compiling *, const node *);\nstatic asdl_seq *ast_for_suite(struct compiling *c, const node *n);\nstatic asdl_seq *ast_for_exprlist(struct compiling *, const node *,\n                                  expr_context_ty);\nstatic expr_ty ast_for_testlist(struct compiling *, const node *);\nstatic stmt_ty ast_for_classdef(struct compiling *, const node *, asdl_seq *);\n\nstatic stmt_ty ast_for_with_stmt(struct compiling *, const node *, bool);\nstatic stmt_ty ast_for_for_stmt(struct compiling *, const node *, bool);\n\n/* Note different signature for ast_for_call */\nstatic expr_ty ast_for_call(struct compiling *, const node *, expr_ty, bool);\n\nstatic PyObject *parsenumber(struct compiling *, const char *);\nstatic expr_ty parsestrplus(struct compiling *, const node *n);\n\n#define COMP_GENEXP   0\n#define COMP_LISTCOMP 1\n#define COMP_SETCOMP  2\n\nstatic int\ninit_normalization(struct compiling *c)\n{\n    PyObject *m = PyImport_ImportModuleNoBlock(\"unicodedata\");\n    if (!m)\n        return 0;\n    c->c_normalize = PyObject_GetAttrString(m, \"normalize\");\n    Py_DECREF(m);\n    if (!c->c_normalize)\n        return 0;\n    return 1;\n}\n\nstatic identifier\nnew_identifier(const char *n, struct compiling *c)\n{\n    PyObject *id = PyUnicode_DecodeUTF8(n, strlen(n), NULL);\n    if (!id)\n        return NULL;\n    /* PyUnicode_DecodeUTF8 should always return a ready string. */\n    assert(PyUnicode_IS_READY(id));\n    /* Check whether there are non-ASCII characters in the\n       identifier; if so, normalize to NFKC. */\n    if (!PyUnicode_IS_ASCII(id)) {\n        PyObject *id2;\n        PyObject *form;\n        PyObject *args[2];\n        _Py_IDENTIFIER(NFKC);\n        if (!c->c_normalize && !init_normalization(c)) {\n            Py_DECREF(id);\n            return NULL;\n        }\n        form = _PyUnicode_FromId(&PyId_NFKC);\n        if (form == NULL) {\n            Py_DECREF(id);\n            return NULL;\n        }\n        args[0] = form;\n        args[1] = id;\n        id2 = _PyObject_FastCall(c->c_normalize, args, 2);\n        Py_DECREF(id);\n        if (!id2)\n            return NULL;\n        if (!PyUnicode_Check(id2)) {\n            PyErr_Format(PyExc_TypeError,\n                         \"unicodedata.normalize() must return a string, not \"\n                         \"%.200s\",\n                         Py_TYPE(id2)->tp_name);\n            Py_DECREF(id2);\n            return NULL;\n        }\n        id = id2;\n    }\n    PyUnicode_InternInPlace(&id);\n    if (PyArena_AddPyObject(c->c_arena, id) < 0) {\n        Py_DECREF(id);\n        return NULL;\n    }\n    return id;\n}\n\n#define NEW_IDENTIFIER(n) new_identifier(STR(n), c)\n\nstatic string\nnew_type_comment(const char *s, struct compiling *c)\n{\n    PyObject *res = PyUnicode_DecodeUTF8(s, strlen(s), NULL);\n    if (!res)\n        return NULL;\n    if (PyArena_AddPyObject(c->c_arena, res) < 0) {\n        Py_DECREF(res);\n        return NULL;\n    }\n    return res;\n}\n#define NEW_TYPE_COMMENT(n) new_type_comment(STR(n), c)\n\nstatic int\nast_error(struct compiling *c, const node *n, const char *errmsg)\n{\n    PyObject *value, *errstr, *loc, *tmp;\n\n    loc = PyErr_ProgramTextObject(c->c_filename, LINENO(n));\n    if (!loc) {\n        Py_INCREF(Py_None);\n        loc = Py_None;\n    }\n    tmp = Py_BuildValue(\"(OiiN)\", c->c_filename, LINENO(n), n->n_col_offset, loc);\n    if (!tmp)\n        return 0;\n    errstr = PyUnicode_FromString(errmsg);\n    if (!errstr) {\n        Py_DECREF(tmp);\n        return 0;\n    }\n    value = PyTuple_Pack(2, errstr, tmp);\n    Py_DECREF(errstr);\n    Py_DECREF(tmp);\n    if (value) {\n        PyErr_SetObject(PyExc_SyntaxError, value);\n        Py_DECREF(value);\n    }\n    return 0;\n}\n\n/* num_stmts() returns number of contained statements.\n\n   Use this routine to determine how big a sequence is needed for\n   the statements in a parse tree.  Its raison d'etre is this bit of\n   grammar:\n\n   stmt: simple_stmt | compound_stmt\n   simple_stmt: small_stmt (';' small_stmt)* [';'] NEWLINE\n\n   A simple_stmt can contain multiple small_stmt elements joined\n   by semicolons.  If the arg is a simple_stmt, the number of\n   small_stmt elements is returned.\n*/\n\nstatic int\nnum_stmts(const node *n)\n{\n    int i, l;\n    node *ch;\n\n    switch (TYPE(n)) {\n        case single_input:\n            if (TYPE(CHILD(n, 0)) == NEWLINE)\n                return 0;\n            else\n                return num_stmts(CHILD(n, 0));\n        case file_input:\n            l = 0;\n            for (i = 0; i < NCH(n); i++) {\n                ch = CHILD(n, i);\n                if (TYPE(ch) == stmt)\n                    l += num_stmts(ch);\n            }\n            return l;\n        case stmt:\n            return num_stmts(CHILD(n, 0));\n        case compound_stmt:\n            return 1;\n        case simple_stmt:\n            return NCH(n) / 2; /* Divide by 2 to remove count of semi-colons */\n        case suite:\n            /* suite: simple_stmt | NEWLINE [TYPE_COMMENT NEWLINE] INDENT stmt+ DEDENT */\n            if (NCH(n) == 1)\n                return num_stmts(CHILD(n, 0));\n            else {\n                i = 2;\n                l = 0;\n                if (TYPE(CHILD(n, 1)) == TYPE_COMMENT)\n                    i += 2;\n                for (; i < (NCH(n) - 1); i++)\n                    l += num_stmts(CHILD(n, i));\n                return l;\n            }\n        default: {\n            char buf[128];\n\n            sprintf(buf, \"Non-statement found: %d %d\",\n                    TYPE(n), NCH(n));\n            Py_FatalError(buf);\n        }\n    }\n    abort();\n}\n\n/* Transform the CST rooted at node * to the appropriate AST\n*/\n\nmod_ty\nTa3AST_FromNodeObject(const node *n, PyCompilerFlags *flags,\n                      PyObject *filename, int feature_version,\n                      PyArena *arena)\n{\n    int i, j, k, num;\n    asdl_seq *stmts = NULL;\n    asdl_seq *type_ignores = NULL;\n    stmt_ty s;\n    node *ch;\n    struct compiling c;\n    mod_ty res = NULL;\n    asdl_seq *argtypes = NULL;\n    expr_ty ret, arg;\n\n    c.c_arena = arena;\n    /* borrowed reference */\n    c.c_filename = filename;\n    c.c_normalize = NULL;\n    c.c_feature_version = feature_version;\n\n    if (TYPE(n) == encoding_decl)\n        n = CHILD(n, 0);\n\n    k = 0;\n    switch (TYPE(n)) {\n        case file_input:\n            stmts = _Ta3_asdl_seq_new(num_stmts(n), arena);\n            if (!stmts)\n                goto out;\n            for (i = 0; i < NCH(n) - 1; i++) {\n                ch = CHILD(n, i);\n                if (TYPE(ch) == NEWLINE)\n                    continue;\n                REQ(ch, stmt);\n                num = num_stmts(ch);\n                if (num == 1) {\n                    s = ast_for_stmt(&c, ch);\n                    if (!s)\n                        goto out;\n                    asdl_seq_SET(stmts, k++, s);\n                }\n                else {\n                    ch = CHILD(ch, 0);\n                    REQ(ch, simple_stmt);\n                    for (j = 0; j < num; j++) {\n                        s = ast_for_stmt(&c, CHILD(ch, j * 2));\n                        if (!s)\n                            goto out;\n                        asdl_seq_SET(stmts, k++, s);\n                    }\n                }\n            }\n\n            /* Type ignores are stored under the ENDMARKER in file_input. */\n            ch = CHILD(n, NCH(n) - 1);\n            REQ(ch, ENDMARKER);\n            num = NCH(ch);\n            type_ignores = _Ta3_asdl_seq_new(num, arena);\n            if (!type_ignores)\n                goto out;\n\n            for (i = 0; i < num; i++) {\n                string type_comment = new_type_comment(STR(CHILD(ch, i)), &c);\n                if (!type_comment)\n                    goto out;\n                type_ignore_ty ti = TypeIgnore(LINENO(CHILD(ch, i)), type_comment, arena);\n                if (!ti)\n                   goto out;\n               asdl_seq_SET(type_ignores, i, ti);\n            }\n\n            res = Module(stmts, type_ignores, arena);\n            break;\n        case eval_input: {\n            expr_ty testlist_ast;\n\n            /* XXX Why not comp_for here? */\n            testlist_ast = ast_for_testlist(&c, CHILD(n, 0));\n            if (!testlist_ast)\n                goto out;\n            res = Expression(testlist_ast, arena);\n            break;\n        }\n        case single_input:\n            if (TYPE(CHILD(n, 0)) == NEWLINE) {\n                stmts = _Ta3_asdl_seq_new(1, arena);\n                if (!stmts)\n                    goto out;\n                asdl_seq_SET(stmts, 0, Pass(n->n_lineno, n->n_col_offset,\n                                            arena));\n                if (!asdl_seq_GET(stmts, 0))\n                    goto out;\n                res = Interactive(stmts, arena);\n            }\n            else {\n                n = CHILD(n, 0);\n                num = num_stmts(n);\n                stmts = _Ta3_asdl_seq_new(num, arena);\n                if (!stmts)\n                    goto out;\n                if (num == 1) {\n                    s = ast_for_stmt(&c, n);\n                    if (!s)\n                        goto out;\n                    asdl_seq_SET(stmts, 0, s);\n                }\n                else {\n                    /* Only a simple_stmt can contain multiple statements. */\n                    REQ(n, simple_stmt);\n                    for (i = 0; i < NCH(n); i += 2) {\n                        if (TYPE(CHILD(n, i)) == NEWLINE)\n                            break;\n                        s = ast_for_stmt(&c, CHILD(n, i));\n                        if (!s)\n                            goto out;\n                        asdl_seq_SET(stmts, i / 2, s);\n                    }\n                }\n\n                res = Interactive(stmts, arena);\n            }\n            break;\n        case func_type_input:\n            n = CHILD(n, 0);\n            REQ(n, func_type);\n\n            if (TYPE(CHILD(n, 1)) == typelist) {\n                ch = CHILD(n, 1);\n                /* this is overly permissive -- we don't pay any attention to\n                 * stars on the args -- just parse them into an ordered list */\n                num = 0;\n                for (i = 0; i < NCH(ch); i++) {\n                    if (TYPE(CHILD(ch, i)) == test)\n                        num++;\n                }\n\n                argtypes = _Ta3_asdl_seq_new(num, arena);\n\n                j = 0;\n                for (i = 0; i < NCH(ch); i++) {\n                    if (TYPE(CHILD(ch, i)) == test) {\n                        arg = ast_for_expr(&c, CHILD(ch, i));\n                        if (!arg)\n                            goto out;\n                        asdl_seq_SET(argtypes, j++, arg);\n                    }\n                }\n            }\n            else\n                argtypes = _Ta3_asdl_seq_new(0, arena);\n\n            ret = ast_for_expr(&c, CHILD(n, NCH(n) - 1));\n            if (!ret)\n                goto out;\n            res = FunctionType(argtypes, ret, arena);\n            break;\n        default:\n            PyErr_Format(PyExc_SystemError,\n                         \"invalid node %d for Ta3AST_FromNode\", TYPE(n));\n            goto out;\n    }\n out:\n    if (c.c_normalize) {\n        Py_DECREF(c.c_normalize);\n    }\n    return res;\n}\n\nmod_ty\nTa3AST_FromNode(const node *n, PyCompilerFlags *flags, const char *filename_str,\n                int feature_version, PyArena *arena)\n{\n    mod_ty mod;\n    PyObject *filename;\n    filename = PyUnicode_DecodeFSDefault(filename_str);\n    if (filename == NULL)\n        return NULL;\n    mod = Ta3AST_FromNodeObject(n, flags, filename, feature_version, arena);\n    Py_DECREF(filename);\n    return mod;\n\n}\n\n/* Return the AST repr. of the operator represented as syntax (|, ^, etc.)\n*/\n\nstatic operator_ty\nget_operator(struct compiling *c, const node *n)\n{\n    switch (TYPE(n)) {\n        case VBAR:\n            return BitOr;\n        case CIRCUMFLEX:\n            return BitXor;\n        case AMPER:\n            return BitAnd;\n        case LEFTSHIFT:\n            return LShift;\n        case RIGHTSHIFT:\n            return RShift;\n        case PLUS:\n            return Add;\n        case MINUS:\n            return Sub;\n        case STAR:\n            return Mult;\n        case AT:\n            if (c->c_feature_version < 5) {\n                ast_error(c, n,\n                        \"The '@' operator is only supported in Python 3.5 and greater\");\n                return (operator_ty)0;\n            }\n            return MatMult;\n        case SLASH:\n            return Div;\n        case DOUBLESLASH:\n            return FloorDiv;\n        case PERCENT:\n            return Mod;\n        default:\n            return (operator_ty)0;\n    }\n}\n\nstatic const char * const FORBIDDEN[] = {\n    \"None\",\n    \"True\",\n    \"False\",\n    NULL,\n};\n\nstatic int\nforbidden_name(struct compiling *c, identifier name, const node *n,\n               int full_checks)\n{\n    assert(PyUnicode_Check(name));\n    if (_PyUnicode_EqualToASCIIString(name, \"__debug__\")) {\n        ast_error(c, n, \"assignment to keyword\");\n        return 1;\n    }\n    if (full_checks) {\n        const char * const *p;\n        for (p = FORBIDDEN; *p; p++) {\n            if (_PyUnicode_EqualToASCIIString(name, *p)) {\n                ast_error(c, n, \"assignment to keyword\");\n                return 1;\n            }\n        }\n    }\n    return 0;\n}\n\n/* Set the context ctx for expr_ty e, recursively traversing e.\n\n   Only sets context for expr kinds that \"can appear in assignment context\"\n   (according to ../Parser/Python.asdl).  For other expr kinds, it sets\n   an appropriate syntax error and returns false.\n*/\n\nstatic int\nset_context(struct compiling *c, expr_ty e, expr_context_ty ctx, const node *n)\n{\n    asdl_seq *s = NULL;\n    /* If a particular expression type can't be used for assign / delete,\n       set expr_name to its name and an error message will be generated.\n    */\n    const char* expr_name = NULL;\n\n    /* The ast defines augmented store and load contexts, but the\n       implementation here doesn't actually use them.  The code may be\n       a little more complex than necessary as a result.  It also means\n       that expressions in an augmented assignment have a Store context.\n       Consider restructuring so that augmented assignment uses\n       set_context(), too.\n    */\n    assert(ctx != AugStore && ctx != AugLoad);\n\n    switch (e->kind) {\n        case Attribute_kind:\n            e->v.Attribute.ctx = ctx;\n            if (ctx == Store && forbidden_name(c, e->v.Attribute.attr, n, 1))\n                return 0;\n            break;\n        case Subscript_kind:\n            e->v.Subscript.ctx = ctx;\n            break;\n        case Starred_kind:\n            e->v.Starred.ctx = ctx;\n            if (!set_context(c, e->v.Starred.value, ctx, n))\n                return 0;\n            break;\n        case Name_kind:\n            if (ctx == Store) {\n                if (forbidden_name(c, e->v.Name.id, n, 0))\n                    return 0; /* forbidden_name() calls ast_error() */\n            }\n            e->v.Name.ctx = ctx;\n            break;\n        case List_kind:\n            e->v.List.ctx = ctx;\n            s = e->v.List.elts;\n            break;\n        case Tuple_kind:\n            e->v.Tuple.ctx = ctx;\n            s = e->v.Tuple.elts;\n            break;\n        case Lambda_kind:\n            expr_name = \"lambda\";\n            break;\n        case Call_kind:\n            expr_name = \"function call\";\n            break;\n        case BoolOp_kind:\n        case BinOp_kind:\n        case UnaryOp_kind:\n            expr_name = \"operator\";\n            break;\n        case GeneratorExp_kind:\n            expr_name = \"generator expression\";\n            break;\n        case Yield_kind:\n        case YieldFrom_kind:\n            expr_name = \"yield expression\";\n            break;\n        case Await_kind:\n            expr_name = \"await expression\";\n            break;\n        case ListComp_kind:\n            expr_name = \"list comprehension\";\n            break;\n        case SetComp_kind:\n            expr_name = \"set comprehension\";\n            break;\n        case DictComp_kind:\n            expr_name = \"dict comprehension\";\n            break;\n        case Dict_kind:\n        case Set_kind:\n        case Num_kind:\n        case Str_kind:\n        case Bytes_kind:\n        case JoinedStr_kind:\n        case FormattedValue_kind:\n            expr_name = \"literal\";\n            break;\n        case NameConstant_kind:\n            expr_name = \"keyword\";\n            break;\n        case Ellipsis_kind:\n            expr_name = \"Ellipsis\";\n            break;\n        case Compare_kind:\n            expr_name = \"comparison\";\n            break;\n        case IfExp_kind:\n            expr_name = \"conditional expression\";\n            break;\n        default:\n            PyErr_Format(PyExc_SystemError,\n                         \"unexpected expression in assignment %d (line %d)\",\n                         e->kind, e->lineno);\n            return 0;\n    }\n    /* Check for error string set by switch */\n    if (expr_name) {\n        char buf[300];\n        PyOS_snprintf(buf, sizeof(buf),\n                      \"can't %s %s\",\n                      ctx == Store ? \"assign to\" : \"delete\",\n                      expr_name);\n        return ast_error(c, n, buf);\n    }\n\n    /* If the LHS is a list or tuple, we need to set the assignment\n       context for all the contained elements.\n    */\n    if (s) {\n        int i;\n\n        for (i = 0; i < asdl_seq_LEN(s); i++) {\n            if (!set_context(c, (expr_ty)asdl_seq_GET(s, i), ctx, n))\n                return 0;\n        }\n    }\n    return 1;\n}\n\nstatic operator_ty\nast_for_augassign(struct compiling *c, const node *n)\n{\n    REQ(n, augassign);\n    n = CHILD(n, 0);\n    switch (STR(n)[0]) {\n        case '+':\n            return Add;\n        case '-':\n            return Sub;\n        case '/':\n            if (STR(n)[1] == '/')\n                return FloorDiv;\n            else\n                return Div;\n        case '%':\n            return Mod;\n        case '<':\n            return LShift;\n        case '>':\n            return RShift;\n        case '&':\n            return BitAnd;\n        case '^':\n            return BitXor;\n        case '|':\n            return BitOr;\n        case '*':\n            if (STR(n)[1] == '*')\n                return Pow;\n            else\n                return Mult;\n        case '@':\n            if (c->c_feature_version < 5) {\n                ast_error(c, n,\n                        \"The '@' operator is only supported in Python 3.5 and greater\");\n                return (operator_ty)0;\n            }\n            return MatMult;\n        default:\n            PyErr_Format(PyExc_SystemError, \"invalid augassign: %s\", STR(n));\n            return (operator_ty)0;\n    }\n}\n\nstatic cmpop_ty\nast_for_comp_op(struct compiling *c, const node *n)\n{\n    /* comp_op: '<'|'>'|'=='|'>='|'<='|'!='|'in'|'not' 'in'|'is'\n               |'is' 'not'\n    */\n    REQ(n, comp_op);\n    if (NCH(n) == 1) {\n        n = CHILD(n, 0);\n        switch (TYPE(n)) {\n            case LESS:\n                return Lt;\n            case GREATER:\n                return Gt;\n            case EQEQUAL:                       /* == */\n                return Eq;\n            case LESSEQUAL:\n                return LtE;\n            case GREATEREQUAL:\n                return GtE;\n            case NOTEQUAL:\n                return NotEq;\n            case NAME:\n                if (strcmp(STR(n), \"in\") == 0)\n                    return In;\n                if (strcmp(STR(n), \"is\") == 0)\n                    return Is;\n                /* fall through */\n            default:\n                PyErr_Format(PyExc_SystemError, \"invalid comp_op: %s\",\n                             STR(n));\n                return (cmpop_ty)0;\n        }\n    }\n    else if (NCH(n) == 2) {\n        /* handle \"not in\" and \"is not\" */\n        switch (TYPE(CHILD(n, 0))) {\n            case NAME:\n                if (strcmp(STR(CHILD(n, 1)), \"in\") == 0)\n                    return NotIn;\n                if (strcmp(STR(CHILD(n, 0)), \"is\") == 0)\n                    return IsNot;\n                /* fall through */\n            default:\n                PyErr_Format(PyExc_SystemError, \"invalid comp_op: %s %s\",\n                             STR(CHILD(n, 0)), STR(CHILD(n, 1)));\n                return (cmpop_ty)0;\n        }\n    }\n    PyErr_Format(PyExc_SystemError, \"invalid comp_op: has %d children\",\n                 NCH(n));\n    return (cmpop_ty)0;\n}\n\nstatic asdl_seq *\nseq_for_testlist(struct compiling *c, const node *n)\n{\n    /* testlist: test (',' test)* [',']\n       testlist_star_expr: test|star_expr (',' test|star_expr)* [',']\n    */\n    asdl_seq *seq;\n    expr_ty expression;\n    int i;\n    assert(TYPE(n) == testlist || TYPE(n) == testlist_star_expr || TYPE(n) == testlist_comp);\n\n    seq = _Ta3_asdl_seq_new((NCH(n) + 1) / 2, c->c_arena);\n    if (!seq)\n        return NULL;\n\n    for (i = 0; i < NCH(n); i += 2) {\n        const node *ch = CHILD(n, i);\n        assert(TYPE(ch) == test || TYPE(ch) == test_nocond || TYPE(ch) == star_expr);\n\n        expression = ast_for_expr(c, ch);\n        if (!expression)\n            return NULL;\n\n        assert(i / 2 < seq->size);\n        asdl_seq_SET(seq, i / 2, expression);\n    }\n    return seq;\n}\n\nstatic arg_ty\nast_for_arg(struct compiling *c, const node *n)\n{\n    identifier name;\n    expr_ty annotation = NULL;\n    node *ch;\n    arg_ty ret;\n\n    assert(TYPE(n) == tfpdef || TYPE(n) == vfpdef);\n    ch = CHILD(n, 0);\n    name = NEW_IDENTIFIER(ch);\n    if (!name)\n        return NULL;\n    if (forbidden_name(c, name, ch, 0))\n        return NULL;\n\n    if (NCH(n) == 3 && TYPE(CHILD(n, 1)) == COLON) {\n        annotation = ast_for_expr(c, CHILD(n, 2));\n        if (!annotation)\n            return NULL;\n    }\n\n    ret = arg(name, annotation, NULL, LINENO(n), n->n_col_offset, c->c_arena);\n    if (!ret)\n        return NULL;\n    return ret;\n}\n\n/* returns -1 if failed to handle keyword only arguments\n   returns new position to keep processing if successful\n               (',' tfpdef ['=' test])*\n                     ^^^\n   start pointing here\n */\nstatic int\nhandle_keywordonly_args(struct compiling *c, const node *n, int start,\n                        asdl_seq *kwonlyargs, asdl_seq *kwdefaults)\n{\n    PyObject *argname;\n    node *ch;\n    expr_ty expression, annotation;\n    arg_ty arg = NULL;\n    int i = start;\n    int j = 0; /* index for kwdefaults and kwonlyargs */\n\n    if (kwonlyargs == NULL) {\n        ast_error(c, CHILD(n, start), \"named arguments must follow bare *\");\n        return -1;\n    }\n    assert(kwdefaults != NULL);\n    while (i < NCH(n)) {\n        ch = CHILD(n, i);\n        switch (TYPE(ch)) {\n            case vfpdef:\n            case tfpdef:\n                if (i + 1 < NCH(n) && TYPE(CHILD(n, i + 1)) == EQUAL) {\n                    expression = ast_for_expr(c, CHILD(n, i + 2));\n                    if (!expression)\n                        goto error;\n                    asdl_seq_SET(kwdefaults, j, expression);\n                    i += 2; /* '=' and test */\n                }\n                else { /* setting NULL if no default value exists */\n                    asdl_seq_SET(kwdefaults, j, NULL);\n                }\n                if (NCH(ch) == 3) {\n                    /* ch is NAME ':' test */\n                    annotation = ast_for_expr(c, CHILD(ch, 2));\n                    if (!annotation)\n                        goto error;\n                }\n                else {\n                    annotation = NULL;\n                }\n                ch = CHILD(ch, 0);\n                argname = NEW_IDENTIFIER(ch);\n                if (!argname)\n                    goto error;\n                if (forbidden_name(c, argname, ch, 0))\n                    goto error;\n                arg = arg(argname, annotation, NULL, LINENO(ch), ch->n_col_offset,\n                          c->c_arena);\n                if (!arg)\n                    goto error;\n                asdl_seq_SET(kwonlyargs, j++, arg);\n                i += 1; /* the name */\n                if (i < NCH(n) && TYPE(CHILD(n, i)) == COMMA)\n                    i += 1; /* the comma, if present */\n                break;\n            case TYPE_COMMENT:\n                /* arg will be equal to the last argument processed */\n                arg->type_comment = NEW_TYPE_COMMENT(ch);\n                if (!arg->type_comment)\n                    goto error;\n                i += 1;\n                break;\n            case DOUBLESTAR:\n                return i;\n            default:\n                ast_error(c, ch, \"unexpected node\");\n                goto error;\n        }\n    }\n    return i;\n error:\n    return -1;\n}\n\n/* Create AST for argument list. */\n\nstatic arguments_ty\nast_for_arguments(struct compiling *c, const node *n)\n{\n    /* This function handles both typedargslist (function definition)\n       and varargslist (lambda definition).\n\n       parameters: '(' [typedargslist] ')'\n       typedargslist: (tfpdef ['=' test] (',' tfpdef ['=' test])* [',' [\n               '*' [tfpdef] (',' tfpdef ['=' test])* [',' ['**' tfpdef [',']]]\n             | '**' tfpdef [',']]]\n         | '*' [tfpdef] (',' tfpdef ['=' test])* [',' ['**' tfpdef [',']]]\n         | '**' tfpdef [','])\n       tfpdef: NAME [':' test]\n       varargslist: (vfpdef ['=' test] (',' vfpdef ['=' test])* [',' [\n               '*' [vfpdef] (',' vfpdef ['=' test])* [',' ['**' vfpdef [',']]]\n             | '**' vfpdef [',']]]\n         | '*' [vfpdef] (',' vfpdef ['=' test])* [',' ['**' vfpdef [',']]]\n         | '**' vfpdef [',']\n       )\n       vfpdef: NAME\n\n    */\n    int i, j, k, nposargs = 0, nkwonlyargs = 0;\n    int nposdefaults = 0, found_default = 0;\n    asdl_seq *posargs, *posdefaults, *kwonlyargs, *kwdefaults;\n    arg_ty vararg = NULL, kwarg = NULL;\n    arg_ty arg = NULL;\n    node *ch;\n\n    if (TYPE(n) == parameters) {\n        if (NCH(n) == 2) /* () as argument list */\n            return arguments(NULL, NULL, NULL, NULL, NULL, NULL, c->c_arena);\n        n = CHILD(n, 1);\n    }\n    assert(TYPE(n) == typedargslist || TYPE(n) == varargslist);\n\n    /* First count the number of positional args & defaults.  The\n       variable i is the loop index for this for loop and the next.\n       The next loop picks up where the first leaves off.\n    */\n    for (i = 0; i < NCH(n); i++) {\n        ch = CHILD(n, i);\n        if (TYPE(ch) == STAR) {\n            /* skip star */\n            i++;\n            if (i < NCH(n) && /* skip argument following star */\n                (TYPE(CHILD(n, i)) == tfpdef ||\n                 TYPE(CHILD(n, i)) == vfpdef)) {\n                i++;\n            }\n            break;\n        }\n        if (TYPE(ch) == DOUBLESTAR) break;\n        if (TYPE(ch) == vfpdef || TYPE(ch) == tfpdef) nposargs++;\n        if (TYPE(ch) == EQUAL) nposdefaults++;\n    }\n    /* count the number of keyword only args &\n       defaults for keyword only args */\n    for ( ; i < NCH(n); ++i) {\n        ch = CHILD(n, i);\n        if (TYPE(ch) == DOUBLESTAR) break;\n        if (TYPE(ch) == tfpdef || TYPE(ch) == vfpdef) nkwonlyargs++;\n    }\n    posargs = (nposargs ? _Ta3_asdl_seq_new(nposargs, c->c_arena) : NULL);\n    if (!posargs && nposargs)\n        return NULL;\n    kwonlyargs = (nkwonlyargs ?\n                   _Ta3_asdl_seq_new(nkwonlyargs, c->c_arena) : NULL);\n    if (!kwonlyargs && nkwonlyargs)\n        return NULL;\n    posdefaults = (nposdefaults ?\n                    _Ta3_asdl_seq_new(nposdefaults, c->c_arena) : NULL);\n    if (!posdefaults && nposdefaults)\n        return NULL;\n    /* The length of kwonlyargs and kwdefaults are same\n       since we set NULL as default for keyword only argument w/o default\n       - we have sequence data structure, but no dictionary */\n    kwdefaults = (nkwonlyargs ?\n                   _Ta3_asdl_seq_new(nkwonlyargs, c->c_arena) : NULL);\n    if (!kwdefaults && nkwonlyargs)\n        return NULL;\n\n    /* tfpdef: NAME [':' test]\n       vfpdef: NAME\n    */\n    i = 0;\n    j = 0;  /* index for defaults */\n    k = 0;  /* index for args */\n    while (i < NCH(n)) {\n        ch = CHILD(n, i);\n        switch (TYPE(ch)) {\n            case tfpdef:\n            case vfpdef:\n                /* XXX Need to worry about checking if TYPE(CHILD(n, i+1)) is\n                   anything other than EQUAL or a comma? */\n                /* XXX Should NCH(n) check be made a separate check? */\n                if (i + 1 < NCH(n) && TYPE(CHILD(n, i + 1)) == EQUAL) {\n                    expr_ty expression = ast_for_expr(c, CHILD(n, i + 2));\n                    if (!expression)\n                        return NULL;\n                    assert(posdefaults != NULL);\n                    asdl_seq_SET(posdefaults, j++, expression);\n                    i += 2;\n                    found_default = 1;\n                }\n                else if (found_default) {\n                    ast_error(c, n,\n                             \"non-default argument follows default argument\");\n                    return NULL;\n                }\n                arg = ast_for_arg(c, ch);\n                if (!arg)\n                    return NULL;\n                asdl_seq_SET(posargs, k++, arg);\n                i += 1; /* the name */\n                if (i < NCH(n) && TYPE(CHILD(n, i)) == COMMA)\n                    i += 1; /* the comma, if present */\n                break;\n            case STAR:\n                if (i+1 >= NCH(n) ||\n                    (i+2 == NCH(n) && (TYPE(CHILD(n, i+1)) == COMMA\n                                       || TYPE(CHILD(n, i+1)) == TYPE_COMMENT))) {\n                    ast_error(c, CHILD(n, i),\n                        \"named arguments must follow bare *\");\n                    return NULL;\n                }\n                ch = CHILD(n, i+1);  /* tfpdef or COMMA */\n                if (TYPE(ch) == COMMA) {\n                    int res = 0;\n                    i += 2; /* now follows keyword only arguments */\n\n                    if (i < NCH(n) && TYPE(CHILD(n, i)) == TYPE_COMMENT) {\n                        ast_error(c, CHILD(n, i),\n                                \"bare * has associated type comment\");\n                        return NULL;\n                    }\n\n                    res = handle_keywordonly_args(c, n, i,\n                                                  kwonlyargs, kwdefaults);\n                    if (res == -1) return NULL;\n                    i = res; /* res has new position to process */\n                }\n                else {\n                    vararg = ast_for_arg(c, ch);\n                    if (!vararg)\n                        return NULL;\n\n                    i += 2; /* the star and the name */\n                    if (i < NCH(n) && TYPE(CHILD(n, i)) == COMMA)\n                        i += 1; /* the comma, if present */\n\n                    if (i < NCH(n) && TYPE(CHILD(n, i)) == TYPE_COMMENT) {\n                        vararg->type_comment = NEW_TYPE_COMMENT(CHILD(n, i));\n                        if (!vararg->type_comment)\n                            return NULL;\n                        i += 1;\n                    }\n\n                    if (i < NCH(n) && (TYPE(CHILD(n, i)) == tfpdef\n                                    || TYPE(CHILD(n, i)) == vfpdef)) {\n                        int res = 0;\n                        res = handle_keywordonly_args(c, n, i,\n                                                      kwonlyargs, kwdefaults);\n                        if (res == -1) return NULL;\n                        i = res; /* res has new position to process */\n                    }\n                }\n                break;\n            case DOUBLESTAR:\n                ch = CHILD(n, i+1);  /* tfpdef */\n                assert(TYPE(ch) == tfpdef || TYPE(ch) == vfpdef);\n                kwarg = ast_for_arg(c, ch);\n                if (!kwarg)\n                    return NULL;\n                i += 2; /* the double star and the name */\n                if (i < NCH(n) && TYPE(CHILD(n, i)) == COMMA)\n                    i += 1; /* the comma, if present */\n                break;\n            case TYPE_COMMENT:\n                assert(i);\n\n                if (kwarg)\n                    arg = kwarg;\n\n                /* arg will be equal to the last argument processed */\n                arg->type_comment = NEW_TYPE_COMMENT(ch);\n                if (!arg->type_comment)\n                    return NULL;\n                i += 1;\n                break;\n            default:\n                PyErr_Format(PyExc_SystemError,\n                             \"unexpected node in varargslist: %d @ %d\",\n                             TYPE(ch), i);\n                return NULL;\n        }\n    }\n    return arguments(posargs, vararg, kwonlyargs, kwdefaults, kwarg, posdefaults, c->c_arena);\n}\n\nstatic expr_ty\nast_for_dotted_name(struct compiling *c, const node *n)\n{\n    expr_ty e;\n    identifier id;\n    int lineno, col_offset;\n    int i;\n\n    REQ(n, dotted_name);\n\n    lineno = LINENO(n);\n    col_offset = n->n_col_offset;\n\n    id = NEW_IDENTIFIER(CHILD(n, 0));\n    if (!id)\n        return NULL;\n    e = Name(id, Load, lineno, col_offset, c->c_arena);\n    if (!e)\n        return NULL;\n\n    for (i = 2; i < NCH(n); i+=2) {\n        id = NEW_IDENTIFIER(CHILD(n, i));\n        if (!id)\n            return NULL;\n        e = Attribute(e, id, Load, lineno, col_offset, c->c_arena);\n        if (!e)\n            return NULL;\n    }\n\n    return e;\n}\n\nstatic expr_ty\nast_for_decorator(struct compiling *c, const node *n)\n{\n    /* decorator: '@' dotted_name [ '(' [arglist] ')' ] NEWLINE */\n    expr_ty d = NULL;\n    expr_ty name_expr;\n\n    REQ(n, decorator);\n    REQ(CHILD(n, 0), AT);\n    REQ(RCHILD(n, -1), NEWLINE);\n\n    name_expr = ast_for_dotted_name(c, CHILD(n, 1));\n    if (!name_expr)\n        return NULL;\n\n    if (NCH(n) == 3) { /* No arguments */\n        d = name_expr;\n        name_expr = NULL;\n    }\n    else if (NCH(n) == 5) { /* Call with no arguments */\n        d = Call(name_expr, NULL, NULL, LINENO(n),\n                 n->n_col_offset, c->c_arena);\n        if (!d)\n            return NULL;\n        name_expr = NULL;\n    }\n    else {\n        d = ast_for_call(c, CHILD(n, 3), name_expr, true);\n        if (!d)\n            return NULL;\n        name_expr = NULL;\n    }\n\n    return d;\n}\n\nstatic asdl_seq*\nast_for_decorators(struct compiling *c, const node *n)\n{\n    asdl_seq* decorator_seq;\n    expr_ty d;\n    int i;\n\n    REQ(n, decorators);\n    decorator_seq = _Ta3_asdl_seq_new(NCH(n), c->c_arena);\n    if (!decorator_seq)\n        return NULL;\n\n    for (i = 0; i < NCH(n); i++) {\n        d = ast_for_decorator(c, CHILD(n, i));\n        if (!d)\n            return NULL;\n        asdl_seq_SET(decorator_seq, i, d);\n    }\n    return decorator_seq;\n}\n\nstatic stmt_ty\nast_for_funcdef_impl(struct compiling *c, const node *n0,\n                     asdl_seq *decorator_seq, bool is_async)\n{\n    /* funcdef: 'def' NAME parameters ['->' test] ':' [TYPE_COMMENT] suite */\n    const node * const n = is_async ? CHILD(n0, 1) : n0;\n    identifier name;\n    arguments_ty args;\n    asdl_seq *body;\n    expr_ty returns = NULL;\n    int name_i = 1;\n    node *tc;\n    string type_comment = NULL;\n\n    if (is_async && c->c_feature_version < 5) {\n        ast_error(c, n,\n                  \"Async functions are only supported in Python 3.5 and greater\");\n        return NULL;\n    }\n\n    REQ(n, funcdef);\n\n    name = NEW_IDENTIFIER(CHILD(n, name_i));\n    if (!name)\n        return NULL;\n    if (forbidden_name(c, name, CHILD(n, name_i), 0))\n        return NULL;\n    args = ast_for_arguments(c, CHILD(n, name_i + 1));\n    if (!args)\n        return NULL;\n    if (TYPE(CHILD(n, name_i+2)) == RARROW) {\n        returns = ast_for_expr(c, CHILD(n, name_i + 3));\n        if (!returns)\n            return NULL;\n        name_i += 2;\n    }\n    if (TYPE(CHILD(n, name_i + 3)) == TYPE_COMMENT) {\n        type_comment = NEW_TYPE_COMMENT(CHILD(n, name_i + 3));\n        if (!type_comment)\n            return NULL;\n        name_i += 1;\n    }\n    body = ast_for_suite(c, CHILD(n, name_i + 3));\n    if (!body)\n        return NULL;\n\n    if (NCH(CHILD(n, name_i + 3)) > 1) {\n        /* Check if the suite has a type comment in it. */\n        tc = CHILD(CHILD(n, name_i + 3), 1);\n\n        if (TYPE(tc) == TYPE_COMMENT) {\n            if (type_comment != NULL) {\n                ast_error(c, n, \"Cannot have two type comments on def\");\n                return NULL;\n            }\n            type_comment = NEW_TYPE_COMMENT(tc);\n            if (!type_comment)\n                return NULL;\n        }\n    }\n\n    if (is_async)\n        return AsyncFunctionDef(name, args, body, decorator_seq, returns,\n                                type_comment, LINENO(n0), n0->n_col_offset, c->c_arena);\n    else\n        return FunctionDef(name, args, body, decorator_seq, returns,\n                           type_comment, LINENO(n), n->n_col_offset, c->c_arena);\n}\n\nstatic stmt_ty\nast_for_async_funcdef(struct compiling *c, const node *n, asdl_seq *decorator_seq)\n{\n    /* async_funcdef: 'async' funcdef */\n    REQ(n, async_funcdef);\n    REQ(CHILD(n, 0), ASYNC);\n    REQ(CHILD(n, 1), funcdef);\n\n    return ast_for_funcdef_impl(c, n, decorator_seq,\n                                true /* is_async */);\n}\n\nstatic stmt_ty\nast_for_funcdef(struct compiling *c, const node *n, asdl_seq *decorator_seq)\n{\n    /* funcdef: 'def' NAME parameters ['->' test] ':' suite */\n    return ast_for_funcdef_impl(c, n, decorator_seq,\n                                false /* is_async */);\n}\n\n\nstatic stmt_ty\nast_for_async_stmt(struct compiling *c, const node *n)\n{\n    /* async_stmt: 'async' (funcdef | with_stmt | for_stmt) */\n    REQ(n, async_stmt);\n    REQ(CHILD(n, 0), ASYNC);\n\n    switch (TYPE(CHILD(n, 1))) {\n        case funcdef:\n            return ast_for_funcdef_impl(c, n, NULL,\n                                        true /* is_async */);\n        case with_stmt:\n            return ast_for_with_stmt(c, n,\n                                     true /* is_async */);\n\n        case for_stmt:\n            return ast_for_for_stmt(c, n,\n                                    true /* is_async */);\n\n        default:\n            PyErr_Format(PyExc_SystemError,\n                         \"invalid async stament: %s\",\n                         STR(CHILD(n, 1)));\n            return NULL;\n    }\n}\n\nstatic stmt_ty\nast_for_decorated(struct compiling *c, const node *n)\n{\n    /* decorated: decorators (classdef | funcdef | async_funcdef) */\n    stmt_ty thing = NULL;\n    asdl_seq *decorator_seq = NULL;\n\n    REQ(n, decorated);\n\n    decorator_seq = ast_for_decorators(c, CHILD(n, 0));\n    if (!decorator_seq)\n      return NULL;\n\n    assert(TYPE(CHILD(n, 1)) == funcdef ||\n           TYPE(CHILD(n, 1)) == async_funcdef ||\n           TYPE(CHILD(n, 1)) == classdef);\n\n    if (TYPE(CHILD(n, 1)) == funcdef) {\n      thing = ast_for_funcdef(c, CHILD(n, 1), decorator_seq);\n    } else if (TYPE(CHILD(n, 1)) == classdef) {\n      thing = ast_for_classdef(c, CHILD(n, 1), decorator_seq);\n    } else if (TYPE(CHILD(n, 1)) == async_funcdef) {\n      thing = ast_for_async_funcdef(c, CHILD(n, 1), decorator_seq);\n    }\n    /* we count the decorators in when talking about the class' or\n     * function's line number */\n    if (thing) {\n        thing->lineno = LINENO(n);\n        thing->col_offset = n->n_col_offset;\n    }\n    return thing;\n}\n\nstatic expr_ty\nast_for_lambdef(struct compiling *c, const node *n)\n{\n    /* lambdef: 'lambda' [varargslist] ':' test\n       lambdef_nocond: 'lambda' [varargslist] ':' test_nocond */\n    arguments_ty args;\n    expr_ty expression;\n\n    if (NCH(n) == 3) {\n        args = arguments(NULL, NULL, NULL, NULL, NULL, NULL, c->c_arena);\n        if (!args)\n            return NULL;\n        expression = ast_for_expr(c, CHILD(n, 2));\n        if (!expression)\n            return NULL;\n    }\n    else {\n        args = ast_for_arguments(c, CHILD(n, 1));\n        if (!args)\n            return NULL;\n        expression = ast_for_expr(c, CHILD(n, 3));\n        if (!expression)\n            return NULL;\n    }\n\n    return Lambda(args, expression, LINENO(n), n->n_col_offset, c->c_arena);\n}\n\nstatic expr_ty\nast_for_ifexpr(struct compiling *c, const node *n)\n{\n    /* test: or_test 'if' or_test 'else' test */\n    expr_ty expression, body, orelse;\n\n    assert(NCH(n) == 5);\n    body = ast_for_expr(c, CHILD(n, 0));\n    if (!body)\n        return NULL;\n    expression = ast_for_expr(c, CHILD(n, 2));\n    if (!expression)\n        return NULL;\n    orelse = ast_for_expr(c, CHILD(n, 4));\n    if (!orelse)\n        return NULL;\n    return IfExp(expression, body, orelse, LINENO(n), n->n_col_offset,\n                 c->c_arena);\n}\n\n/*\n   Count the number of 'for' loops in a comprehension.\n\n   Helper for ast_for_comprehension().\n*/\n\nstatic int\ncount_comp_fors(struct compiling *c, const node *n)\n{\n    int n_fors = 0;\n\n  count_comp_for:\n    n_fors++;\n    REQ(n, comp_for);\n    if (NCH(n) == 2) {\n        REQ(CHILD(n, 0), ASYNC);\n        n = CHILD(n, 1);\n    }\n    else if (NCH(n) == 1) {\n        n = CHILD(n, 0);\n    }\n    else {\n        goto error;\n    }\n    if (NCH(n) == (5)) {\n        n = CHILD(n, 4);\n    }\n    else {\n        return n_fors;\n    }\n  count_comp_iter:\n    REQ(n, comp_iter);\n    n = CHILD(n, 0);\n    if (TYPE(n) == comp_for)\n        goto count_comp_for;\n    else if (TYPE(n) == comp_if) {\n        if (NCH(n) == 3) {\n            n = CHILD(n, 2);\n            goto count_comp_iter;\n        }\n        else\n            return n_fors;\n    }\n\n  error:\n    /* Should never be reached */\n    PyErr_SetString(PyExc_SystemError,\n                    \"logic error in count_comp_fors\");\n    return -1;\n}\n\n/* Count the number of 'if' statements in a comprehension.\n\n   Helper for ast_for_comprehension().\n*/\n\nstatic int\ncount_comp_ifs(struct compiling *c, const node *n)\n{\n    int n_ifs = 0;\n\n    while (1) {\n        REQ(n, comp_iter);\n        if (TYPE(CHILD(n, 0)) == comp_for)\n            return n_ifs;\n        n = CHILD(n, 0);\n        REQ(n, comp_if);\n        n_ifs++;\n        if (NCH(n) == 2)\n            return n_ifs;\n        n = CHILD(n, 2);\n    }\n}\n\nstatic asdl_seq *\nast_for_comprehension(struct compiling *c, const node *n)\n{\n    int i, n_fors;\n    asdl_seq *comps;\n\n    n_fors = count_comp_fors(c, n);\n    if (n_fors == -1)\n        return NULL;\n\n    comps = _Ta3_asdl_seq_new(n_fors, c->c_arena);\n    if (!comps)\n        return NULL;\n\n    for (i = 0; i < n_fors; i++) {\n        comprehension_ty comp;\n        asdl_seq *t;\n        expr_ty expression, first;\n        node *for_ch;\n        node *sync_n;\n        int is_async = 0;\n\n        REQ(n, comp_for);\n\n        if (NCH(n) == 2) {\n            is_async = 1;\n            REQ(CHILD(n, 0), ASYNC);\n            sync_n = CHILD(n, 1);\n        }\n        else {\n            sync_n = CHILD(n, 0);\n        }\n        REQ(sync_n, sync_comp_for);\n\n        /* Async comprehensions only allowed in Python 3.6 and greater */\n        if (is_async && c->c_feature_version < 6) {\n            ast_error(c, n,\n                    \"Async comprehensions are only supported in Python 3.6 and greater\");\n            return NULL;\n        }\n\n        for_ch = CHILD(sync_n, 1);\n        t = ast_for_exprlist(c, for_ch, Store);\n        if (!t)\n            return NULL;\n        expression = ast_for_expr(c, CHILD(sync_n, 3));\n        if (!expression)\n            return NULL;\n\n        /* Check the # of children rather than the length of t, since\n           (x for x, in ...) has 1 element in t, but still requires a Tuple. */\n        first = (expr_ty)asdl_seq_GET(t, 0);\n        if (NCH(for_ch) == 1)\n            comp = comprehension(first, expression, NULL,\n                                 is_async, c->c_arena);\n        else\n            comp = comprehension(Tuple(t, Store, first->lineno,\n                                       first->col_offset, c->c_arena),\n                                 expression, NULL, is_async, c->c_arena);\n        if (!comp)\n            return NULL;\n\n        if (NCH(sync_n) == 5) {\n            int j, n_ifs;\n            asdl_seq *ifs;\n\n            n = CHILD(sync_n, 4);\n            n_ifs = count_comp_ifs(c, n);\n            if (n_ifs == -1)\n                return NULL;\n\n            ifs = _Ta3_asdl_seq_new(n_ifs, c->c_arena);\n            if (!ifs)\n                return NULL;\n\n            for (j = 0; j < n_ifs; j++) {\n                REQ(n, comp_iter);\n                n = CHILD(n, 0);\n                REQ(n, comp_if);\n\n                expression = ast_for_expr(c, CHILD(n, 1));\n                if (!expression)\n                    return NULL;\n                asdl_seq_SET(ifs, j, expression);\n                if (NCH(n) == 3)\n                    n = CHILD(n, 2);\n            }\n            /* on exit, must guarantee that n is a comp_for */\n            if (TYPE(n) == comp_iter)\n                n = CHILD(n, 0);\n            comp->ifs = ifs;\n        }\n        asdl_seq_SET(comps, i, comp);\n    }\n    return comps;\n}\n\nstatic expr_ty\nast_for_itercomp(struct compiling *c, const node *n, int type)\n{\n    /* testlist_comp: (test|star_expr)\n     *                ( comp_for | (',' (test|star_expr))* [','] ) */\n    expr_ty elt;\n    asdl_seq *comps;\n    node *ch;\n\n    assert(NCH(n) > 1);\n\n    ch = CHILD(n, 0);\n    elt = ast_for_expr(c, ch);\n    if (!elt)\n        return NULL;\n    if (elt->kind == Starred_kind) {\n        ast_error(c, ch, \"iterable unpacking cannot be used in comprehension\");\n        return NULL;\n    }\n\n    comps = ast_for_comprehension(c, CHILD(n, 1));\n    if (!comps)\n        return NULL;\n\n    if (type == COMP_GENEXP)\n        return GeneratorExp(elt, comps, LINENO(n), n->n_col_offset, c->c_arena);\n    else if (type == COMP_LISTCOMP)\n        return ListComp(elt, comps, LINENO(n), n->n_col_offset, c->c_arena);\n    else if (type == COMP_SETCOMP)\n        return SetComp(elt, comps, LINENO(n), n->n_col_offset, c->c_arena);\n    else\n        /* Should never happen */\n        return NULL;\n}\n\n/* Fills in the key, value pair corresponding to the dict element.  In case\n * of an unpacking, key is NULL.  *i is advanced by the number of ast\n * elements.  Iff successful, nonzero is returned.\n */\nstatic int\nast_for_dictelement(struct compiling *c, const node *n, int *i,\n                    expr_ty *key, expr_ty *value)\n{\n    expr_ty expression;\n    if (TYPE(CHILD(n, *i)) == DOUBLESTAR) {\n        assert(NCH(n) - *i >= 2);\n\n        expression = ast_for_expr(c, CHILD(n, *i + 1));\n        if (!expression)\n            return 0;\n        *key = NULL;\n        *value = expression;\n\n        *i += 2;\n    }\n    else {\n        assert(NCH(n) - *i >= 3);\n\n        expression = ast_for_expr(c, CHILD(n, *i));\n        if (!expression)\n            return 0;\n        *key = expression;\n\n        REQ(CHILD(n, *i + 1), COLON);\n\n        expression = ast_for_expr(c, CHILD(n, *i + 2));\n        if (!expression)\n            return 0;\n        *value = expression;\n\n        *i += 3;\n    }\n    return 1;\n}\n\nstatic expr_ty\nast_for_dictcomp(struct compiling *c, const node *n)\n{\n    expr_ty key, value;\n    asdl_seq *comps;\n    int i = 0;\n\n    if (!ast_for_dictelement(c, n, &i, &key, &value))\n        return NULL;\n    assert(key);\n    assert(NCH(n) - i >= 1);\n\n    comps = ast_for_comprehension(c, CHILD(n, i));\n    if (!comps)\n        return NULL;\n\n    return DictComp(key, value, comps, LINENO(n), n->n_col_offset, c->c_arena);\n}\n\nstatic expr_ty\nast_for_dictdisplay(struct compiling *c, const node *n)\n{\n    int i;\n    int j;\n    int size;\n    asdl_seq *keys, *values;\n\n    size = (NCH(n) + 1) / 3; /* +1 in case no trailing comma */\n    keys = _Ta3_asdl_seq_new(size, c->c_arena);\n    if (!keys)\n        return NULL;\n\n    values = _Ta3_asdl_seq_new(size, c->c_arena);\n    if (!values)\n        return NULL;\n\n    j = 0;\n    for (i = 0; i < NCH(n); i++) {\n        expr_ty key, value;\n\n        if (!ast_for_dictelement(c, n, &i, &key, &value))\n            return NULL;\n        asdl_seq_SET(keys, j, key);\n        asdl_seq_SET(values, j, value);\n\n        j++;\n    }\n    keys->size = j;\n    values->size = j;\n    return Dict(keys, values, LINENO(n), n->n_col_offset, c->c_arena);\n}\n\nstatic expr_ty\nast_for_genexp(struct compiling *c, const node *n)\n{\n    assert(TYPE(n) == (testlist_comp) || TYPE(n) == (argument));\n    return ast_for_itercomp(c, n, COMP_GENEXP);\n}\n\nstatic expr_ty\nast_for_listcomp(struct compiling *c, const node *n)\n{\n    assert(TYPE(n) == (testlist_comp));\n    return ast_for_itercomp(c, n, COMP_LISTCOMP);\n}\n\nstatic expr_ty\nast_for_setcomp(struct compiling *c, const node *n)\n{\n    assert(TYPE(n) == (dictorsetmaker));\n    return ast_for_itercomp(c, n, COMP_SETCOMP);\n}\n\nstatic expr_ty\nast_for_setdisplay(struct compiling *c, const node *n)\n{\n    int i;\n    int size;\n    asdl_seq *elts;\n\n    assert(TYPE(n) == (dictorsetmaker));\n    size = (NCH(n) + 1) / 2; /* +1 in case no trailing comma */\n    elts = _Ta3_asdl_seq_new(size, c->c_arena);\n    if (!elts)\n        return NULL;\n    for (i = 0; i < NCH(n); i += 2) {\n        expr_ty expression;\n        expression = ast_for_expr(c, CHILD(n, i));\n        if (!expression)\n            return NULL;\n        asdl_seq_SET(elts, i / 2, expression);\n    }\n    return Set(elts, LINENO(n), n->n_col_offset, c->c_arena);\n}\n\nstatic expr_ty\nast_for_atom(struct compiling *c, const node *n)\n{\n    /* atom: '(' [yield_expr|testlist_comp] ')' | '[' [testlist_comp] ']'\n       | '{' [dictmaker|testlist_comp] '}' | NAME | NUMBER | STRING+\n       | '...' | 'None' | 'True' | 'False'\n    */\n    node *ch = CHILD(n, 0);\n\n    switch (TYPE(ch)) {\n    case NAME: {\n        PyObject *name;\n        const char *s = STR(ch);\n        size_t len = strlen(s);\n        if (len >= 4 && len <= 5) {\n            if (!strcmp(s, \"None\"))\n                return NameConstant(Py_None, LINENO(n), n->n_col_offset, c->c_arena);\n            if (!strcmp(s, \"True\"))\n                return NameConstant(Py_True, LINENO(n), n->n_col_offset, c->c_arena);\n            if (!strcmp(s, \"False\"))\n                return NameConstant(Py_False, LINENO(n), n->n_col_offset, c->c_arena);\n        }\n        name = new_identifier(s, c);\n        if (!name)\n            return NULL;\n        /* All names start in Load context, but may later be changed. */\n        return Name(name, Load, LINENO(n), n->n_col_offset, c->c_arena);\n    }\n    case STRING: {\n        expr_ty str = parsestrplus(c, n);\n        if (!str) {\n            const char *errtype = NULL;\n            if (PyErr_ExceptionMatches(PyExc_UnicodeError))\n                errtype = \"unicode error\";\n            else if (PyErr_ExceptionMatches(PyExc_ValueError))\n                errtype = \"value error\";\n            if (errtype) {\n                char buf[128];\n                const char *s = NULL;\n                PyObject *type, *value, *tback, *errstr;\n                PyErr_Fetch(&type, &value, &tback);\n                errstr = PyObject_Str(value);\n                if (errstr)\n                    s = PyUnicode_AsUTF8(errstr);\n                if (s) {\n                    PyOS_snprintf(buf, sizeof(buf), \"(%s) %s\", errtype, s);\n                } else {\n                    PyErr_Clear();\n                    PyOS_snprintf(buf, sizeof(buf), \"(%s) unknown error\", errtype);\n                }\n                Py_XDECREF(errstr);\n                ast_error(c, n, buf);\n                Py_DECREF(type);\n                Py_XDECREF(value);\n                Py_XDECREF(tback);\n            }\n            return NULL;\n        }\n        return str;\n    }\n    case NUMBER: {\n        PyObject *pynum;\n        const char *s = STR(ch);\n        /* Underscores in numeric literals are only allowed in Python 3.6 or greater */\n        /* Check for underscores here rather than in parse_number so we can report a line number on error */\n        if (c->c_feature_version < 6 && strchr(s, '_') != NULL) {\n            ast_error(c, ch,\n                    \"Underscores in numeric literals are only supported in Python 3.6 and greater\");\n            return NULL;\n        }\n        pynum = parsenumber(c, STR(ch));\n        if (!pynum)\n            return NULL;\n\n        if (PyArena_AddPyObject(c->c_arena, pynum) < 0) {\n            Py_DECREF(pynum);\n            return NULL;\n        }\n        return Num(pynum, LINENO(n), n->n_col_offset, c->c_arena);\n    }\n    case ELLIPSIS: /* Ellipsis */\n        return Ellipsis(LINENO(n), n->n_col_offset, c->c_arena);\n    case LPAR: /* some parenthesized expressions */\n        ch = CHILD(n, 1);\n\n        if (TYPE(ch) == RPAR)\n            return Tuple(NULL, Load, LINENO(n), n->n_col_offset, c->c_arena);\n\n        if (TYPE(ch) == yield_expr)\n            return ast_for_expr(c, ch);\n\n        /* testlist_comp: test ( comp_for | (',' test)* [','] ) */\n        if ((NCH(ch) > 1) && (TYPE(CHILD(ch, 1)) == comp_for))\n            return ast_for_genexp(c, ch);\n\n        return ast_for_testlist(c, ch);\n    case LSQB: /* list (or list comprehension) */\n        ch = CHILD(n, 1);\n\n        if (TYPE(ch) == RSQB)\n            return List(NULL, Load, LINENO(n), n->n_col_offset, c->c_arena);\n\n        REQ(ch, testlist_comp);\n        if (NCH(ch) == 1 || TYPE(CHILD(ch, 1)) == COMMA) {\n            asdl_seq *elts = seq_for_testlist(c, ch);\n            if (!elts)\n                return NULL;\n\n            return List(elts, Load, LINENO(n), n->n_col_offset, c->c_arena);\n        }\n        else\n            return ast_for_listcomp(c, ch);\n    case LBRACE: {\n        /* dictorsetmaker: ( ((test ':' test | '**' test)\n         *                    (comp_for | (',' (test ':' test | '**' test))* [','])) |\n         *                   ((test | '*' test)\n         *                    (comp_for | (',' (test | '*' test))* [','])) ) */\n        expr_ty res;\n        ch = CHILD(n, 1);\n        if (TYPE(ch) == RBRACE) {\n            /* It's an empty dict. */\n            return Dict(NULL, NULL, LINENO(n), n->n_col_offset, c->c_arena);\n        }\n        else {\n            int is_dict = (TYPE(CHILD(ch, 0)) == DOUBLESTAR);\n            if (NCH(ch) == 1 ||\n                    (NCH(ch) > 1 &&\n                     TYPE(CHILD(ch, 1)) == COMMA)) {\n                /* It's a set display. */\n                res = ast_for_setdisplay(c, ch);\n            }\n            else if (NCH(ch) > 1 &&\n                    TYPE(CHILD(ch, 1)) == comp_for) {\n                /* It's a set comprehension. */\n                res = ast_for_setcomp(c, ch);\n            }\n            else if (NCH(ch) > 3 - is_dict &&\n                    TYPE(CHILD(ch, 3 - is_dict)) == comp_for) {\n                /* It's a dictionary comprehension. */\n                if (is_dict) {\n                    ast_error(c, n, \"dict unpacking cannot be used in \"\n                            \"dict comprehension\");\n                    return NULL;\n                }\n                res = ast_for_dictcomp(c, ch);\n            }\n            else {\n                /* It's a dictionary display. */\n                res = ast_for_dictdisplay(c, ch);\n            }\n            if (res) {\n                res->lineno = LINENO(n);\n                res->col_offset = n->n_col_offset;\n            }\n            return res;\n        }\n    }\n    default:\n        PyErr_Format(PyExc_SystemError, \"unhandled atom %d\", TYPE(ch));\n        return NULL;\n    }\n}\n\nstatic slice_ty\nast_for_slice(struct compiling *c, const node *n)\n{\n    node *ch;\n    expr_ty lower = NULL, upper = NULL, step = NULL;\n\n    REQ(n, subscript);\n\n    /*\n       subscript: test | [test] ':' [test] [sliceop]\n       sliceop: ':' [test]\n    */\n    ch = CHILD(n, 0);\n    if (NCH(n) == 1 && TYPE(ch) == test) {\n        /* 'step' variable hold no significance in terms of being used over\n           other vars */\n        step = ast_for_expr(c, ch);\n        if (!step)\n            return NULL;\n\n        return Index(step, c->c_arena);\n    }\n\n    if (TYPE(ch) == test) {\n        lower = ast_for_expr(c, ch);\n        if (!lower)\n            return NULL;\n    }\n\n    /* If there's an upper bound it's in the second or third position. */\n    if (TYPE(ch) == COLON) {\n        if (NCH(n) > 1) {\n            node *n2 = CHILD(n, 1);\n\n            if (TYPE(n2) == test) {\n                upper = ast_for_expr(c, n2);\n                if (!upper)\n                    return NULL;\n            }\n        }\n    } else if (NCH(n) > 2) {\n        node *n2 = CHILD(n, 2);\n\n        if (TYPE(n2) == test) {\n            upper = ast_for_expr(c, n2);\n            if (!upper)\n                return NULL;\n        }\n    }\n\n    ch = CHILD(n, NCH(n) - 1);\n    if (TYPE(ch) == sliceop) {\n        if (NCH(ch) != 1) {\n            ch = CHILD(ch, 1);\n            if (TYPE(ch) == test) {\n                step = ast_for_expr(c, ch);\n                if (!step)\n                    return NULL;\n            }\n        }\n    }\n\n    return Slice(lower, upper, step, c->c_arena);\n}\n\nstatic expr_ty\nast_for_binop(struct compiling *c, const node *n)\n{\n    /* Must account for a sequence of expressions.\n       How should A op B op C by represented?\n       BinOp(BinOp(A, op, B), op, C).\n    */\n\n    int i, nops;\n    expr_ty expr1, expr2, result;\n    operator_ty newoperator;\n\n    expr1 = ast_for_expr(c, CHILD(n, 0));\n    if (!expr1)\n        return NULL;\n\n    expr2 = ast_for_expr(c, CHILD(n, 2));\n    if (!expr2)\n        return NULL;\n\n    newoperator = get_operator(c, CHILD(n, 1));\n    if (!newoperator)\n        return NULL;\n\n    result = BinOp(expr1, newoperator, expr2, LINENO(n), n->n_col_offset,\n                   c->c_arena);\n    if (!result)\n        return NULL;\n\n    nops = (NCH(n) - 1) / 2;\n    for (i = 1; i < nops; i++) {\n        expr_ty tmp_result, tmp;\n        const node* next_oper = CHILD(n, i * 2 + 1);\n\n        newoperator = get_operator(c, next_oper);\n        if (!newoperator)\n            return NULL;\n\n        tmp = ast_for_expr(c, CHILD(n, i * 2 + 2));\n        if (!tmp)\n            return NULL;\n\n        tmp_result = BinOp(result, newoperator, tmp,\n                           LINENO(next_oper), next_oper->n_col_offset,\n                           c->c_arena);\n        if (!tmp_result)\n            return NULL;\n        result = tmp_result;\n    }\n    return result;\n}\n\nstatic expr_ty\nast_for_trailer(struct compiling *c, const node *n, expr_ty left_expr)\n{\n    /* trailer: '(' [arglist] ')' | '[' subscriptlist ']' | '.' NAME\n       subscriptlist: subscript (',' subscript)* [',']\n       subscript: '.' '.' '.' | test | [test] ':' [test] [sliceop]\n     */\n    REQ(n, trailer);\n    if (TYPE(CHILD(n, 0)) == LPAR) {\n        if (NCH(n) == 2)\n            return Call(left_expr, NULL, NULL, LINENO(n),\n                        n->n_col_offset, c->c_arena);\n        else\n            return ast_for_call(c, CHILD(n, 1), left_expr, true);\n    }\n    else if (TYPE(CHILD(n, 0)) == DOT) {\n        PyObject *attr_id = NEW_IDENTIFIER(CHILD(n, 1));\n        if (!attr_id)\n            return NULL;\n        return Attribute(left_expr, attr_id, Load,\n                         LINENO(n), n->n_col_offset, c->c_arena);\n    }\n    else {\n        REQ(CHILD(n, 0), LSQB);\n        REQ(CHILD(n, 2), RSQB);\n        n = CHILD(n, 1);\n        if (NCH(n) == 1) {\n            slice_ty slc = ast_for_slice(c, CHILD(n, 0));\n            if (!slc)\n                return NULL;\n            return Subscript(left_expr, slc, Load, LINENO(n), n->n_col_offset,\n                             c->c_arena);\n        }\n        else {\n            /* The grammar is ambiguous here. The ambiguity is resolved\n               by treating the sequence as a tuple literal if there are\n               no slice features.\n            */\n            int j;\n            slice_ty slc;\n            expr_ty e;\n            int simple = 1;\n            asdl_seq *slices, *elts;\n            slices = _Ta3_asdl_seq_new((NCH(n) + 1) / 2, c->c_arena);\n            if (!slices)\n                return NULL;\n            for (j = 0; j < NCH(n); j += 2) {\n                slc = ast_for_slice(c, CHILD(n, j));\n                if (!slc)\n                    return NULL;\n                if (slc->kind != Index_kind)\n                    simple = 0;\n                asdl_seq_SET(slices, j / 2, slc);\n            }\n            if (!simple) {\n                return Subscript(left_expr, ExtSlice(slices, c->c_arena),\n                                 Load, LINENO(n), n->n_col_offset, c->c_arena);\n            }\n            /* extract Index values and put them in a Tuple */\n            elts = _Ta3_asdl_seq_new(asdl_seq_LEN(slices), c->c_arena);\n            if (!elts)\n                return NULL;\n            for (j = 0; j < asdl_seq_LEN(slices); ++j) {\n                slc = (slice_ty)asdl_seq_GET(slices, j);\n                assert(slc->kind == Index_kind  && slc->v.Index.value);\n                asdl_seq_SET(elts, j, slc->v.Index.value);\n            }\n            e = Tuple(elts, Load, LINENO(n), n->n_col_offset, c->c_arena);\n            if (!e)\n                return NULL;\n            return Subscript(left_expr, Index(e, c->c_arena),\n                             Load, LINENO(n), n->n_col_offset, c->c_arena);\n        }\n    }\n}\n\nstatic expr_ty\nast_for_factor(struct compiling *c, const node *n)\n{\n    expr_ty expression;\n\n    expression = ast_for_expr(c, CHILD(n, 1));\n    if (!expression)\n        return NULL;\n\n    switch (TYPE(CHILD(n, 0))) {\n        case PLUS:\n            return UnaryOp(UAdd, expression, LINENO(n), n->n_col_offset,\n                           c->c_arena);\n        case MINUS:\n            return UnaryOp(USub, expression, LINENO(n), n->n_col_offset,\n                           c->c_arena);\n        case TILDE:\n            return UnaryOp(Invert, expression, LINENO(n),\n                           n->n_col_offset, c->c_arena);\n    }\n    PyErr_Format(PyExc_SystemError, \"unhandled factor: %d\",\n                 TYPE(CHILD(n, 0)));\n    return NULL;\n}\n\nstatic expr_ty\nast_for_atom_expr(struct compiling *c, const node *n)\n{\n    int i, nch, start = 0;\n    expr_ty e, tmp;\n\n    REQ(n, atom_expr);\n    nch = NCH(n);\n\n    if (TYPE(CHILD(n, 0)) == AWAIT) {\n        if (c->c_feature_version < 5) {\n            ast_error(c, n,\n                    \"Await expressions are only supported in Python 3.5 and greater\");\n            return NULL;\n        }\n        start = 1;\n        assert(nch > 1);\n    }\n\n    e = ast_for_atom(c, CHILD(n, start));\n    if (!e)\n        return NULL;\n    if (nch == 1)\n        return e;\n    if (start && nch == 2) {\n        return Await(e, LINENO(n), n->n_col_offset, c->c_arena);\n    }\n\n    for (i = start + 1; i < nch; i++) {\n        node *ch = CHILD(n, i);\n        if (TYPE(ch) != trailer)\n            break;\n        tmp = ast_for_trailer(c, ch, e);\n        if (!tmp)\n            return NULL;\n        tmp->lineno = e->lineno;\n        tmp->col_offset = e->col_offset;\n        e = tmp;\n    }\n\n    if (start) {\n        /* there was an 'await' */\n        return Await(e, LINENO(n), n->n_col_offset, c->c_arena);\n    }\n    else {\n        return e;\n    }\n}\n\nstatic expr_ty\nast_for_power(struct compiling *c, const node *n)\n{\n    /* power: atom trailer* ('**' factor)*\n     */\n    expr_ty e;\n    REQ(n, power);\n    e = ast_for_atom_expr(c, CHILD(n, 0));\n    if (!e)\n        return NULL;\n    if (NCH(n) == 1)\n        return e;\n    if (TYPE(CHILD(n, NCH(n) - 1)) == factor) {\n        expr_ty f = ast_for_expr(c, CHILD(n, NCH(n) - 1));\n        if (!f)\n            return NULL;\n        e = BinOp(e, Pow, f, LINENO(n), n->n_col_offset, c->c_arena);\n    }\n    return e;\n}\n\nstatic expr_ty\nast_for_starred(struct compiling *c, const node *n)\n{\n    expr_ty tmp;\n    REQ(n, star_expr);\n\n    tmp = ast_for_expr(c, CHILD(n, 1));\n    if (!tmp)\n        return NULL;\n\n    /* The Load context is changed later. */\n    return Starred(tmp, Load, LINENO(n), n->n_col_offset, c->c_arena);\n}\n\n\n/* Do not name a variable 'expr'!  Will cause a compile error.\n*/\n\nstatic expr_ty\nast_for_expr(struct compiling *c, const node *n)\n{\n    /* handle the full range of simple expressions\n       test: or_test ['if' or_test 'else' test] | lambdef\n       test_nocond: or_test | lambdef_nocond\n       or_test: and_test ('or' and_test)*\n       and_test: not_test ('and' not_test)*\n       not_test: 'not' not_test | comparison\n       comparison: expr (comp_op expr)*\n       expr: xor_expr ('|' xor_expr)*\n       xor_expr: and_expr ('^' and_expr)*\n       and_expr: shift_expr ('&' shift_expr)*\n       shift_expr: arith_expr (('<<'|'>>') arith_expr)*\n       arith_expr: term (('+'|'-') term)*\n       term: factor (('*'|'@'|'/'|'%'|'//') factor)*\n       factor: ('+'|'-'|'~') factor | power\n       power: atom_expr ['**' factor]\n       atom_expr: ['await'] atom trailer*\n       yield_expr: 'yield' [yield_arg]\n    */\n\n    asdl_seq *seq;\n    int i;\n\n loop:\n    switch (TYPE(n)) {\n        case test:\n        case test_nocond:\n            if (TYPE(CHILD(n, 0)) == lambdef ||\n                TYPE(CHILD(n, 0)) == lambdef_nocond)\n                return ast_for_lambdef(c, CHILD(n, 0));\n            else if (NCH(n) > 1)\n                return ast_for_ifexpr(c, n);\n            /* Fallthrough */\n        case or_test:\n        case and_test:\n            if (NCH(n) == 1) {\n                n = CHILD(n, 0);\n                goto loop;\n            }\n            seq = _Ta3_asdl_seq_new((NCH(n) + 1) / 2, c->c_arena);\n            if (!seq)\n                return NULL;\n            for (i = 0; i < NCH(n); i += 2) {\n                expr_ty e = ast_for_expr(c, CHILD(n, i));\n                if (!e)\n                    return NULL;\n                asdl_seq_SET(seq, i / 2, e);\n            }\n            if (!strcmp(STR(CHILD(n, 1)), \"and\"))\n                return BoolOp(And, seq, LINENO(n), n->n_col_offset,\n                              c->c_arena);\n            assert(!strcmp(STR(CHILD(n, 1)), \"or\"));\n            return BoolOp(Or, seq, LINENO(n), n->n_col_offset, c->c_arena);\n        case not_test:\n            if (NCH(n) == 1) {\n                n = CHILD(n, 0);\n                goto loop;\n            }\n            else {\n                expr_ty expression = ast_for_expr(c, CHILD(n, 1));\n                if (!expression)\n                    return NULL;\n\n                return UnaryOp(Not, expression, LINENO(n), n->n_col_offset,\n                               c->c_arena);\n            }\n        case comparison:\n            if (NCH(n) == 1) {\n                n = CHILD(n, 0);\n                goto loop;\n            }\n            else {\n                expr_ty expression;\n                asdl_int_seq *ops;\n                asdl_seq *cmps;\n                ops = _Ta3_asdl_int_seq_new(NCH(n) / 2, c->c_arena);\n                if (!ops)\n                    return NULL;\n                cmps = _Ta3_asdl_seq_new(NCH(n) / 2, c->c_arena);\n                if (!cmps) {\n                    return NULL;\n                }\n                for (i = 1; i < NCH(n); i += 2) {\n                    cmpop_ty newoperator;\n\n                    newoperator = ast_for_comp_op(c, CHILD(n, i));\n                    if (!newoperator) {\n                        return NULL;\n                    }\n\n                    expression = ast_for_expr(c, CHILD(n, i + 1));\n                    if (!expression) {\n                        return NULL;\n                    }\n\n                    asdl_seq_SET(ops, i / 2, newoperator);\n                    asdl_seq_SET(cmps, i / 2, expression);\n                }\n                expression = ast_for_expr(c, CHILD(n, 0));\n                if (!expression) {\n                    return NULL;\n                }\n\n                return Compare(expression, ops, cmps, LINENO(n),\n                               n->n_col_offset, c->c_arena);\n            }\n            break;\n\n        case star_expr:\n            return ast_for_starred(c, n);\n        /* The next five cases all handle BinOps.  The main body of code\n           is the same in each case, but the switch turned inside out to\n           reuse the code for each type of operator.\n         */\n        case expr:\n        case xor_expr:\n        case and_expr:\n        case shift_expr:\n        case arith_expr:\n        case term:\n            if (NCH(n) == 1) {\n                n = CHILD(n, 0);\n                goto loop;\n            }\n            return ast_for_binop(c, n);\n        case yield_expr: {\n            node *an = NULL;\n            node *en = NULL;\n            int is_from = 0;\n            expr_ty exp = NULL;\n            if (NCH(n) > 1)\n                an = CHILD(n, 1); /* yield_arg */\n            if (an) {\n                en = CHILD(an, NCH(an) - 1);\n                if (NCH(an) == 2) {\n                    is_from = 1;\n                    exp = ast_for_expr(c, en);\n                }\n                else\n                    exp = ast_for_testlist(c, en);\n                if (!exp)\n                    return NULL;\n            }\n            if (is_from)\n                return YieldFrom(exp, LINENO(n), n->n_col_offset, c->c_arena);\n            return Yield(exp, LINENO(n), n->n_col_offset, c->c_arena);\n        }\n        case factor:\n            if (NCH(n) == 1) {\n                n = CHILD(n, 0);\n                goto loop;\n            }\n            return ast_for_factor(c, n);\n        case power:\n            return ast_for_power(c, n);\n        default:\n            PyErr_Format(PyExc_SystemError, \"unhandled expr: %d\", TYPE(n));\n            return NULL;\n    }\n    /* should never get here unless if error is set */\n    return NULL;\n}\n\nstatic expr_ty\nast_for_call(struct compiling *c, const node *n, expr_ty func, bool allowgen)\n{\n    /*\n      arglist: argument (',' argument)*  [',']\n      argument: ( test [comp_for] | '*' test | test '=' test | '**' test )\n    */\n\n    int i, nargs, nkeywords;\n    int ndoublestars;\n    asdl_seq *args;\n    asdl_seq *keywords;\n\n    REQ(n, arglist);\n\n    nargs = 0;\n    nkeywords = 0;\n    for (i = 0; i < NCH(n); i++) {\n        node *ch = CHILD(n, i);\n        if (TYPE(ch) == argument) {\n            if (NCH(ch) == 1)\n                nargs++;\n            else if (TYPE(CHILD(ch, 1)) == comp_for) {\n                nargs++;\n                if (!allowgen) {\n                    ast_error(c, ch, \"invalid syntax\");\n                    return NULL;\n                }\n                if (NCH(n) > 1) {\n                    ast_error(c, ch, \"Generator expression must be parenthesized\");\n                    return NULL;\n                }\n            }\n            else if (TYPE(CHILD(ch, 0)) == STAR)\n                nargs++;\n            else\n                /* TYPE(CHILD(ch, 0)) == DOUBLESTAR or keyword argument */\n                nkeywords++;\n        }\n    }\n\n    args = _Ta3_asdl_seq_new(nargs, c->c_arena);\n    if (!args)\n        return NULL;\n    keywords = _Ta3_asdl_seq_new(nkeywords, c->c_arena);\n    if (!keywords)\n        return NULL;\n\n    nargs = 0;  /* positional arguments + iterable argument unpackings */\n    nkeywords = 0;  /* keyword arguments + keyword argument unpackings */\n    ndoublestars = 0;  /* just keyword argument unpackings */\n    for (i = 0; i < NCH(n); i++) {\n        node *ch = CHILD(n, i);\n        if (TYPE(ch) == argument) {\n            expr_ty e;\n            node *chch = CHILD(ch, 0);\n            if (NCH(ch) == 1) {\n                /* a positional argument */\n                if (nkeywords) {\n                    if (ndoublestars) {\n                        ast_error(c, chch,\n                                \"positional argument follows \"\n                                \"keyword argument unpacking\");\n                    }\n                    else {\n                        ast_error(c, chch,\n                                \"positional argument follows \"\n                                \"keyword argument\");\n                    }\n                    return NULL;\n                }\n                e = ast_for_expr(c, chch);\n                if (!e)\n                    return NULL;\n                asdl_seq_SET(args, nargs++, e);\n            }\n            else if (TYPE(chch) == STAR) {\n                /* an iterable argument unpacking */\n                expr_ty starred;\n                if (ndoublestars) {\n                    ast_error(c, chch,\n                            \"iterable argument unpacking follows \"\n                            \"keyword argument unpacking\");\n                    return NULL;\n                }\n                e = ast_for_expr(c, CHILD(ch, 1));\n                if (!e)\n                    return NULL;\n                starred = Starred(e, Load, LINENO(chch),\n                        chch->n_col_offset,\n                        c->c_arena);\n                if (!starred)\n                    return NULL;\n                asdl_seq_SET(args, nargs++, starred);\n\n            }\n            else if (TYPE(chch) == DOUBLESTAR) {\n                /* a keyword argument unpacking */\n                keyword_ty kw;\n                i++;\n                e = ast_for_expr(c, CHILD(ch, 1));\n                if (!e)\n                    return NULL;\n                kw = keyword(NULL, e, c->c_arena);\n                asdl_seq_SET(keywords, nkeywords++, kw);\n                ndoublestars++;\n            }\n            else if (TYPE(CHILD(ch, 1)) == comp_for) {\n                /* the lone generator expression */\n                e = ast_for_genexp(c, ch);\n                if (!e)\n                    return NULL;\n                asdl_seq_SET(args, nargs++, e);\n            }\n            else {\n                /* a keyword argument */\n                keyword_ty kw;\n                identifier key, tmp;\n                int k;\n\n                /* chch is test, but must be an identifier? */\n                e = ast_for_expr(c, chch);\n                if (!e)\n                    return NULL;\n                /* f(lambda x: x[0] = 3) ends up getting parsed with\n                 * LHS test = lambda x: x[0], and RHS test = 3.\n                 * SF bug 132313 points out that complaining about a keyword\n                 * then is very confusing.\n                 */\n                if (e->kind == Lambda_kind) {\n                    ast_error(c, chch,\n                            \"lambda cannot contain assignment\");\n                    return NULL;\n                }\n                else if (e->kind != Name_kind) {\n                    ast_error(c, chch,\n                            \"keyword can't be an expression\");\n                    return NULL;\n                }\n                else if (forbidden_name(c, e->v.Name.id, ch, 1)) {\n                    return NULL;\n                }\n                key = e->v.Name.id;\n                for (k = 0; k < nkeywords; k++) {\n                    tmp = ((keyword_ty)asdl_seq_GET(keywords, k))->arg;\n                    if (tmp && !PyUnicode_Compare(tmp, key)) {\n                        ast_error(c, chch,\n                                \"keyword argument repeated\");\n                        return NULL;\n                    }\n                }\n                e = ast_for_expr(c, CHILD(ch, 2));\n                if (!e)\n                    return NULL;\n                kw = keyword(key, e, c->c_arena);\n                if (!kw)\n                    return NULL;\n                asdl_seq_SET(keywords, nkeywords++, kw);\n            }\n        }\n    }\n\n    return Call(func, args, keywords, func->lineno, func->col_offset, c->c_arena);\n}\n\nstatic expr_ty\nast_for_testlist(struct compiling *c, const node* n)\n{\n    /* testlist_comp: test (comp_for | (',' test)* [',']) */\n    /* testlist: test (',' test)* [','] */\n    assert(NCH(n) > 0);\n    if (TYPE(n) == testlist_comp) {\n        if (NCH(n) > 1)\n            assert(TYPE(CHILD(n, 1)) != comp_for);\n    }\n    else {\n        assert(TYPE(n) == testlist ||\n               TYPE(n) == testlist_star_expr);\n    }\n    if (NCH(n) == 1)\n        return ast_for_expr(c, CHILD(n, 0));\n    else {\n        asdl_seq *tmp = seq_for_testlist(c, n);\n        if (!tmp)\n            return NULL;\n        return Tuple(tmp, Load, LINENO(n), n->n_col_offset, c->c_arena);\n    }\n}\n\nstatic stmt_ty\nast_for_expr_stmt(struct compiling *c, const node *n)\n{\n    int num;\n\n    REQ(n, expr_stmt);\n    /* expr_stmt: testlist_star_expr (annassign | augassign (yield_expr|testlist) |\n                           ('=' (yield_expr|testlist_star_expr))* [TYPE_COMMENT])\n       annassign: ':' test ['=' test]\n       testlist_star_expr: (test|star_expr) (',' test|star_expr)* [',']\n       augassign: '+=' | '-=' | '*=' | '@=' | '/=' | '%=' | '&=' | '|=' | '^='\n                | '<<=' | '>>=' | '**=' | '//='\n       test: ... here starts the operator precedence dance\n     */\n    num = NCH(n);\n\n    if (num == 1 || (num == 2 && TYPE(CHILD(n, 1)) == TYPE_COMMENT)) {\n        expr_ty e = ast_for_testlist(c, CHILD(n, 0));\n        if (!e)\n            return NULL;\n\n        return Expr(e, LINENO(n), n->n_col_offset, c->c_arena);\n    }\n    else if (TYPE(CHILD(n, 1)) == augassign) {\n        expr_ty expr1, expr2;\n        operator_ty newoperator;\n        node *ch = CHILD(n, 0);\n\n        expr1 = ast_for_testlist(c, ch);\n        if (!expr1)\n            return NULL;\n        if(!set_context(c, expr1, Store, ch))\n            return NULL;\n        /* set_context checks that most expressions are not the left side.\n          Augmented assignments can only have a name, a subscript, or an\n          attribute on the left, though, so we have to explicitly check for\n          those. */\n        switch (expr1->kind) {\n            case Name_kind:\n            case Attribute_kind:\n            case Subscript_kind:\n                break;\n            default:\n                ast_error(c, ch, \"illegal expression for augmented assignment\");\n                return NULL;\n        }\n\n        ch = CHILD(n, 2);\n        if (TYPE(ch) == testlist)\n            expr2 = ast_for_testlist(c, ch);\n        else\n            expr2 = ast_for_expr(c, ch);\n        if (!expr2)\n            return NULL;\n\n        newoperator = ast_for_augassign(c, CHILD(n, 1));\n        if (!newoperator)\n            return NULL;\n\n        return AugAssign(expr1, newoperator, expr2, LINENO(n), n->n_col_offset, c->c_arena);\n    }\n    else if (TYPE(CHILD(n, 1)) == annassign) {\n        expr_ty expr1, expr2, expr3;\n        node *ch = CHILD(n, 0);\n        node *deep, *ann = CHILD(n, 1);\n        int simple = 1;\n\n        /* AnnAssigns are only allowed in Python 3.6 or greater */\n        if (c->c_feature_version < 6) {\n            ast_error(c, ch,\n                    \"Variable annotation syntax is only supported in Python 3.6 and greater\");\n            return NULL;\n        }\n\n        /* we keep track of parens to qualify (x) as expression not name */\n        deep = ch;\n        while (NCH(deep) == 1) {\n            deep = CHILD(deep, 0);\n        }\n        if (NCH(deep) > 0 && TYPE(CHILD(deep, 0)) == LPAR) {\n            simple = 0;\n        }\n        expr1 = ast_for_testlist(c, ch);\n        if (!expr1) {\n            return NULL;\n        }\n        switch (expr1->kind) {\n            case Name_kind:\n                if (forbidden_name(c, expr1->v.Name.id, n, 0)) {\n                    return NULL;\n                }\n                expr1->v.Name.ctx = Store;\n                break;\n            case Attribute_kind:\n                if (forbidden_name(c, expr1->v.Attribute.attr, n, 1)) {\n                    return NULL;\n                }\n                expr1->v.Attribute.ctx = Store;\n                break;\n            case Subscript_kind:\n                expr1->v.Subscript.ctx = Store;\n                break;\n            case List_kind:\n                ast_error(c, ch,\n                          \"only single target (not list) can be annotated\");\n                return NULL;\n            case Tuple_kind:\n                ast_error(c, ch,\n                          \"only single target (not tuple) can be annotated\");\n                return NULL;\n            default:\n                ast_error(c, ch,\n                          \"illegal target for annotation\");\n                return NULL;\n        }\n\n        if (expr1->kind != Name_kind) {\n            simple = 0;\n        }\n        ch = CHILD(ann, 1);\n        expr2 = ast_for_expr(c, ch);\n        if (!expr2) {\n            return NULL;\n        }\n        if (NCH(ann) == 2) {\n            return AnnAssign(expr1, expr2, NULL, simple,\n                             LINENO(n), n->n_col_offset, c->c_arena);\n        }\n        else {\n            ch = CHILD(ann, 3);\n            expr3 = ast_for_expr(c, ch);\n            if (!expr3) {\n                return NULL;\n            }\n            return AnnAssign(expr1, expr2, expr3, simple,\n                             LINENO(n), n->n_col_offset, c->c_arena);\n        }\n    }\n    else {\n        int i, nch_minus_type, has_type_comment;\n        asdl_seq *targets;\n        node *value;\n        expr_ty expression;\n        string type_comment;\n\n        /* a normal assignment */\n        REQ(CHILD(n, 1), EQUAL);\n\n        has_type_comment = TYPE(CHILD(n, num - 1)) == TYPE_COMMENT;\n        nch_minus_type = num - has_type_comment;\n\n        targets = _Ta3_asdl_seq_new(nch_minus_type / 2, c->c_arena);\n        if (!targets)\n            return NULL;\n        for (i = 0; i < nch_minus_type - 2; i += 2) {\n            expr_ty e;\n            node *ch = CHILD(n, i);\n            if (TYPE(ch) == yield_expr) {\n                ast_error(c, ch, \"assignment to yield expression not possible\");\n                return NULL;\n            }\n            e = ast_for_testlist(c, ch);\n            if (!e)\n              return NULL;\n\n            /* set context to assign */\n            if (!set_context(c, e, Store, CHILD(n, i)))\n              return NULL;\n\n            asdl_seq_SET(targets, i / 2, e);\n        }\n        value = CHILD(n, nch_minus_type - 1);\n        if (TYPE(value) == testlist_star_expr)\n            expression = ast_for_testlist(c, value);\n        else\n            expression = ast_for_expr(c, value);\n        if (!expression)\n            return NULL;\n        if (has_type_comment) {\n            type_comment = NEW_TYPE_COMMENT(CHILD(n, nch_minus_type));\n            if (!type_comment)\n                return NULL;\n        }\n        else\n            type_comment = NULL;\n        return Assign(targets, expression, type_comment, LINENO(n), n->n_col_offset, c->c_arena);\n    }\n}\n\n\nstatic asdl_seq *\nast_for_exprlist(struct compiling *c, const node *n, expr_context_ty context)\n{\n    asdl_seq *seq;\n    int i;\n    expr_ty e;\n\n    REQ(n, exprlist);\n\n    seq = _Ta3_asdl_seq_new((NCH(n) + 1) / 2, c->c_arena);\n    if (!seq)\n        return NULL;\n    for (i = 0; i < NCH(n); i += 2) {\n        e = ast_for_expr(c, CHILD(n, i));\n        if (!e)\n            return NULL;\n        asdl_seq_SET(seq, i / 2, e);\n        if (context && !set_context(c, e, context, CHILD(n, i)))\n            return NULL;\n    }\n    return seq;\n}\n\nstatic stmt_ty\nast_for_del_stmt(struct compiling *c, const node *n)\n{\n    asdl_seq *expr_list;\n\n    /* del_stmt: 'del' exprlist */\n    REQ(n, del_stmt);\n\n    expr_list = ast_for_exprlist(c, CHILD(n, 1), Del);\n    if (!expr_list)\n        return NULL;\n    return Delete(expr_list, LINENO(n), n->n_col_offset, c->c_arena);\n}\n\nstatic stmt_ty\nast_for_flow_stmt(struct compiling *c, const node *n)\n{\n    /*\n      flow_stmt: break_stmt | continue_stmt | return_stmt | raise_stmt\n                 | yield_stmt\n      break_stmt: 'break'\n      continue_stmt: 'continue'\n      return_stmt: 'return' [testlist]\n      yield_stmt: yield_expr\n      yield_expr: 'yield' testlist | 'yield' 'from' test\n      raise_stmt: 'raise' [test [',' test [',' test]]]\n    */\n    node *ch;\n\n    REQ(n, flow_stmt);\n    ch = CHILD(n, 0);\n    switch (TYPE(ch)) {\n        case break_stmt:\n            return Break(LINENO(n), n->n_col_offset, c->c_arena);\n        case continue_stmt:\n            return Continue(LINENO(n), n->n_col_offset, c->c_arena);\n        case yield_stmt: { /* will reduce to yield_expr */\n            expr_ty exp = ast_for_expr(c, CHILD(ch, 0));\n            if (!exp)\n                return NULL;\n            return Expr(exp, LINENO(n), n->n_col_offset, c->c_arena);\n        }\n        case return_stmt:\n            if (NCH(ch) == 1)\n                return Return(NULL, LINENO(n), n->n_col_offset, c->c_arena);\n            else {\n                expr_ty expression = ast_for_testlist(c, CHILD(ch, 1));\n                if (!expression)\n                    return NULL;\n                return Return(expression, LINENO(n), n->n_col_offset, c->c_arena);\n            }\n        case raise_stmt:\n            if (NCH(ch) == 1)\n                return Raise(NULL, NULL, LINENO(n), n->n_col_offset, c->c_arena);\n            else if (NCH(ch) >= 2) {\n                expr_ty cause = NULL;\n                expr_ty expression = ast_for_expr(c, CHILD(ch, 1));\n                if (!expression)\n                    return NULL;\n                if (NCH(ch) == 4) {\n                    cause = ast_for_expr(c, CHILD(ch, 3));\n                    if (!cause)\n                        return NULL;\n                }\n                return Raise(expression, cause, LINENO(n), n->n_col_offset, c->c_arena);\n            }\n            /* fall through */\n        default:\n            PyErr_Format(PyExc_SystemError,\n                         \"unexpected flow_stmt: %d\", TYPE(ch));\n            return NULL;\n    }\n}\n\nstatic alias_ty\nalias_for_import_name(struct compiling *c, const node *n, int store)\n{\n    /*\n      import_as_name: NAME ['as' NAME]\n      dotted_as_name: dotted_name ['as' NAME]\n      dotted_name: NAME ('.' NAME)*\n    */\n    identifier str, name;\n\n loop:\n    switch (TYPE(n)) {\n        case import_as_name: {\n            node *name_node = CHILD(n, 0);\n            str = NULL;\n            name = NEW_IDENTIFIER(name_node);\n            if (!name)\n                return NULL;\n            if (NCH(n) == 3) {\n                node *str_node = CHILD(n, 2);\n                str = NEW_IDENTIFIER(str_node);\n                if (!str)\n                    return NULL;\n                if (store && forbidden_name(c, str, str_node, 0))\n                    return NULL;\n            }\n            else {\n                if (forbidden_name(c, name, name_node, 0))\n                    return NULL;\n            }\n            return alias(name, str, c->c_arena);\n        }\n        case dotted_as_name:\n            if (NCH(n) == 1) {\n                n = CHILD(n, 0);\n                goto loop;\n            }\n            else {\n                node *asname_node = CHILD(n, 2);\n                alias_ty a = alias_for_import_name(c, CHILD(n, 0), 0);\n                if (!a)\n                    return NULL;\n                assert(!a->asname);\n                a->asname = NEW_IDENTIFIER(asname_node);\n                if (!a->asname)\n                    return NULL;\n                if (forbidden_name(c, a->asname, asname_node, 0))\n                    return NULL;\n                return a;\n            }\n            break;\n        case dotted_name:\n            if (NCH(n) == 1) {\n                node *name_node = CHILD(n, 0);\n                name = NEW_IDENTIFIER(name_node);\n                if (!name)\n                    return NULL;\n                if (store && forbidden_name(c, name, name_node, 0))\n                    return NULL;\n                return alias(name, NULL, c->c_arena);\n            }\n            else {\n                /* Create a string of the form \"a.b.c\" */\n                int i;\n                size_t len;\n                char *s;\n                PyObject *uni;\n\n                len = 0;\n                for (i = 0; i < NCH(n); i += 2)\n                    /* length of string plus one for the dot */\n                    len += strlen(STR(CHILD(n, i))) + 1;\n                len--; /* the last name doesn't have a dot */\n                str = PyBytes_FromStringAndSize(NULL, len);\n                if (!str)\n                    return NULL;\n                s = PyBytes_AS_STRING(str);\n                if (!s)\n                    return NULL;\n                for (i = 0; i < NCH(n); i += 2) {\n                    char *sch = STR(CHILD(n, i));\n                    strcpy(s, STR(CHILD(n, i)));\n                    s += strlen(sch);\n                    *s++ = '.';\n                }\n                --s;\n                *s = '\\0';\n                uni = PyUnicode_DecodeUTF8(PyBytes_AS_STRING(str),\n                                           PyBytes_GET_SIZE(str),\n                                           NULL);\n                Py_DECREF(str);\n                if (!uni)\n                    return NULL;\n                str = uni;\n                PyUnicode_InternInPlace(&str);\n                if (PyArena_AddPyObject(c->c_arena, str) < 0) {\n                    Py_DECREF(str);\n                    return NULL;\n                }\n                return alias(str, NULL, c->c_arena);\n            }\n            break;\n        case STAR:\n            str = PyUnicode_InternFromString(\"*\");\n            if (!str)\n                return NULL;\n            if (PyArena_AddPyObject(c->c_arena, str) < 0) {\n                Py_DECREF(str);\n                return NULL;\n            }\n            return alias(str, NULL, c->c_arena);\n        default:\n            PyErr_Format(PyExc_SystemError,\n                         \"unexpected import name: %d\", TYPE(n));\n            return NULL;\n    }\n\n    PyErr_SetString(PyExc_SystemError, \"unhandled import name condition\");\n    return NULL;\n}\n\nstatic stmt_ty\nast_for_import_stmt(struct compiling *c, const node *n)\n{\n    /*\n      import_stmt: import_name | import_from\n      import_name: 'import' dotted_as_names\n      import_from: 'from' (('.' | '...')* dotted_name | ('.' | '...')+)\n                   'import' ('*' | '(' import_as_names ')' | import_as_names)\n    */\n    int lineno;\n    int col_offset;\n    int i;\n    asdl_seq *aliases;\n\n    REQ(n, import_stmt);\n    lineno = LINENO(n);\n    col_offset = n->n_col_offset;\n    n = CHILD(n, 0);\n    if (TYPE(n) == import_name) {\n        n = CHILD(n, 1);\n        REQ(n, dotted_as_names);\n        aliases = _Ta3_asdl_seq_new((NCH(n) + 1) / 2, c->c_arena);\n        if (!aliases)\n                return NULL;\n        for (i = 0; i < NCH(n); i += 2) {\n            alias_ty import_alias = alias_for_import_name(c, CHILD(n, i), 1);\n            if (!import_alias)\n                return NULL;\n            asdl_seq_SET(aliases, i / 2, import_alias);\n        }\n        return Import(aliases, lineno, col_offset, c->c_arena);\n    }\n    else if (TYPE(n) == import_from) {\n        int n_children;\n        int idx, ndots = 0;\n        alias_ty mod = NULL;\n        identifier modname = NULL;\n\n       /* Count the number of dots (for relative imports) and check for the\n          optional module name */\n        for (idx = 1; idx < NCH(n); idx++) {\n            if (TYPE(CHILD(n, idx)) == dotted_name) {\n                mod = alias_for_import_name(c, CHILD(n, idx), 0);\n                if (!mod)\n                    return NULL;\n                idx++;\n                break;\n            } else if (TYPE(CHILD(n, idx)) == ELLIPSIS) {\n                /* three consecutive dots are tokenized as one ELLIPSIS */\n                ndots += 3;\n                continue;\n            } else if (TYPE(CHILD(n, idx)) != DOT) {\n                break;\n            }\n            ndots++;\n        }\n        idx++; /* skip over the 'import' keyword */\n        switch (TYPE(CHILD(n, idx))) {\n        case STAR:\n            /* from ... import * */\n            n = CHILD(n, idx);\n            n_children = 1;\n            break;\n        case LPAR:\n            /* from ... import (x, y, z) */\n            n = CHILD(n, idx + 1);\n            n_children = NCH(n);\n            break;\n        case import_as_names:\n            /* from ... import x, y, z */\n            n = CHILD(n, idx);\n            n_children = NCH(n);\n            if (n_children % 2 == 0) {\n                ast_error(c, n, \"trailing comma not allowed without\"\n                             \" surrounding parentheses\");\n                return NULL;\n            }\n            break;\n        default:\n            ast_error(c, n, \"Unexpected node-type in from-import\");\n            return NULL;\n        }\n\n        aliases = _Ta3_asdl_seq_new((n_children + 1) / 2, c->c_arena);\n        if (!aliases)\n            return NULL;\n\n        /* handle \"from ... import *\" special b/c there's no children */\n        if (TYPE(n) == STAR) {\n            alias_ty import_alias = alias_for_import_name(c, n, 1);\n            if (!import_alias)\n                return NULL;\n            asdl_seq_SET(aliases, 0, import_alias);\n        }\n        else {\n            for (i = 0; i < NCH(n); i += 2) {\n                alias_ty import_alias = alias_for_import_name(c, CHILD(n, i), 1);\n                if (!import_alias)\n                    return NULL;\n                asdl_seq_SET(aliases, i / 2, import_alias);\n            }\n        }\n        if (mod != NULL)\n            modname = mod->name;\n        return ImportFrom(modname, aliases, ndots, lineno, col_offset,\n                          c->c_arena);\n    }\n    PyErr_Format(PyExc_SystemError,\n                 \"unknown import statement: starts with command '%s'\",\n                 STR(CHILD(n, 0)));\n    return NULL;\n}\n\nstatic stmt_ty\nast_for_global_stmt(struct compiling *c, const node *n)\n{\n    /* global_stmt: 'global' NAME (',' NAME)* */\n    identifier name;\n    asdl_seq *s;\n    int i;\n\n    REQ(n, global_stmt);\n    s = _Ta3_asdl_seq_new(NCH(n) / 2, c->c_arena);\n    if (!s)\n        return NULL;\n    for (i = 1; i < NCH(n); i += 2) {\n        name = NEW_IDENTIFIER(CHILD(n, i));\n        if (!name)\n            return NULL;\n        asdl_seq_SET(s, i / 2, name);\n    }\n    return Global(s, LINENO(n), n->n_col_offset, c->c_arena);\n}\n\nstatic stmt_ty\nast_for_nonlocal_stmt(struct compiling *c, const node *n)\n{\n    /* nonlocal_stmt: 'nonlocal' NAME (',' NAME)* */\n    identifier name;\n    asdl_seq *s;\n    int i;\n\n    REQ(n, nonlocal_stmt);\n    s = _Ta3_asdl_seq_new(NCH(n) / 2, c->c_arena);\n    if (!s)\n        return NULL;\n    for (i = 1; i < NCH(n); i += 2) {\n        name = NEW_IDENTIFIER(CHILD(n, i));\n        if (!name)\n            return NULL;\n        asdl_seq_SET(s, i / 2, name);\n    }\n    return Nonlocal(s, LINENO(n), n->n_col_offset, c->c_arena);\n}\n\nstatic stmt_ty\nast_for_assert_stmt(struct compiling *c, const node *n)\n{\n    /* assert_stmt: 'assert' test [',' test] */\n    REQ(n, assert_stmt);\n    if (NCH(n) == 2) {\n        expr_ty expression = ast_for_expr(c, CHILD(n, 1));\n        if (!expression)\n            return NULL;\n        return Assert(expression, NULL, LINENO(n), n->n_col_offset, c->c_arena);\n    }\n    else if (NCH(n) == 4) {\n        expr_ty expr1, expr2;\n\n        expr1 = ast_for_expr(c, CHILD(n, 1));\n        if (!expr1)\n            return NULL;\n        expr2 = ast_for_expr(c, CHILD(n, 3));\n        if (!expr2)\n            return NULL;\n\n        return Assert(expr1, expr2, LINENO(n), n->n_col_offset, c->c_arena);\n    }\n    PyErr_Format(PyExc_SystemError,\n                 \"improper number of parts to 'assert' statement: %d\",\n                 NCH(n));\n    return NULL;\n}\n\nstatic asdl_seq *\nast_for_suite(struct compiling *c, const node *n)\n{\n    /* suite: simple_stmt | NEWLINE [TYPE_COMMENT NEWLINE] INDENT stmt+ DEDENT */\n    asdl_seq *seq;\n    stmt_ty s;\n    int i, total, num, end, pos = 0;\n    node *ch;\n\n    REQ(n, suite);\n\n    total = num_stmts(n);\n    seq = _Ta3_asdl_seq_new(total, c->c_arena);\n    if (!seq)\n        return NULL;\n    if (TYPE(CHILD(n, 0)) == simple_stmt) {\n        n = CHILD(n, 0);\n        /* simple_stmt always ends with a NEWLINE,\n           and may have a trailing SEMI\n        */\n        end = NCH(n) - 1;\n        if (TYPE(CHILD(n, end - 1)) == SEMI)\n            end--;\n        /* loop by 2 to skip semi-colons */\n        for (i = 0; i < end; i += 2) {\n            ch = CHILD(n, i);\n            s = ast_for_stmt(c, ch);\n            if (!s)\n                return NULL;\n            asdl_seq_SET(seq, pos++, s);\n        }\n    }\n    else {\n        i = 2;\n        if (TYPE(CHILD(n, 1)) == TYPE_COMMENT)\n            i += 2;\n\n        for (; i < (NCH(n) - 1); i++) {\n            ch = CHILD(n, i);\n            REQ(ch, stmt);\n            num = num_stmts(ch);\n            if (num == 1) {\n                /* small_stmt or compound_stmt with only one child */\n                s = ast_for_stmt(c, ch);\n                if (!s)\n                    return NULL;\n                asdl_seq_SET(seq, pos++, s);\n            }\n            else {\n                int j;\n                ch = CHILD(ch, 0);\n                REQ(ch, simple_stmt);\n                for (j = 0; j < NCH(ch); j += 2) {\n                    /* statement terminates with a semi-colon ';' */\n                    if (NCH(CHILD(ch, j)) == 0) {\n                        assert((j + 1) == NCH(ch));\n                        break;\n                    }\n                    s = ast_for_stmt(c, CHILD(ch, j));\n                    if (!s)\n                        return NULL;\n                    asdl_seq_SET(seq, pos++, s);\n                }\n            }\n        }\n    }\n    assert(pos == seq->size);\n    return seq;\n}\n\nstatic stmt_ty\nast_for_if_stmt(struct compiling *c, const node *n)\n{\n    /* if_stmt: 'if' test ':' suite ('elif' test ':' suite)*\n       ['else' ':' suite]\n    */\n    char *s;\n\n    REQ(n, if_stmt);\n\n    if (NCH(n) == 4) {\n        expr_ty expression;\n        asdl_seq *suite_seq;\n\n        expression = ast_for_expr(c, CHILD(n, 1));\n        if (!expression)\n            return NULL;\n        suite_seq = ast_for_suite(c, CHILD(n, 3));\n        if (!suite_seq)\n            return NULL;\n\n        return If(expression, suite_seq, NULL, LINENO(n), n->n_col_offset,\n                  c->c_arena);\n    }\n\n    s = STR(CHILD(n, 4));\n    /* s[2], the third character in the string, will be\n       's' for el_s_e, or\n       'i' for el_i_f\n    */\n    if (s[2] == 's') {\n        expr_ty expression;\n        asdl_seq *seq1, *seq2;\n\n        expression = ast_for_expr(c, CHILD(n, 1));\n        if (!expression)\n            return NULL;\n        seq1 = ast_for_suite(c, CHILD(n, 3));\n        if (!seq1)\n            return NULL;\n        seq2 = ast_for_suite(c, CHILD(n, 6));\n        if (!seq2)\n            return NULL;\n\n        return If(expression, seq1, seq2, LINENO(n), n->n_col_offset,\n                  c->c_arena);\n    }\n    else if (s[2] == 'i') {\n        int i, n_elif, has_else = 0;\n        expr_ty expression;\n        asdl_seq *suite_seq;\n        asdl_seq *orelse = NULL;\n        n_elif = NCH(n) - 4;\n        /* must reference the child n_elif+1 since 'else' token is third,\n           not fourth, child from the end. */\n        if (TYPE(CHILD(n, (n_elif + 1))) == NAME\n            && STR(CHILD(n, (n_elif + 1)))[2] == 's') {\n            has_else = 1;\n            n_elif -= 3;\n        }\n        n_elif /= 4;\n\n        if (has_else) {\n            asdl_seq *suite_seq2;\n\n            orelse = _Ta3_asdl_seq_new(1, c->c_arena);\n            if (!orelse)\n                return NULL;\n            expression = ast_for_expr(c, CHILD(n, NCH(n) - 6));\n            if (!expression)\n                return NULL;\n            suite_seq = ast_for_suite(c, CHILD(n, NCH(n) - 4));\n            if (!suite_seq)\n                return NULL;\n            suite_seq2 = ast_for_suite(c, CHILD(n, NCH(n) - 1));\n            if (!suite_seq2)\n                return NULL;\n\n            asdl_seq_SET(orelse, 0,\n                         If(expression, suite_seq, suite_seq2,\n                            LINENO(CHILD(n, NCH(n) - 6)),\n                            CHILD(n, NCH(n) - 6)->n_col_offset,\n                            c->c_arena));\n            /* the just-created orelse handled the last elif */\n            n_elif--;\n        }\n\n        for (i = 0; i < n_elif; i++) {\n            int off = 5 + (n_elif - i - 1) * 4;\n            asdl_seq *newobj = _Ta3_asdl_seq_new(1, c->c_arena);\n            if (!newobj)\n                return NULL;\n            expression = ast_for_expr(c, CHILD(n, off));\n            if (!expression)\n                return NULL;\n            suite_seq = ast_for_suite(c, CHILD(n, off + 2));\n            if (!suite_seq)\n                return NULL;\n\n            asdl_seq_SET(newobj, 0,\n                         If(expression, suite_seq, orelse,\n                            LINENO(CHILD(n, off)),\n                            CHILD(n, off)->n_col_offset, c->c_arena));\n            orelse = newobj;\n        }\n        expression = ast_for_expr(c, CHILD(n, 1));\n        if (!expression)\n            return NULL;\n        suite_seq = ast_for_suite(c, CHILD(n, 3));\n        if (!suite_seq)\n            return NULL;\n        return If(expression, suite_seq, orelse,\n                  LINENO(n), n->n_col_offset, c->c_arena);\n    }\n\n    PyErr_Format(PyExc_SystemError,\n                 \"unexpected token in 'if' statement: %s\", s);\n    return NULL;\n}\n\nstatic stmt_ty\nast_for_while_stmt(struct compiling *c, const node *n)\n{\n    /* while_stmt: 'while' test ':' suite ['else' ':' suite] */\n    REQ(n, while_stmt);\n\n    if (NCH(n) == 4) {\n        expr_ty expression;\n        asdl_seq *suite_seq;\n\n        expression = ast_for_expr(c, CHILD(n, 1));\n        if (!expression)\n            return NULL;\n        suite_seq = ast_for_suite(c, CHILD(n, 3));\n        if (!suite_seq)\n            return NULL;\n        return While(expression, suite_seq, NULL, LINENO(n), n->n_col_offset, c->c_arena);\n    }\n    else if (NCH(n) == 7) {\n        expr_ty expression;\n        asdl_seq *seq1, *seq2;\n\n        expression = ast_for_expr(c, CHILD(n, 1));\n        if (!expression)\n            return NULL;\n        seq1 = ast_for_suite(c, CHILD(n, 3));\n        if (!seq1)\n            return NULL;\n        seq2 = ast_for_suite(c, CHILD(n, 6));\n        if (!seq2)\n            return NULL;\n\n        return While(expression, seq1, seq2, LINENO(n), n->n_col_offset, c->c_arena);\n    }\n\n    PyErr_Format(PyExc_SystemError,\n                 \"wrong number of tokens for 'while' statement: %d\",\n                 NCH(n));\n    return NULL;\n}\n\nstatic stmt_ty\nast_for_for_stmt(struct compiling *c, const node *n0, bool is_async)\n{\n    const node * const n = is_async ? CHILD(n0, 1) : n0;\n    asdl_seq *_target, *seq = NULL, *suite_seq;\n    expr_ty expression;\n    expr_ty target, first;\n    const node *node_target;\n    int has_type_comment;\n    string type_comment;\n\n    if (is_async && c->c_feature_version < 5) {\n        ast_error(c, n,\n                \"Async for loops are only supported in Python 3.5 and greater\");\n        return NULL;\n    }\n\n    /* for_stmt: 'for' exprlist 'in' testlist ':' [TYPE_COMMENT] suite ['else' ':' suite] */\n    REQ(n, for_stmt);\n\n    has_type_comment = TYPE(CHILD(n, 5)) == TYPE_COMMENT;\n\n    if (NCH(n) == 9 + has_type_comment) {\n        seq = ast_for_suite(c, CHILD(n, 8 + has_type_comment));\n        if (!seq)\n            return NULL;\n    }\n\n    node_target = CHILD(n, 1);\n    _target = ast_for_exprlist(c, node_target, Store);\n    if (!_target)\n        return NULL;\n    /* Check the # of children rather than the length of _target, since\n       for x, in ... has 1 element in _target, but still requires a Tuple. */\n    first = (expr_ty)asdl_seq_GET(_target, 0);\n    if (NCH(node_target) == 1)\n        target = first;\n    else\n        target = Tuple(_target, Store, first->lineno, first->col_offset, c->c_arena);\n\n    expression = ast_for_testlist(c, CHILD(n, 3));\n    if (!expression)\n        return NULL;\n    suite_seq = ast_for_suite(c, CHILD(n, 5 + has_type_comment));\n    if (!suite_seq)\n        return NULL;\n\n    if (has_type_comment) {\n        type_comment = NEW_TYPE_COMMENT(CHILD(n, 5));\n        if (!type_comment)\n            return NULL;\n    }\n    else\n        type_comment = NULL;\n\n    if (is_async)\n        return AsyncFor(target, expression, suite_seq, seq, type_comment,\n                        LINENO(n0), n0->n_col_offset,\n                        c->c_arena);\n    else\n        return For(target, expression, suite_seq, seq, type_comment,\n                   LINENO(n), n->n_col_offset,\n                   c->c_arena);\n}\n\nstatic excepthandler_ty\nast_for_except_clause(struct compiling *c, const node *exc, node *body)\n{\n    /* except_clause: 'except' [test ['as' test]] */\n    REQ(exc, except_clause);\n    REQ(body, suite);\n\n    if (NCH(exc) == 1) {\n        asdl_seq *suite_seq = ast_for_suite(c, body);\n        if (!suite_seq)\n            return NULL;\n\n        return ExceptHandler(NULL, NULL, suite_seq, LINENO(exc),\n                             exc->n_col_offset, c->c_arena);\n    }\n    else if (NCH(exc) == 2) {\n        expr_ty expression;\n        asdl_seq *suite_seq;\n\n        expression = ast_for_expr(c, CHILD(exc, 1));\n        if (!expression)\n            return NULL;\n        suite_seq = ast_for_suite(c, body);\n        if (!suite_seq)\n            return NULL;\n\n        return ExceptHandler(expression, NULL, suite_seq, LINENO(exc),\n                             exc->n_col_offset, c->c_arena);\n    }\n    else if (NCH(exc) == 4) {\n        asdl_seq *suite_seq;\n        expr_ty expression;\n        identifier e = NEW_IDENTIFIER(CHILD(exc, 3));\n        if (!e)\n            return NULL;\n        if (forbidden_name(c, e, CHILD(exc, 3), 0))\n            return NULL;\n        expression = ast_for_expr(c, CHILD(exc, 1));\n        if (!expression)\n            return NULL;\n        suite_seq = ast_for_suite(c, body);\n        if (!suite_seq)\n            return NULL;\n\n        return ExceptHandler(expression, e, suite_seq, LINENO(exc),\n                             exc->n_col_offset, c->c_arena);\n    }\n\n    PyErr_Format(PyExc_SystemError,\n                 \"wrong number of children for 'except' clause: %d\",\n                 NCH(exc));\n    return NULL;\n}\n\nstatic stmt_ty\nast_for_try_stmt(struct compiling *c, const node *n)\n{\n    const int nch = NCH(n);\n    int n_except = (nch - 3)/3;\n    asdl_seq *body, *handlers = NULL, *orelse = NULL, *finally = NULL;\n\n    REQ(n, try_stmt);\n\n    body = ast_for_suite(c, CHILD(n, 2));\n    if (body == NULL)\n        return NULL;\n\n    if (TYPE(CHILD(n, nch - 3)) == NAME) {\n        if (strcmp(STR(CHILD(n, nch - 3)), \"finally\") == 0) {\n            if (nch >= 9 && TYPE(CHILD(n, nch - 6)) == NAME) {\n                /* we can assume it's an \"else\",\n                   because nch >= 9 for try-else-finally and\n                   it would otherwise have a type of except_clause */\n                orelse = ast_for_suite(c, CHILD(n, nch - 4));\n                if (orelse == NULL)\n                    return NULL;\n                n_except--;\n            }\n\n            finally = ast_for_suite(c, CHILD(n, nch - 1));\n            if (finally == NULL)\n                return NULL;\n            n_except--;\n        }\n        else {\n            /* we can assume it's an \"else\",\n               otherwise it would have a type of except_clause */\n            orelse = ast_for_suite(c, CHILD(n, nch - 1));\n            if (orelse == NULL)\n                return NULL;\n            n_except--;\n        }\n    }\n    else if (TYPE(CHILD(n, nch - 3)) != except_clause) {\n        ast_error(c, n, \"malformed 'try' statement\");\n        return NULL;\n    }\n\n    if (n_except > 0) {\n        int i;\n        /* process except statements to create a try ... except */\n        handlers = _Ta3_asdl_seq_new(n_except, c->c_arena);\n        if (handlers == NULL)\n            return NULL;\n\n        for (i = 0; i < n_except; i++) {\n            excepthandler_ty e = ast_for_except_clause(c, CHILD(n, 3 + i * 3),\n                                                       CHILD(n, 5 + i * 3));\n            if (!e)\n                return NULL;\n            asdl_seq_SET(handlers, i, e);\n        }\n    }\n\n    assert(finally != NULL || asdl_seq_LEN(handlers));\n    return Try(body, handlers, orelse, finally, LINENO(n), n->n_col_offset, c->c_arena);\n}\n\n/* with_item: test ['as' expr] */\nstatic withitem_ty\nast_for_with_item(struct compiling *c, const node *n)\n{\n    expr_ty context_expr, optional_vars = NULL;\n\n    REQ(n, with_item);\n    context_expr = ast_for_expr(c, CHILD(n, 0));\n    if (!context_expr)\n        return NULL;\n    if (NCH(n) == 3) {\n        optional_vars = ast_for_expr(c, CHILD(n, 2));\n\n        if (!optional_vars) {\n            return NULL;\n        }\n        if (!set_context(c, optional_vars, Store, n)) {\n            return NULL;\n        }\n    }\n\n    return withitem(context_expr, optional_vars, c->c_arena);\n}\n\n/* with_stmt: 'with' with_item (',' with_item)*  ':' [TYPE_COMMENT] suite */\nstatic stmt_ty\nast_for_with_stmt(struct compiling *c, const node *n0, bool is_async)\n{\n    const node * const n = is_async ? CHILD(n0, 1) : n0;\n    int i, n_items, nch_minus_type, has_type_comment;\n    asdl_seq *items, *body;\n    string type_comment;\n\n    if (is_async && c->c_feature_version < 5) {\n        ast_error(c, n,\n                \"Async with statements are only supported in Python 3.5 and greater\");\n        return NULL;\n    }\n\n    REQ(n, with_stmt);\n\n    has_type_comment = TYPE(CHILD(n, NCH(n) - 2)) == TYPE_COMMENT;\n    nch_minus_type = NCH(n) - has_type_comment;\n\n    n_items = (nch_minus_type - 2) / 2;\n    items = _Ta3_asdl_seq_new(n_items, c->c_arena);\n    if (!items)\n        return NULL;\n    for (i = 1; i < nch_minus_type - 2; i += 2) {\n        withitem_ty item = ast_for_with_item(c, CHILD(n, i));\n        if (!item)\n            return NULL;\n        asdl_seq_SET(items, (i - 1) / 2, item);\n    }\n\n    body = ast_for_suite(c, CHILD(n, NCH(n) - 1));\n    if (!body)\n        return NULL;\n\n    if (has_type_comment) {\n        type_comment = NEW_TYPE_COMMENT(CHILD(n, NCH(n) - 2));\n        if (!type_comment)\n            return NULL;\n    }\n    else\n        type_comment = NULL;\n\n    if (is_async)\n        return AsyncWith(items, body, type_comment, LINENO(n0), n0->n_col_offset, c->c_arena);\n    else\n        return With(items, body, type_comment, LINENO(n), n->n_col_offset, c->c_arena);\n}\n\nstatic stmt_ty\nast_for_classdef(struct compiling *c, const node *n, asdl_seq *decorator_seq)\n{\n    /* classdef: 'class' NAME ['(' arglist ')'] ':' suite */\n    PyObject *classname;\n    asdl_seq *s;\n    expr_ty call;\n\n    REQ(n, classdef);\n\n    if (NCH(n) == 4) { /* class NAME ':' suite */\n        s = ast_for_suite(c, CHILD(n, 3));\n        if (!s)\n            return NULL;\n        classname = NEW_IDENTIFIER(CHILD(n, 1));\n        if (!classname)\n            return NULL;\n        if (forbidden_name(c, classname, CHILD(n, 3), 0))\n            return NULL;\n        return ClassDef(classname, NULL, NULL, s, decorator_seq,\n                        LINENO(n), n->n_col_offset, c->c_arena);\n    }\n\n    if (TYPE(CHILD(n, 3)) == RPAR) { /* class NAME '(' ')' ':' suite */\n        s = ast_for_suite(c, CHILD(n, 5));\n        if (!s)\n            return NULL;\n        classname = NEW_IDENTIFIER(CHILD(n, 1));\n        if (!classname)\n            return NULL;\n        if (forbidden_name(c, classname, CHILD(n, 3), 0))\n            return NULL;\n        return ClassDef(classname, NULL, NULL, s, decorator_seq,\n                        LINENO(n), n->n_col_offset, c->c_arena);\n    }\n\n    /* class NAME '(' arglist ')' ':' suite */\n    /* build up a fake Call node so we can extract its pieces */\n    {\n        PyObject *dummy_name;\n        expr_ty dummy;\n        dummy_name = NEW_IDENTIFIER(CHILD(n, 1));\n        if (!dummy_name)\n            return NULL;\n        dummy = Name(dummy_name, Load, LINENO(n), n->n_col_offset, c->c_arena);\n        call = ast_for_call(c, CHILD(n, 3), dummy, false);\n        if (!call)\n            return NULL;\n    }\n    s = ast_for_suite(c, CHILD(n, 6));\n    if (!s)\n        return NULL;\n    classname = NEW_IDENTIFIER(CHILD(n, 1));\n    if (!classname)\n        return NULL;\n    if (forbidden_name(c, classname, CHILD(n, 1), 0))\n        return NULL;\n\n    return ClassDef(classname, call->v.Call.args, call->v.Call.keywords, s,\n                    decorator_seq, LINENO(n), n->n_col_offset, c->c_arena);\n}\n\nstatic stmt_ty\nast_for_stmt(struct compiling *c, const node *n)\n{\n    if (TYPE(n) == stmt) {\n        assert(NCH(n) == 1);\n        n = CHILD(n, 0);\n    }\n    if (TYPE(n) == simple_stmt) {\n        assert(num_stmts(n) == 1);\n        n = CHILD(n, 0);\n    }\n    if (TYPE(n) == small_stmt) {\n        n = CHILD(n, 0);\n        /* small_stmt: expr_stmt | del_stmt | pass_stmt | flow_stmt\n                  | import_stmt | global_stmt | nonlocal_stmt | assert_stmt\n        */\n        switch (TYPE(n)) {\n            case expr_stmt:\n                return ast_for_expr_stmt(c, n);\n            case del_stmt:\n                return ast_for_del_stmt(c, n);\n            case pass_stmt:\n                return Pass(LINENO(n), n->n_col_offset, c->c_arena);\n            case flow_stmt:\n                return ast_for_flow_stmt(c, n);\n            case import_stmt:\n                return ast_for_import_stmt(c, n);\n            case global_stmt:\n                return ast_for_global_stmt(c, n);\n            case nonlocal_stmt:\n                return ast_for_nonlocal_stmt(c, n);\n            case assert_stmt:\n                return ast_for_assert_stmt(c, n);\n            default:\n                PyErr_Format(PyExc_SystemError,\n                             \"unhandled small_stmt: TYPE=%d NCH=%d\\n\",\n                             TYPE(n), NCH(n));\n                return NULL;\n        }\n    }\n    else {\n        /* compound_stmt: if_stmt | while_stmt | for_stmt | try_stmt\n                        | funcdef | classdef | decorated | async_stmt\n        */\n        node *ch = CHILD(n, 0);\n        REQ(n, compound_stmt);\n        switch (TYPE(ch)) {\n            case if_stmt:\n                return ast_for_if_stmt(c, ch);\n            case while_stmt:\n                return ast_for_while_stmt(c, ch);\n            case for_stmt:\n                return ast_for_for_stmt(c, ch, 0);\n            case try_stmt:\n                return ast_for_try_stmt(c, ch);\n            case with_stmt:\n                return ast_for_with_stmt(c, ch, 0);\n            case funcdef:\n                return ast_for_funcdef(c, ch, NULL);\n            case classdef:\n                return ast_for_classdef(c, ch, NULL);\n            case decorated:\n                return ast_for_decorated(c, ch);\n            case async_stmt:\n                return ast_for_async_stmt(c, ch);\n            default:\n                PyErr_Format(PyExc_SystemError,\n                             \"unhandled small_stmt: TYPE=%d NCH=%d\\n\",\n                             TYPE(n), NCH(n));\n                return NULL;\n        }\n    }\n}\n\nstatic PyObject *\nparsenumber_raw(struct compiling *c, const char *s)\n{\n    const char *end;\n    long x;\n    double dx;\n    Py_complex compl;\n    int imflag;\n\n    assert(s != NULL);\n    errno = 0;\n    end = s + strlen(s) - 1;\n    imflag = *end == 'j' || *end == 'J';\n    if (s[0] == '0') {\n        x = (long) PyOS_strtoul(s, (char **)&end, 0);\n        if (x < 0 && errno == 0) {\n            return PyLong_FromString(s, (char **)0, 0);\n        }\n    }\n    else\n        x = PyOS_strtol(s, (char **)&end, 0);\n    if (*end == '\\0') {\n        if (errno != 0)\n            return PyLong_FromString(s, (char **)0, 0);\n        return PyLong_FromLong(x);\n    }\n    /* XXX Huge floats may silently fail */\n    if (imflag) {\n        compl.real = 0.;\n        compl.imag = PyOS_string_to_double(s, (char **)&end, NULL);\n        if (compl.imag == -1.0 && PyErr_Occurred())\n            return NULL;\n        return PyComplex_FromCComplex(compl);\n    }\n    else\n    {\n        dx = PyOS_string_to_double(s, NULL, NULL);\n        if (dx == -1.0 && PyErr_Occurred())\n            return NULL;\n        return PyFloat_FromDouble(dx);\n    }\n}\n\nstatic PyObject *\nparsenumber(struct compiling *c, const char *s)\n{\n    char *dup, *end;\n    PyObject *res = NULL;\n\n    assert(s != NULL);\n\n    if (strchr(s, '_') == NULL) {\n        return parsenumber_raw(c, s);\n    }\n    /* Create a duplicate without underscores. */\n    dup = PyMem_Malloc(strlen(s) + 1);\n    if (dup == NULL) {\n        return PyErr_NoMemory();\n    }\n    end = dup;\n    for (; *s; s++) {\n        if (*s != '_') {\n            *end++ = *s;\n        }\n    }\n    *end = '\\0';\n    res = parsenumber_raw(c, dup);\n    PyMem_Free(dup);\n    return res;\n}\n\nstatic PyObject *\ndecode_utf8(struct compiling *c, const char **sPtr, const char *end)\n{\n    const char *s, *t;\n    t = s = *sPtr;\n    /* while (s < end && *s != '\\\\') s++; */ /* inefficient for u\"..\" */\n    while (s < end && (*s & 0x80)) s++;\n    *sPtr = s;\n    return PyUnicode_DecodeUTF8(t, s - t, NULL);\n}\n\nstatic int\nwarn_invalid_escape_sequence(struct compiling *c, const node *n,\n                             unsigned char first_invalid_escape_char)\n{\n    PyObject *msg = PyUnicode_FromFormat(\"invalid escape sequence \\\\%c\",\n                                         first_invalid_escape_char);\n    if (msg == NULL) {\n        return -1;\n    }\n    if (PyErr_WarnExplicitObject(PyExc_DeprecationWarning, msg,\n                                   c->c_filename, LINENO(n),\n                                   NULL, NULL) < 0)\n    {\n        if (PyErr_ExceptionMatches(PyExc_DeprecationWarning)) {\n            const char *s;\n\n            /* Replace the DeprecationWarning exception with a SyntaxError\n               to get a more accurate error report */\n            PyErr_Clear();\n\n            s = PyUnicode_AsUTF8(msg);\n            if (s != NULL) {\n                ast_error(c, n, s);\n            }\n        }\n        Py_DECREF(msg);\n        return -1;\n    }\n    Py_DECREF(msg);\n    return 0;\n}\n\nstatic PyObject *\ndecode_unicode_with_escapes(struct compiling *c, const node *n, const char *s,\n                            size_t len)\n{\n    PyObject *v, *u;\n    char *buf;\n    char *p;\n    const char *end;\n    const char *first_invalid_escape;\n\n    /* check for integer overflow */\n    if (len > SIZE_MAX / 6)\n        return NULL;\n    /* \"ä\" (2 bytes) may become \"\\U000000E4\" (10 bytes), or 1:5\n       \"\\ä\" (3 bytes) may become \"\\u005c\\U000000E4\" (16 bytes), or ~1:6 */\n    u = PyBytes_FromStringAndSize((char *)NULL, len * 6);\n    if (u == NULL)\n        return NULL;\n    p = buf = PyBytes_AsString(u);\n    end = s + len;\n    while (s < end) {\n        if (*s == '\\\\') {\n            *p++ = *s++;\n            if (s >= end || *s & 0x80) {\n                strcpy(p, \"u005c\");\n                p += 5;\n                if (s >= end)\n                    break;\n            }\n        }\n        if (*s & 0x80) { /* XXX inefficient */\n            PyObject *w;\n            int kind;\n            void *data;\n            Py_ssize_t len, i;\n            w = decode_utf8(c, &s, end);\n            if (w == NULL) {\n                Py_DECREF(u);\n                return NULL;\n            }\n            kind = PyUnicode_KIND(w);\n            data = PyUnicode_DATA(w);\n            len = PyUnicode_GET_LENGTH(w);\n            for (i = 0; i < len; i++) {\n                Py_UCS4 chr = PyUnicode_READ(kind, data, i);\n                sprintf(p, \"\\\\U%08x\", chr);\n                p += 10;\n            }\n            /* Should be impossible to overflow */\n            assert(p - buf <= PyBytes_GET_SIZE(u));\n            Py_DECREF(w);\n        } else {\n            *p++ = *s++;\n        }\n    }\n    len = p - buf;\n    s = buf;\n\n    v = _PyUnicode_DecodeUnicodeEscape(s, len, NULL, &first_invalid_escape);\n\n    if (v != NULL && first_invalid_escape != NULL) {\n        if (warn_invalid_escape_sequence(c, n, *first_invalid_escape) < 0) {\n            /* We have not decref u before because first_invalid_escape points\n               inside u. */\n            Py_XDECREF(u);\n            Py_DECREF(v);\n            return NULL;\n        }\n    }\n    Py_XDECREF(u);\n    return v;\n}\n\nstatic PyObject *\ndecode_bytes_with_escapes(struct compiling *c, const node *n, const char *s,\n                          size_t len)\n{\n    const char *first_invalid_escape;\n\n    #if PY_MINOR_VERSION < 9\n    PyObject *result = _PyBytes_DecodeEscape(s, len, NULL, 0, NULL,\n                                             &first_invalid_escape);\n    #else\n    PyObject *result = _PyBytes_DecodeEscape(s, len, NULL,\n                                             &first_invalid_escape);\n    #endif\n    if (result == NULL)\n        return NULL;\n\n    if (first_invalid_escape != NULL) {\n        if (warn_invalid_escape_sequence(c, n, *first_invalid_escape) < 0) {\n            Py_DECREF(result);\n            return NULL;\n        }\n    }\n    return result;\n}\n\n/* Shift locations for the given node and all its children by adding `lineno`\n   and `col_offset` to existing locations. */\nstatic void fstring_shift_node_locations(node *n, int lineno, int col_offset)\n{\n    int i;\n    n->n_col_offset = n->n_col_offset + col_offset;\n    for (i = 0; i < NCH(n); ++i) {\n        if (n->n_lineno && n->n_lineno < CHILD(n, i)->n_lineno) {\n            /* Shifting column offsets unnecessary if there's been newlines. */\n            col_offset = 0;\n        }\n        fstring_shift_node_locations(CHILD(n, i), lineno, col_offset);\n    }\n    n->n_lineno = n->n_lineno + lineno;\n}\n\n/* Fix locations for the given node and its children.\n\n   `parent` is the enclosing node.\n   `n` is the node which locations are going to be fixed relative to parent.\n   `expr_str` is the child node's string representation, including braces.\n*/\nstatic void\nfstring_fix_node_location(const node *parent, node *n, char *expr_str)\n{\n    char *substr = NULL;\n    char *start;\n    int lines = LINENO(parent) - 1;\n    int cols = parent->n_col_offset;\n    /* Find the full fstring to fix location information in `n`. */\n    while (parent && parent->n_type != STRING)\n        parent = parent->n_child;\n    if (parent && parent->n_str) {\n        substr = strstr(parent->n_str, expr_str);\n        if (substr) {\n            start = substr;\n            while (start > parent->n_str) {\n                if (start[0] == '\\n')\n                    break;\n                start--;\n            }\n            cols += substr - start;\n            /* Fix lineno in mulitline strings. */\n            while ((substr = strchr(substr + 1, '\\n')))\n                lines--;\n        }\n    }\n    fstring_shift_node_locations(n, lines, cols);\n}\n\n/* Compile this expression in to an expr_ty.  Add parens around the\n   expression, in order to allow leading spaces in the expression. */\nstatic expr_ty\nfstring_compile_expr(const char *expr_start, const char *expr_end,\n                     struct compiling *c, const node *n)\n\n{\n    PyCompilerFlags cf;\n    node *mod_n;\n    mod_ty mod;\n    char *str;\n    Py_ssize_t len;\n    const char *s;\n    int iflags = 0;\n\n    assert(expr_end >= expr_start);\n    assert(*(expr_start-1) == '{');\n    assert(*expr_end == '}' || *expr_end == '!' || *expr_end == ':');\n\n    /* If the substring is all whitespace, it's an error.  We need to catch this\n       here, and not when we call PyParser_SimpleParseStringFlagsFilename,\n       because turning the expression '' in to '()' would go from being invalid\n       to valid. */\n    for (s = expr_start; s != expr_end; s++) {\n        char c = *s;\n        /* The Python parser ignores only the following whitespace\n           characters (\\r already is converted to \\n). */\n        if (!(c == ' ' || c == '\\t' || c == '\\n' || c == '\\f')) {\n            break;\n        }\n    }\n    if (s == expr_end) {\n        ast_error(c, n, \"f-string: empty expression not allowed\");\n        return NULL;\n    }\n\n    len = expr_end - expr_start;\n    /* Allocate 3 extra bytes: open paren, close paren, null byte. */\n    str = PyMem_RawMalloc(len + 3);\n    if (str == NULL) {\n        PyErr_NoMemory();\n        return NULL;\n    }\n\n    str[0] = '(';\n    memcpy(str+1, expr_start, len);\n    str[len+1] = ')';\n    str[len+2] = 0;\n\n    cf.cf_flags = PyCF_ONLY_AST;\n    _Ta3Parser_UpdateFlags(&cf, &iflags, c->c_feature_version);\n    mod_n = Ta3Parser_SimpleParseStringFlagsFilename(str, \"<fstring>\",\n                                                     Py_eval_input, iflags);\n    if (!mod_n) {\n        PyMem_RawFree(str);\n        return NULL;\n    }\n    /* Reuse str to find the correct column offset. */\n    str[0] = '{';\n    str[len+1] = '}';\n    fstring_fix_node_location(n, mod_n, str);\n    mod = Ta3AST_FromNode(mod_n, &cf, \"<fstring>\", c->c_feature_version, c->c_arena);\n    PyMem_RawFree(str);\n    Ta3Node_Free(mod_n);\n    if (!mod)\n        return NULL;\n    return mod->v.Expression.body;\n}\n\n/* Return -1 on error.\n\n   Return 0 if we reached the end of the literal.\n\n   Return 1 if we haven't reached the end of the literal, but we want\n   the caller to process the literal up to this point. Used for\n   doubled braces.\n*/\nstatic int\nfstring_find_literal(const char **str, const char *end, int raw,\n                     PyObject **literal, int recurse_lvl,\n                     struct compiling *c, const node *n)\n{\n    /* Get any literal string. It ends when we hit an un-doubled left\n       brace (which isn't part of a unicode name escape such as\n       \"\\N{EULER CONSTANT}\"), or the end of the string. */\n\n    const char *s = *str;\n    const char *literal_start = s;\n    int result = 0;\n\n    assert(*literal == NULL);\n    while (s < end) {\n        char ch = *s++;\n        if (!raw && ch == '\\\\' && s < end) {\n            ch = *s++;\n            if (ch == 'N') {\n                if (s < end && *s++ == '{') {\n                    while (s < end && *s++ != '}') {\n                    }\n                    continue;\n                }\n                break;\n            }\n            if (ch == '{' && warn_invalid_escape_sequence(c, n, ch) < 0) {\n                return -1;\n            }\n        }\n        if (ch == '{' || ch == '}') {\n            /* Check for doubled braces, but only at the top level. If\n               we checked at every level, then f'{0:{3}}' would fail\n               with the two closing braces. */\n            if (recurse_lvl == 0) {\n                if (s < end && *s == ch) {\n                    /* We're going to tell the caller that the literal ends\n                       here, but that they should continue scanning. But also\n                       skip over the second brace when we resume scanning. */\n                    *str = s + 1;\n                    result = 1;\n                    goto done;\n                }\n\n                /* Where a single '{' is the start of a new expression, a\n                   single '}' is not allowed. */\n                if (ch == '}') {\n                    *str = s - 1;\n                    ast_error(c, n, \"f-string: single '}' is not allowed\");\n                    return -1;\n                }\n            }\n            /* We're either at a '{', which means we're starting another\n               expression; or a '}', which means we're at the end of this\n               f-string (for a nested format_spec). */\n            s--;\n            break;\n        }\n    }\n    *str = s;\n    assert(s <= end);\n    assert(s == end || *s == '{' || *s == '}');\ndone:\n    if (literal_start != s) {\n        if (raw)\n            *literal = PyUnicode_DecodeUTF8Stateful(literal_start,\n                                                    s - literal_start,\n                                                    NULL, NULL);\n        else\n            *literal = decode_unicode_with_escapes(c, n, literal_start,\n                                                   s - literal_start);\n        if (!*literal)\n            return -1;\n    }\n    return result;\n}\n\n/* Forward declaration because parsing is recursive. */\nstatic expr_ty\nfstring_parse(const char **str, const char *end, int raw, int recurse_lvl,\n              struct compiling *c, const node *n);\n\n/* Parse the f-string at *str, ending at end.  We know *str starts an\n   expression (so it must be a '{'). Returns the FormattedValue node,\n   which includes the expression, conversion character, and\n   format_spec expression.\n\n   Note that I don't do a perfect job here: I don't make sure that a\n   closing brace doesn't match an opening paren, for example. It\n   doesn't need to error on all invalid expressions, just correctly\n   find the end of all valid ones. Any errors inside the expression\n   will be caught when we parse it later. */\nstatic int\nfstring_find_expr(const char **str, const char *end, int raw, int recurse_lvl,\n                  expr_ty *expression, struct compiling *c, const node *n)\n{\n    /* Return -1 on error, else 0. */\n\n    const char *expr_start;\n    const char *expr_end;\n    expr_ty simple_expression;\n    expr_ty format_spec = NULL; /* Optional format specifier. */\n    int conversion = -1; /* The conversion char. -1 if not specified. */\n\n    /* 0 if we're not in a string, else the quote char we're trying to\n       match (single or double quote). */\n    char quote_char = 0;\n\n    /* If we're inside a string, 1=normal, 3=triple-quoted. */\n    int string_type = 0;\n\n    /* Keep track of nesting level for braces/parens/brackets in\n       expressions. */\n    Py_ssize_t nested_depth = 0;\n\n    /* Can only nest one level deep. */\n    if (recurse_lvl >= 2) {\n        ast_error(c, n, \"f-string: expressions nested too deeply\");\n        return -1;\n    }\n\n    /* The first char must be a left brace, or we wouldn't have gotten\n       here. Skip over it. */\n    assert(**str == '{');\n    *str += 1;\n\n    expr_start = *str;\n    for (; *str < end; (*str)++) {\n        char ch;\n\n        /* Loop invariants. */\n        assert(nested_depth >= 0);\n        assert(*str >= expr_start && *str < end);\n        if (quote_char)\n            assert(string_type == 1 || string_type == 3);\n        else\n            assert(string_type == 0);\n\n        ch = **str;\n        /* Nowhere inside an expression is a backslash allowed. */\n        if (ch == '\\\\') {\n            /* Error: can't include a backslash character, inside\n               parens or strings or not. */\n            ast_error(c, n, \"f-string expression part \"\n                            \"cannot include a backslash\");\n            return -1;\n        }\n        if (quote_char) {\n            /* We're inside a string. See if we're at the end. */\n            /* This code needs to implement the same non-error logic\n               as tok_get from tokenizer.c, at the letter_quote\n               label. To actually share that code would be a\n               nightmare. But, it's unlikely to change and is small,\n               so duplicate it here. Note we don't need to catch all\n               of the errors, since they'll be caught when parsing the\n               expression. We just need to match the non-error\n               cases. Thus we can ignore \\n in single-quoted strings,\n               for example. Or non-terminated strings. */\n            if (ch == quote_char) {\n                /* Does this match the string_type (single or triple\n                   quoted)? */\n                if (string_type == 3) {\n                    if (*str+2 < end && *(*str+1) == ch && *(*str+2) == ch) {\n                        /* We're at the end of a triple quoted string. */\n                        *str += 2;\n                        string_type = 0;\n                        quote_char = 0;\n                        continue;\n                    }\n                } else {\n                    /* We're at the end of a normal string. */\n                    quote_char = 0;\n                    string_type = 0;\n                    continue;\n                }\n            }\n        } else if (ch == '\\'' || ch == '\"') {\n            /* Is this a triple quoted string? */\n            if (*str+2 < end && *(*str+1) == ch && *(*str+2) == ch) {\n                string_type = 3;\n                *str += 2;\n            } else {\n                /* Start of a normal string. */\n                string_type = 1;\n            }\n            /* Start looking for the end of the string. */\n            quote_char = ch;\n        } else if (ch == '[' || ch == '{' || ch == '(') {\n            nested_depth++;\n        } else if (nested_depth != 0 &&\n                   (ch == ']' || ch == '}' || ch == ')')) {\n            nested_depth--;\n        } else if (ch == '#') {\n            /* Error: can't include a comment character, inside parens\n               or not. */\n            ast_error(c, n, \"f-string expression part cannot include '#'\");\n            return -1;\n        } else if (nested_depth == 0 &&\n                   (ch == '!' || ch == ':' || ch == '}')) {\n            /* First, test for the special case of \"!=\". Since '=' is\n               not an allowed conversion character, nothing is lost in\n               this test. */\n            if (ch == '!' && *str+1 < end && *(*str+1) == '=') {\n                /* This isn't a conversion character, just continue. */\n                continue;\n            }\n            /* Normal way out of this loop. */\n            break;\n        } else {\n            /* Just consume this char and loop around. */\n        }\n    }\n    expr_end = *str;\n    /* If we leave this loop in a string or with mismatched parens, we\n       don't care. We'll get a syntax error when compiling the\n       expression. But, we can produce a better error message, so\n       let's just do that.*/\n    if (quote_char) {\n        ast_error(c, n, \"f-string: unterminated string\");\n        return -1;\n    }\n    if (nested_depth) {\n        ast_error(c, n, \"f-string: mismatched '(', '{', or '['\");\n        return -1;\n    }\n\n    if (*str >= end)\n        goto unexpected_end_of_string;\n\n    /* Compile the expression as soon as possible, so we show errors\n       related to the expression before errors related to the\n       conversion or format_spec. */\n    simple_expression = fstring_compile_expr(expr_start, expr_end, c, n);\n    if (!simple_expression)\n        return -1;\n\n    /* Check for a conversion char, if present. */\n    if (**str == '!') {\n        *str += 1;\n        if (*str >= end)\n            goto unexpected_end_of_string;\n\n        conversion = **str;\n        *str += 1;\n\n        /* Validate the conversion. */\n        if (!(conversion == 's' || conversion == 'r'\n              || conversion == 'a')) {\n            ast_error(c, n, \"f-string: invalid conversion character: \"\n                            \"expected 's', 'r', or 'a'\");\n            return -1;\n        }\n    }\n\n    /* Check for the format spec, if present. */\n    if (*str >= end)\n        goto unexpected_end_of_string;\n    if (**str == ':') {\n        *str += 1;\n        if (*str >= end)\n            goto unexpected_end_of_string;\n\n        /* Parse the format spec. */\n        format_spec = fstring_parse(str, end, raw, recurse_lvl+1, c, n);\n        if (!format_spec)\n            return -1;\n    }\n\n    if (*str >= end || **str != '}')\n        goto unexpected_end_of_string;\n\n    /* We're at a right brace. Consume it. */\n    assert(*str < end);\n    assert(**str == '}');\n    *str += 1;\n\n    /* And now create the FormattedValue node that represents this\n       entire expression with the conversion and format spec. */\n    *expression = FormattedValue(simple_expression, conversion,\n                                 format_spec, LINENO(n), n->n_col_offset,\n                                 c->c_arena);\n    if (!*expression)\n        return -1;\n\n    return 0;\n\nunexpected_end_of_string:\n    ast_error(c, n, \"f-string: expecting '}'\");\n    return -1;\n}\n\n/* Return -1 on error.\n\n   Return 0 if we have a literal (possible zero length) and an\n   expression (zero length if at the end of the string.\n\n   Return 1 if we have a literal, but no expression, and we want the\n   caller to call us again. This is used to deal with doubled\n   braces.\n\n   When called multiple times on the string 'a{{b{0}c', this function\n   will return:\n\n   1. the literal 'a{' with no expression, and a return value\n      of 1. Despite the fact that there's no expression, the return\n      value of 1 means we're not finished yet.\n\n   2. the literal 'b' and the expression '0', with a return value of\n      0. The fact that there's an expression means we're not finished.\n\n   3. literal 'c' with no expression and a return value of 0. The\n      combination of the return value of 0 with no expression means\n      we're finished.\n*/\nstatic int\nfstring_find_literal_and_expr(const char **str, const char *end, int raw,\n                              int recurse_lvl, PyObject **literal,\n                              expr_ty *expression,\n                              struct compiling *c, const node *n)\n{\n    int result;\n\n    assert(*literal == NULL && *expression == NULL);\n\n    /* Get any literal string. */\n    result = fstring_find_literal(str, end, raw, literal, recurse_lvl, c, n);\n    if (result < 0)\n        goto error;\n\n    assert(result == 0 || result == 1);\n\n    if (result == 1)\n        /* We have a literal, but don't look at the expression. */\n        return 1;\n\n    if (*str >= end || **str == '}')\n        /* We're at the end of the string or the end of a nested\n           f-string: no expression. The top-level error case where we\n           expect to be at the end of the string but we're at a '}' is\n           handled later. */\n        return 0;\n\n    /* We must now be the start of an expression, on a '{'. */\n    assert(**str == '{');\n\n    if (fstring_find_expr(str, end, raw, recurse_lvl, expression, c, n) < 0)\n        goto error;\n\n    return 0;\n\nerror:\n    Py_CLEAR(*literal);\n    return -1;\n}\n\n#define EXPRLIST_N_CACHED  64\n\ntypedef struct {\n    /* Incrementally build an array of expr_ty, so be used in an\n       asdl_seq. Cache some small but reasonably sized number of\n       expr_ty's, and then after that start dynamically allocating,\n       doubling the number allocated each time. Note that the f-string\n       f'{0}a{1}' contains 3 expr_ty's: 2 FormattedValue's, and one\n       Str for the literal 'a'. So you add expr_ty's about twice as\n       fast as you add exressions in an f-string. */\n\n    Py_ssize_t allocated;  /* Number we've allocated. */\n    Py_ssize_t size;       /* Number we've used. */\n    expr_ty    *p;         /* Pointer to the memory we're actually\n                              using. Will point to 'data' until we\n                              start dynamically allocating. */\n    expr_ty    data[EXPRLIST_N_CACHED];\n} ExprList;\n\n#ifdef NDEBUG\n#define ExprList_check_invariants(l)\n#else\nstatic void\nExprList_check_invariants(ExprList *l)\n{\n    /* Check our invariants. Make sure this object is \"live\", and\n       hasn't been deallocated. */\n    assert(l->size >= 0);\n    assert(l->p != NULL);\n    if (l->size <= EXPRLIST_N_CACHED)\n        assert(l->data == l->p);\n}\n#endif\n\nstatic void\nExprList_Init(ExprList *l)\n{\n    l->allocated = EXPRLIST_N_CACHED;\n    l->size = 0;\n\n    /* Until we start allocating dynamically, p points to data. */\n    l->p = l->data;\n\n    ExprList_check_invariants(l);\n}\n\nstatic int\nExprList_Append(ExprList *l, expr_ty exp)\n{\n    ExprList_check_invariants(l);\n    if (l->size >= l->allocated) {\n        /* We need to alloc (or realloc) the memory. */\n        Py_ssize_t new_size = l->allocated * 2;\n\n        /* See if we've ever allocated anything dynamically. */\n        if (l->p == l->data) {\n            Py_ssize_t i;\n            /* We're still using the cached data. Switch to\n               alloc-ing. */\n            l->p = PyMem_RawMalloc(sizeof(expr_ty) * new_size);\n            if (!l->p)\n                return -1;\n            /* Copy the cached data into the new buffer. */\n            for (i = 0; i < l->size; i++)\n                l->p[i] = l->data[i];\n        } else {\n            /* Just realloc. */\n            expr_ty *tmp = PyMem_RawRealloc(l->p, sizeof(expr_ty) * new_size);\n            if (!tmp) {\n                PyMem_RawFree(l->p);\n                l->p = NULL;\n                return -1;\n            }\n            l->p = tmp;\n        }\n\n        l->allocated = new_size;\n        assert(l->allocated == 2 * l->size);\n    }\n\n    l->p[l->size++] = exp;\n\n    ExprList_check_invariants(l);\n    return 0;\n}\n\nstatic void\nExprList_Dealloc(ExprList *l)\n{\n    ExprList_check_invariants(l);\n\n    /* If there's been an error, or we've never dynamically allocated,\n       do nothing. */\n    if (!l->p || l->p == l->data) {\n        /* Do nothing. */\n    } else {\n        /* We have dynamically allocated. Free the memory. */\n        PyMem_RawFree(l->p);\n    }\n    l->p = NULL;\n    l->size = -1;\n}\n\nstatic asdl_seq *\nExprList_Finish(ExprList *l, PyArena *arena)\n{\n    asdl_seq *seq;\n\n    ExprList_check_invariants(l);\n\n    /* Allocate the asdl_seq and copy the expressions in to it. */\n    seq = _Ta3_asdl_seq_new(l->size, arena);\n    if (seq) {\n        Py_ssize_t i;\n        for (i = 0; i < l->size; i++)\n            asdl_seq_SET(seq, i, l->p[i]);\n    }\n    ExprList_Dealloc(l);\n    return seq;\n}\n\n/* The FstringParser is designed to add a mix of strings and\n   f-strings, and concat them together as needed. Ultimately, it\n   generates an expr_ty. */\ntypedef struct {\n    PyObject *last_str;\n    ExprList expr_list;\n    int fmode;\n} FstringParser;\n\n#ifdef NDEBUG\n#define FstringParser_check_invariants(state)\n#else\nstatic void\nFstringParser_check_invariants(FstringParser *state)\n{\n    if (state->last_str)\n        assert(PyUnicode_CheckExact(state->last_str));\n    ExprList_check_invariants(&state->expr_list);\n}\n#endif\n\nstatic void\nFstringParser_Init(FstringParser *state)\n{\n    state->last_str = NULL;\n    state->fmode = 0;\n    ExprList_Init(&state->expr_list);\n    FstringParser_check_invariants(state);\n}\n\nstatic void\nFstringParser_Dealloc(FstringParser *state)\n{\n    FstringParser_check_invariants(state);\n\n    Py_XDECREF(state->last_str);\n    ExprList_Dealloc(&state->expr_list);\n}\n\nstatic PyObject *\nmake_str_kind(const char *raw) {\n    /* currently Python allows up to 2 string modifiers */\n    char *ch, s_kind[3] = {0, 0, 0};\n    ch = s_kind;\n    while (*raw && *raw != '\\'' && *raw != '\"') {\n        *ch++ = *raw++;\n    }\n    return PyUnicode_FromString(s_kind);\n}\n\n\n/* Make a Str node, but decref the PyUnicode object being added. */\nstatic expr_ty\nmake_str_node_and_del(PyObject **str, struct compiling *c, const node* n)\n{\n    PyObject *s = *str;\n    PyObject *kind = make_str_kind(STR(CHILD(n, 0)));\n    if (!kind) {\n        return NULL;\n    }\n    *str = NULL;\n    assert(PyUnicode_CheckExact(s));\n    if (PyArena_AddPyObject(c->c_arena, s) < 0) {\n        Py_DECREF(s);\n        return NULL;\n    }\n    return Str(s, kind, LINENO(n), n->n_col_offset, c->c_arena);\n}\n\n/* Add a non-f-string (that is, a regular literal string). str is\n   decref'd. */\nstatic int\nFstringParser_ConcatAndDel(FstringParser *state, PyObject *str)\n{\n    FstringParser_check_invariants(state);\n\n    assert(PyUnicode_CheckExact(str));\n\n    if (PyUnicode_GET_LENGTH(str) == 0) {\n        Py_DECREF(str);\n        return 0;\n    }\n\n    if (!state->last_str) {\n        /* We didn't have a string before, so just remember this one. */\n        state->last_str = str;\n    } else {\n        /* Concatenate this with the previous string. */\n        PyUnicode_AppendAndDel(&state->last_str, str);\n        if (!state->last_str)\n            return -1;\n    }\n    FstringParser_check_invariants(state);\n    return 0;\n}\n\n/* Parse an f-string. The f-string is in *str to end, with no\n   'f' or quotes. */\nstatic int\nFstringParser_ConcatFstring(FstringParser *state, const char **str,\n                            const char *end, int raw, int recurse_lvl,\n                            struct compiling *c, const node *n)\n{\n    FstringParser_check_invariants(state);\n    state->fmode = 1;\n\n    /* Parse the f-string. */\n    while (1) {\n        PyObject *literal = NULL;\n        expr_ty expression = NULL;\n\n        /* If there's a zero length literal in front of the\n           expression, literal will be NULL. If we're at the end of\n           the f-string, expression will be NULL (unless result == 1,\n           see below). */\n        int result = fstring_find_literal_and_expr(str, end, raw, recurse_lvl,\n                                                   &literal, &expression,\n                                                   c, n);\n        if (result < 0)\n            return -1;\n\n        /* Add the literal, if any. */\n        if (!literal) {\n            /* Do nothing. Just leave last_str alone (and possibly\n               NULL). */\n        } else if (!state->last_str) {\n            /*  Note that the literal can be zero length, if the\n                input string is \"\\\\\\n\" or \"\\\\\\r\", among others. */\n            state->last_str = literal;\n            literal = NULL;\n        } else {\n            /* We have a literal, concatenate it. */\n            assert(PyUnicode_GET_LENGTH(literal) != 0);\n            if (FstringParser_ConcatAndDel(state, literal) < 0)\n                return -1;\n            literal = NULL;\n        }\n\n        /* We've dealt with the literal now. It can't be leaked on further\n           errors. */\n        assert(literal == NULL);\n\n        /* See if we should just loop around to get the next literal\n           and expression, while ignoring the expression this\n           time. This is used for un-doubling braces, as an\n           optimization. */\n        if (result == 1)\n            continue;\n\n        if (!expression)\n            /* We're done with this f-string. */\n            break;\n\n        /* We know we have an expression. Convert any existing string\n           to a Str node. */\n        if (!state->last_str) {\n            /* Do nothing. No previous literal. */\n        } else {\n            /* Convert the existing last_str literal to a Str node. */\n            expr_ty str = make_str_node_and_del(&state->last_str, c, n);\n            if (!str || ExprList_Append(&state->expr_list, str) < 0)\n                return -1;\n        }\n\n        if (ExprList_Append(&state->expr_list, expression) < 0)\n            return -1;\n    }\n\n    /* If recurse_lvl is zero, then we must be at the end of the\n       string. Otherwise, we must be at a right brace. */\n\n    if (recurse_lvl == 0 && *str < end-1) {\n        ast_error(c, n, \"f-string: unexpected end of string\");\n        return -1;\n    }\n    if (recurse_lvl != 0 && **str != '}') {\n        ast_error(c, n, \"f-string: expecting '}'\");\n        return -1;\n    }\n\n    FstringParser_check_invariants(state);\n    return 0;\n}\n\n/* Convert the partial state reflected in last_str and expr_list to an\n   expr_ty. The expr_ty can be a Str, or a JoinedStr. */\nstatic expr_ty\nFstringParser_Finish(FstringParser *state, struct compiling *c,\n                     const node *n)\n{\n    asdl_seq *seq;\n\n    FstringParser_check_invariants(state);\n\n    /* If we're just a constant string with no expressions, return\n       that. */\n    if (!state->fmode) {\n        assert(!state->expr_list.size);\n        if (!state->last_str) {\n            /* Create a zero length string. */\n            state->last_str = PyUnicode_FromStringAndSize(NULL, 0);\n            if (!state->last_str)\n                goto error;\n        }\n        return make_str_node_and_del(&state->last_str, c, n);\n    }\n\n    /* Create a Str node out of last_str, if needed. It will be the\n       last node in our expression list. */\n    if (state->last_str) {\n        expr_ty str = make_str_node_and_del(&state->last_str, c, n);\n        if (!str || ExprList_Append(&state->expr_list, str) < 0)\n            goto error;\n    }\n    /* This has already been freed. */\n    assert(state->last_str == NULL);\n\n    seq = ExprList_Finish(&state->expr_list, c->c_arena);\n    if (!seq)\n        goto error;\n\n    return JoinedStr(seq, LINENO(n), n->n_col_offset, c->c_arena);\n\nerror:\n    FstringParser_Dealloc(state);\n    return NULL;\n}\n\n/* Given an f-string (with no 'f' or quotes) that's in *str and ends\n   at end, parse it into an expr_ty.  Return NULL on error.  Adjust\n   str to point past the parsed portion. */\nstatic expr_ty\nfstring_parse(const char **str, const char *end, int raw, int recurse_lvl,\n              struct compiling *c, const node *n)\n{\n    FstringParser state;\n\n    FstringParser_Init(&state);\n    if (FstringParser_ConcatFstring(&state, str, end, raw, recurse_lvl,\n                                    c, n) < 0) {\n        FstringParser_Dealloc(&state);\n        return NULL;\n    }\n\n    return FstringParser_Finish(&state, c, n);\n}\n\n/* n is a Python string literal, including the bracketing quote\n   characters, and r, b, u, &/or f prefixes (if any), and embedded\n   escape sequences (if any). parsestr parses it, and sets *result to\n   decoded Python string object.  If the string is an f-string, set\n   *fstr and *fstrlen to the unparsed string object.  Return 0 if no\n   errors occurred.\n*/\nstatic int\nparsestr(struct compiling *c, const node *n, int *bytesmode, int *rawmode,\n         PyObject **result, const char **fstr, Py_ssize_t *fstrlen)\n{\n    size_t len;\n    const char *s = STR(n);\n    int quote = Py_CHARMASK(*s);\n    int fmode = 0;\n    *bytesmode = 0;\n    *rawmode = 0;\n    *result = NULL;\n    *fstr = NULL;\n    if (Py_ISALPHA(quote)) {\n        while (!*bytesmode || !*rawmode) {\n            if (quote == 'b' || quote == 'B') {\n                quote = *++s;\n                *bytesmode = 1;\n            }\n            else if (quote == 'u' || quote == 'U') {\n                quote = *++s;\n            }\n            else if (quote == 'r' || quote == 'R') {\n                quote = *++s;\n                *rawmode = 1;\n            }\n            else if (quote == 'f' || quote == 'F') {\n                quote = *++s;\n                fmode = 1;\n            }\n            else {\n                break;\n            }\n        }\n    }\n    /* fstrings are only allowed in Python 3.6 and greater */\n    if (fmode && c->c_feature_version < 6) {\n        ast_error(c, n, \"Format strings are only supported in Python 3.6 and greater\");\n        return -1;\n    }\n    if (fmode && *bytesmode) {\n        PyErr_BadInternalCall();\n        return -1;\n    }\n    if (quote != '\\'' && quote != '\\\"') {\n        PyErr_BadInternalCall();\n        return -1;\n    }\n    /* Skip the leading quote char. */\n    s++;\n    len = strlen(s);\n    if (len > INT_MAX) {\n        PyErr_SetString(PyExc_OverflowError,\n                        \"string to parse is too long\");\n        return -1;\n    }\n    if (s[--len] != quote) {\n        /* Last quote char must match the first. */\n        PyErr_BadInternalCall();\n        return -1;\n    }\n    if (len >= 4 && s[0] == quote && s[1] == quote) {\n        /* A triple quoted string. We've already skipped one quote at\n           the start and one at the end of the string. Now skip the\n           two at the start. */\n        s += 2;\n        len -= 2;\n        /* And check that the last two match. */\n        if (s[--len] != quote || s[--len] != quote) {\n            PyErr_BadInternalCall();\n            return -1;\n        }\n    }\n\n    if (fmode) {\n        /* Just return the bytes. The caller will parse the resulting\n           string. */\n        *fstr = s;\n        *fstrlen = len;\n        return 0;\n    }\n\n    /* Not an f-string. */\n    /* Avoid invoking escape decoding routines if possible. */\n    *rawmode = *rawmode || strchr(s, '\\\\') == NULL;\n    if (*bytesmode) {\n        /* Disallow non-ASCII characters. */\n        const char *ch;\n        for (ch = s; *ch; ch++) {\n            if (Py_CHARMASK(*ch) >= 0x80) {\n                ast_error(c, n, \"bytes can only contain ASCII \"\n                          \"literal characters.\");\n                return -1;\n            }\n        }\n        if (*rawmode)\n            *result = PyBytes_FromStringAndSize(s, len);\n        else\n            *result = decode_bytes_with_escapes(c, n, s, len);\n    } else {\n        if (*rawmode)\n            *result = PyUnicode_DecodeUTF8Stateful(s, len, NULL, NULL);\n        else\n            *result = decode_unicode_with_escapes(c, n, s, len);\n    }\n    return *result == NULL ? -1 : 0;\n}\n\n/* Accepts a STRING+ atom, and produces an expr_ty node. Run through\n   each STRING atom, and process it as needed. For bytes, just\n   concatenate them together, and the result will be a Bytes node. For\n   normal strings and f-strings, concatenate them together. The result\n   will be a Str node if there were no f-strings; a FormattedValue\n   node if there's just an f-string (with no leading or trailing\n   literals), or a JoinedStr node if there are multiple f-strings or\n   any literals involved. */\nstatic expr_ty\nparsestrplus(struct compiling *c, const node *n)\n{\n    int bytesmode = 0;\n    PyObject *bytes_str = NULL;\n    int i;\n\n    FstringParser state;\n    FstringParser_Init(&state);\n\n    for (i = 0; i < NCH(n); i++) {\n        int this_bytesmode;\n        int this_rawmode;\n        PyObject *s;\n        const char *fstr;\n        Py_ssize_t fstrlen = -1;  /* Silence a compiler warning. */\n\n        REQ(CHILD(n, i), STRING);\n        if (parsestr(c, CHILD(n, i), &this_bytesmode, &this_rawmode, &s,\n                     &fstr, &fstrlen) != 0)\n            goto error;\n\n        /* Check that we're not mixing bytes with unicode. */\n        if (i != 0 && bytesmode != this_bytesmode) {\n            ast_error(c, n, \"cannot mix bytes and nonbytes literals\");\n            /* s is NULL if the current string part is an f-string. */\n            Py_XDECREF(s);\n            goto error;\n        }\n        bytesmode = this_bytesmode;\n\n        if (fstr != NULL) {\n            int result;\n            assert(s == NULL && !bytesmode);\n            /* This is an f-string. Parse and concatenate it. */\n            result = FstringParser_ConcatFstring(&state, &fstr, fstr+fstrlen,\n                                                 this_rawmode, 0, c, n);\n            if (result < 0)\n                goto error;\n        } else {\n            /* A string or byte string. */\n            assert(s != NULL && fstr == NULL);\n\n            assert(bytesmode ? PyBytes_CheckExact(s) :\n                   PyUnicode_CheckExact(s));\n\n            if (bytesmode) {\n                /* For bytes, concat as we go. */\n                if (i == 0) {\n                    /* First time, just remember this value. */\n                    bytes_str = s;\n                } else {\n                    PyBytes_ConcatAndDel(&bytes_str, s);\n                    if (!bytes_str)\n                        goto error;\n                }\n            } else {\n                /* This is a regular string. Concatenate it. */\n                if (FstringParser_ConcatAndDel(&state, s) < 0)\n                    goto error;\n            }\n        }\n    }\n    if (bytesmode) {\n        PyObject *kind = make_str_kind(STR(CHILD(n, 0)));\n\n        /* Just return the bytes object and we're done. */\n        if (PyArena_AddPyObject(c->c_arena, bytes_str) < 0) {\n            Py_DECREF(kind);\n            goto error;\n        }\n        return Bytes(bytes_str, kind, LINENO(n), n->n_col_offset, c->c_arena);\n    }\n\n    /* We're not a bytes string, bytes_str should never have been set. */\n    assert(bytes_str == NULL);\n\n    return FstringParser_Finish(&state, c, n);\n\nerror:\n    Py_XDECREF(bytes_str);\n    FstringParser_Dealloc(&state);\n    return NULL;\n}\n"
  },
  {
    "path": "ast3/Python/graminit.c",
    "content": "/* Generated by Parser/pgen */\n\n#include \"../Include/pgenheaders.h\"\n#include \"../Include/grammar.h\"\nextern grammar _Ta3Parser_Grammar;\nstatic arc arcs_0_0[3] = {\n    {2, 1},\n    {3, 1},\n    {4, 2},\n};\nstatic arc arcs_0_1[1] = {\n    {0, 1},\n};\nstatic arc arcs_0_2[1] = {\n    {2, 1},\n};\nstatic state states_0[3] = {\n    {3, arcs_0_0},\n    {1, arcs_0_1},\n    {1, arcs_0_2},\n};\nstatic arc arcs_1_0[3] = {\n    {2, 0},\n    {6, 0},\n    {7, 1},\n};\nstatic arc arcs_1_1[1] = {\n    {0, 1},\n};\nstatic state states_1[2] = {\n    {3, arcs_1_0},\n    {1, arcs_1_1},\n};\nstatic arc arcs_2_0[1] = {\n    {9, 1},\n};\nstatic arc arcs_2_1[2] = {\n    {2, 1},\n    {7, 2},\n};\nstatic arc arcs_2_2[1] = {\n    {0, 2},\n};\nstatic state states_2[3] = {\n    {1, arcs_2_0},\n    {2, arcs_2_1},\n    {1, arcs_2_2},\n};\nstatic arc arcs_3_0[1] = {\n    {11, 1},\n};\nstatic arc arcs_3_1[1] = {\n    {12, 2},\n};\nstatic arc arcs_3_2[2] = {\n    {13, 3},\n    {2, 4},\n};\nstatic arc arcs_3_3[2] = {\n    {14, 5},\n    {15, 6},\n};\nstatic arc arcs_3_4[1] = {\n    {0, 4},\n};\nstatic arc arcs_3_5[1] = {\n    {15, 6},\n};\nstatic arc arcs_3_6[1] = {\n    {2, 4},\n};\nstatic state states_3[7] = {\n    {1, arcs_3_0},\n    {1, arcs_3_1},\n    {2, arcs_3_2},\n    {2, arcs_3_3},\n    {1, arcs_3_4},\n    {1, arcs_3_5},\n    {1, arcs_3_6},\n};\nstatic arc arcs_4_0[1] = {\n    {10, 1},\n};\nstatic arc arcs_4_1[2] = {\n    {10, 1},\n    {0, 1},\n};\nstatic state states_4[2] = {\n    {1, arcs_4_0},\n    {2, arcs_4_1},\n};\nstatic arc arcs_5_0[1] = {\n    {16, 1},\n};\nstatic arc arcs_5_1[3] = {\n    {18, 2},\n    {19, 2},\n    {20, 2},\n};\nstatic arc arcs_5_2[1] = {\n    {0, 2},\n};\nstatic state states_5[3] = {\n    {1, arcs_5_0},\n    {3, arcs_5_1},\n    {1, arcs_5_2},\n};\nstatic arc arcs_6_0[1] = {\n    {21, 1},\n};\nstatic arc arcs_6_1[1] = {\n    {19, 2},\n};\nstatic arc arcs_6_2[1] = {\n    {0, 2},\n};\nstatic state states_6[3] = {\n    {1, arcs_6_0},\n    {1, arcs_6_1},\n    {1, arcs_6_2},\n};\nstatic arc arcs_7_0[1] = {\n    {22, 1},\n};\nstatic arc arcs_7_1[1] = {\n    {23, 2},\n};\nstatic arc arcs_7_2[1] = {\n    {24, 3},\n};\nstatic arc arcs_7_3[2] = {\n    {25, 4},\n    {27, 5},\n};\nstatic arc arcs_7_4[1] = {\n    {26, 6},\n};\nstatic arc arcs_7_5[2] = {\n    {28, 7},\n    {29, 8},\n};\nstatic arc arcs_7_6[1] = {\n    {27, 5},\n};\nstatic arc arcs_7_7[1] = {\n    {29, 8},\n};\nstatic arc arcs_7_8[1] = {\n    {0, 8},\n};\nstatic state states_7[9] = {\n    {1, arcs_7_0},\n    {1, arcs_7_1},\n    {1, arcs_7_2},\n    {2, arcs_7_3},\n    {1, arcs_7_4},\n    {2, arcs_7_5},\n    {1, arcs_7_6},\n    {1, arcs_7_7},\n    {1, arcs_7_8},\n};\nstatic arc arcs_8_0[1] = {\n    {13, 1},\n};\nstatic arc arcs_8_1[2] = {\n    {30, 2},\n    {15, 3},\n};\nstatic arc arcs_8_2[1] = {\n    {15, 3},\n};\nstatic arc arcs_8_3[1] = {\n    {0, 3},\n};\nstatic state states_8[4] = {\n    {1, arcs_8_0},\n    {2, arcs_8_1},\n    {1, arcs_8_2},\n    {1, arcs_8_3},\n};\nstatic arc arcs_9_0[3] = {\n    {31, 1},\n    {34, 2},\n    {35, 3},\n};\nstatic arc arcs_9_1[4] = {\n    {32, 4},\n    {33, 5},\n    {28, 6},\n    {0, 1},\n};\nstatic arc arcs_9_2[4] = {\n    {31, 7},\n    {33, 8},\n    {28, 6},\n    {0, 2},\n};\nstatic arc arcs_9_3[1] = {\n    {31, 9},\n};\nstatic arc arcs_9_4[1] = {\n    {26, 10},\n};\nstatic arc arcs_9_5[5] = {\n    {28, 11},\n    {31, 12},\n    {34, 13},\n    {35, 3},\n    {0, 5},\n};\nstatic arc arcs_9_6[1] = {\n    {0, 6},\n};\nstatic arc arcs_9_7[3] = {\n    {33, 8},\n    {28, 6},\n    {0, 7},\n};\nstatic arc arcs_9_8[4] = {\n    {28, 14},\n    {31, 15},\n    {35, 3},\n    {0, 8},\n};\nstatic arc arcs_9_9[3] = {\n    {33, 16},\n    {28, 6},\n    {0, 9},\n};\nstatic arc arcs_9_10[3] = {\n    {33, 5},\n    {28, 6},\n    {0, 10},\n};\nstatic arc arcs_9_11[4] = {\n    {31, 12},\n    {34, 13},\n    {35, 3},\n    {0, 11},\n};\nstatic arc arcs_9_12[4] = {\n    {33, 5},\n    {32, 4},\n    {28, 6},\n    {0, 12},\n};\nstatic arc arcs_9_13[4] = {\n    {31, 17},\n    {33, 18},\n    {28, 6},\n    {0, 13},\n};\nstatic arc arcs_9_14[3] = {\n    {31, 15},\n    {35, 3},\n    {0, 14},\n};\nstatic arc arcs_9_15[4] = {\n    {33, 8},\n    {32, 19},\n    {28, 6},\n    {0, 15},\n};\nstatic arc arcs_9_16[2] = {\n    {28, 6},\n    {0, 16},\n};\nstatic arc arcs_9_17[3] = {\n    {33, 18},\n    {28, 6},\n    {0, 17},\n};\nstatic arc arcs_9_18[4] = {\n    {28, 20},\n    {31, 21},\n    {35, 3},\n    {0, 18},\n};\nstatic arc arcs_9_19[1] = {\n    {26, 7},\n};\nstatic arc arcs_9_20[3] = {\n    {31, 21},\n    {35, 3},\n    {0, 20},\n};\nstatic arc arcs_9_21[4] = {\n    {33, 18},\n    {32, 22},\n    {28, 6},\n    {0, 21},\n};\nstatic arc arcs_9_22[1] = {\n    {26, 17},\n};\nstatic state states_9[23] = {\n    {3, arcs_9_0},\n    {4, arcs_9_1},\n    {4, arcs_9_2},\n    {1, arcs_9_3},\n    {1, arcs_9_4},\n    {5, arcs_9_5},\n    {1, arcs_9_6},\n    {3, arcs_9_7},\n    {4, arcs_9_8},\n    {3, arcs_9_9},\n    {3, arcs_9_10},\n    {4, arcs_9_11},\n    {4, arcs_9_12},\n    {4, arcs_9_13},\n    {3, arcs_9_14},\n    {4, arcs_9_15},\n    {2, arcs_9_16},\n    {3, arcs_9_17},\n    {4, arcs_9_18},\n    {1, arcs_9_19},\n    {3, arcs_9_20},\n    {4, arcs_9_21},\n    {1, arcs_9_22},\n};\nstatic arc arcs_10_0[1] = {\n    {23, 1},\n};\nstatic arc arcs_10_1[2] = {\n    {27, 2},\n    {0, 1},\n};\nstatic arc arcs_10_2[1] = {\n    {26, 3},\n};\nstatic arc arcs_10_3[1] = {\n    {0, 3},\n};\nstatic state states_10[4] = {\n    {1, arcs_10_0},\n    {2, arcs_10_1},\n    {1, arcs_10_2},\n    {1, arcs_10_3},\n};\nstatic arc arcs_11_0[3] = {\n    {37, 1},\n    {34, 2},\n    {35, 3},\n};\nstatic arc arcs_11_1[3] = {\n    {32, 4},\n    {33, 5},\n    {0, 1},\n};\nstatic arc arcs_11_2[3] = {\n    {37, 6},\n    {33, 7},\n    {0, 2},\n};\nstatic arc arcs_11_3[1] = {\n    {37, 8},\n};\nstatic arc arcs_11_4[1] = {\n    {26, 9},\n};\nstatic arc arcs_11_5[4] = {\n    {37, 10},\n    {34, 11},\n    {35, 3},\n    {0, 5},\n};\nstatic arc arcs_11_6[2] = {\n    {33, 7},\n    {0, 6},\n};\nstatic arc arcs_11_7[3] = {\n    {37, 12},\n    {35, 3},\n    {0, 7},\n};\nstatic arc arcs_11_8[2] = {\n    {33, 13},\n    {0, 8},\n};\nstatic arc arcs_11_9[2] = {\n    {33, 5},\n    {0, 9},\n};\nstatic arc arcs_11_10[3] = {\n    {33, 5},\n    {32, 4},\n    {0, 10},\n};\nstatic arc arcs_11_11[3] = {\n    {37, 14},\n    {33, 15},\n    {0, 11},\n};\nstatic arc arcs_11_12[3] = {\n    {33, 7},\n    {32, 16},\n    {0, 12},\n};\nstatic arc arcs_11_13[1] = {\n    {0, 13},\n};\nstatic arc arcs_11_14[2] = {\n    {33, 15},\n    {0, 14},\n};\nstatic arc arcs_11_15[3] = {\n    {37, 17},\n    {35, 3},\n    {0, 15},\n};\nstatic arc arcs_11_16[1] = {\n    {26, 6},\n};\nstatic arc arcs_11_17[3] = {\n    {33, 15},\n    {32, 18},\n    {0, 17},\n};\nstatic arc arcs_11_18[1] = {\n    {26, 14},\n};\nstatic state states_11[19] = {\n    {3, arcs_11_0},\n    {3, arcs_11_1},\n    {3, arcs_11_2},\n    {1, arcs_11_3},\n    {1, arcs_11_4},\n    {4, arcs_11_5},\n    {2, arcs_11_6},\n    {3, arcs_11_7},\n    {2, arcs_11_8},\n    {2, arcs_11_9},\n    {3, arcs_11_10},\n    {3, arcs_11_11},\n    {3, arcs_11_12},\n    {1, arcs_11_13},\n    {2, arcs_11_14},\n    {3, arcs_11_15},\n    {1, arcs_11_16},\n    {3, arcs_11_17},\n    {1, arcs_11_18},\n};\nstatic arc arcs_12_0[1] = {\n    {23, 1},\n};\nstatic arc arcs_12_1[1] = {\n    {0, 1},\n};\nstatic state states_12[2] = {\n    {1, arcs_12_0},\n    {1, arcs_12_1},\n};\nstatic arc arcs_13_0[2] = {\n    {3, 1},\n    {4, 1},\n};\nstatic arc arcs_13_1[1] = {\n    {0, 1},\n};\nstatic state states_13[2] = {\n    {2, arcs_13_0},\n    {1, arcs_13_1},\n};\nstatic arc arcs_14_0[1] = {\n    {38, 1},\n};\nstatic arc arcs_14_1[2] = {\n    {39, 2},\n    {2, 3},\n};\nstatic arc arcs_14_2[2] = {\n    {38, 1},\n    {2, 3},\n};\nstatic arc arcs_14_3[1] = {\n    {0, 3},\n};\nstatic state states_14[4] = {\n    {1, arcs_14_0},\n    {2, arcs_14_1},\n    {2, arcs_14_2},\n    {1, arcs_14_3},\n};\nstatic arc arcs_15_0[8] = {\n    {40, 1},\n    {41, 1},\n    {42, 1},\n    {43, 1},\n    {44, 1},\n    {45, 1},\n    {46, 1},\n    {47, 1},\n};\nstatic arc arcs_15_1[1] = {\n    {0, 1},\n};\nstatic state states_15[2] = {\n    {8, arcs_15_0},\n    {1, arcs_15_1},\n};\nstatic arc arcs_16_0[1] = {\n    {48, 1},\n};\nstatic arc arcs_16_1[5] = {\n    {49, 2},\n    {50, 3},\n    {32, 4},\n    {28, 2},\n    {0, 1},\n};\nstatic arc arcs_16_2[1] = {\n    {0, 2},\n};\nstatic arc arcs_16_3[2] = {\n    {51, 2},\n    {9, 2},\n};\nstatic arc arcs_16_4[2] = {\n    {51, 5},\n    {48, 5},\n};\nstatic arc arcs_16_5[3] = {\n    {32, 4},\n    {28, 2},\n    {0, 5},\n};\nstatic state states_16[6] = {\n    {1, arcs_16_0},\n    {5, arcs_16_1},\n    {1, arcs_16_2},\n    {2, arcs_16_3},\n    {2, arcs_16_4},\n    {3, arcs_16_5},\n};\nstatic arc arcs_17_0[1] = {\n    {27, 1},\n};\nstatic arc arcs_17_1[1] = {\n    {26, 2},\n};\nstatic arc arcs_17_2[2] = {\n    {32, 3},\n    {0, 2},\n};\nstatic arc arcs_17_3[1] = {\n    {26, 4},\n};\nstatic arc arcs_17_4[1] = {\n    {0, 4},\n};\nstatic state states_17[5] = {\n    {1, arcs_17_0},\n    {1, arcs_17_1},\n    {2, arcs_17_2},\n    {1, arcs_17_3},\n    {1, arcs_17_4},\n};\nstatic arc arcs_18_0[2] = {\n    {26, 1},\n    {52, 1},\n};\nstatic arc arcs_18_1[2] = {\n    {33, 2},\n    {0, 1},\n};\nstatic arc arcs_18_2[3] = {\n    {26, 1},\n    {52, 1},\n    {0, 2},\n};\nstatic state states_18[3] = {\n    {2, arcs_18_0},\n    {2, arcs_18_1},\n    {3, arcs_18_2},\n};\nstatic arc arcs_19_0[13] = {\n    {53, 1},\n    {54, 1},\n    {55, 1},\n    {56, 1},\n    {57, 1},\n    {58, 1},\n    {59, 1},\n    {60, 1},\n    {61, 1},\n    {62, 1},\n    {63, 1},\n    {64, 1},\n    {65, 1},\n};\nstatic arc arcs_19_1[1] = {\n    {0, 1},\n};\nstatic state states_19[2] = {\n    {13, arcs_19_0},\n    {1, arcs_19_1},\n};\nstatic arc arcs_20_0[1] = {\n    {66, 1},\n};\nstatic arc arcs_20_1[1] = {\n    {67, 2},\n};\nstatic arc arcs_20_2[1] = {\n    {0, 2},\n};\nstatic state states_20[3] = {\n    {1, arcs_20_0},\n    {1, arcs_20_1},\n    {1, arcs_20_2},\n};\nstatic arc arcs_21_0[1] = {\n    {68, 1},\n};\nstatic arc arcs_21_1[1] = {\n    {0, 1},\n};\nstatic state states_21[2] = {\n    {1, arcs_21_0},\n    {1, arcs_21_1},\n};\nstatic arc arcs_22_0[5] = {\n    {69, 1},\n    {70, 1},\n    {71, 1},\n    {72, 1},\n    {73, 1},\n};\nstatic arc arcs_22_1[1] = {\n    {0, 1},\n};\nstatic state states_22[2] = {\n    {5, arcs_22_0},\n    {1, arcs_22_1},\n};\nstatic arc arcs_23_0[1] = {\n    {74, 1},\n};\nstatic arc arcs_23_1[1] = {\n    {0, 1},\n};\nstatic state states_23[2] = {\n    {1, arcs_23_0},\n    {1, arcs_23_1},\n};\nstatic arc arcs_24_0[1] = {\n    {75, 1},\n};\nstatic arc arcs_24_1[1] = {\n    {0, 1},\n};\nstatic state states_24[2] = {\n    {1, arcs_24_0},\n    {1, arcs_24_1},\n};\nstatic arc arcs_25_0[1] = {\n    {76, 1},\n};\nstatic arc arcs_25_1[2] = {\n    {9, 2},\n    {0, 1},\n};\nstatic arc arcs_25_2[1] = {\n    {0, 2},\n};\nstatic state states_25[3] = {\n    {1, arcs_25_0},\n    {2, arcs_25_1},\n    {1, arcs_25_2},\n};\nstatic arc arcs_26_0[1] = {\n    {51, 1},\n};\nstatic arc arcs_26_1[1] = {\n    {0, 1},\n};\nstatic state states_26[2] = {\n    {1, arcs_26_0},\n    {1, arcs_26_1},\n};\nstatic arc arcs_27_0[1] = {\n    {77, 1},\n};\nstatic arc arcs_27_1[2] = {\n    {26, 2},\n    {0, 1},\n};\nstatic arc arcs_27_2[2] = {\n    {78, 3},\n    {0, 2},\n};\nstatic arc arcs_27_3[1] = {\n    {26, 4},\n};\nstatic arc arcs_27_4[1] = {\n    {0, 4},\n};\nstatic state states_27[5] = {\n    {1, arcs_27_0},\n    {2, arcs_27_1},\n    {2, arcs_27_2},\n    {1, arcs_27_3},\n    {1, arcs_27_4},\n};\nstatic arc arcs_28_0[2] = {\n    {79, 1},\n    {80, 1},\n};\nstatic arc arcs_28_1[1] = {\n    {0, 1},\n};\nstatic state states_28[2] = {\n    {2, arcs_28_0},\n    {1, arcs_28_1},\n};\nstatic arc arcs_29_0[1] = {\n    {81, 1},\n};\nstatic arc arcs_29_1[1] = {\n    {82, 2},\n};\nstatic arc arcs_29_2[1] = {\n    {0, 2},\n};\nstatic state states_29[3] = {\n    {1, arcs_29_0},\n    {1, arcs_29_1},\n    {1, arcs_29_2},\n};\nstatic arc arcs_30_0[1] = {\n    {78, 1},\n};\nstatic arc arcs_30_1[3] = {\n    {83, 2},\n    {84, 2},\n    {12, 3},\n};\nstatic arc arcs_30_2[4] = {\n    {83, 2},\n    {84, 2},\n    {12, 3},\n    {81, 4},\n};\nstatic arc arcs_30_3[1] = {\n    {81, 4},\n};\nstatic arc arcs_30_4[3] = {\n    {34, 5},\n    {13, 6},\n    {85, 5},\n};\nstatic arc arcs_30_5[1] = {\n    {0, 5},\n};\nstatic arc arcs_30_6[1] = {\n    {85, 7},\n};\nstatic arc arcs_30_7[1] = {\n    {15, 5},\n};\nstatic state states_30[8] = {\n    {1, arcs_30_0},\n    {3, arcs_30_1},\n    {4, arcs_30_2},\n    {1, arcs_30_3},\n    {3, arcs_30_4},\n    {1, arcs_30_5},\n    {1, arcs_30_6},\n    {1, arcs_30_7},\n};\nstatic arc arcs_31_0[1] = {\n    {23, 1},\n};\nstatic arc arcs_31_1[2] = {\n    {87, 2},\n    {0, 1},\n};\nstatic arc arcs_31_2[1] = {\n    {23, 3},\n};\nstatic arc arcs_31_3[1] = {\n    {0, 3},\n};\nstatic state states_31[4] = {\n    {1, arcs_31_0},\n    {2, arcs_31_1},\n    {1, arcs_31_2},\n    {1, arcs_31_3},\n};\nstatic arc arcs_32_0[1] = {\n    {12, 1},\n};\nstatic arc arcs_32_1[2] = {\n    {87, 2},\n    {0, 1},\n};\nstatic arc arcs_32_2[1] = {\n    {23, 3},\n};\nstatic arc arcs_32_3[1] = {\n    {0, 3},\n};\nstatic state states_32[4] = {\n    {1, arcs_32_0},\n    {2, arcs_32_1},\n    {1, arcs_32_2},\n    {1, arcs_32_3},\n};\nstatic arc arcs_33_0[1] = {\n    {86, 1},\n};\nstatic arc arcs_33_1[2] = {\n    {33, 2},\n    {0, 1},\n};\nstatic arc arcs_33_2[2] = {\n    {86, 1},\n    {0, 2},\n};\nstatic state states_33[3] = {\n    {1, arcs_33_0},\n    {2, arcs_33_1},\n    {2, arcs_33_2},\n};\nstatic arc arcs_34_0[1] = {\n    {88, 1},\n};\nstatic arc arcs_34_1[2] = {\n    {33, 0},\n    {0, 1},\n};\nstatic state states_34[2] = {\n    {1, arcs_34_0},\n    {2, arcs_34_1},\n};\nstatic arc arcs_35_0[1] = {\n    {23, 1},\n};\nstatic arc arcs_35_1[2] = {\n    {83, 0},\n    {0, 1},\n};\nstatic state states_35[2] = {\n    {1, arcs_35_0},\n    {2, arcs_35_1},\n};\nstatic arc arcs_36_0[1] = {\n    {89, 1},\n};\nstatic arc arcs_36_1[1] = {\n    {23, 2},\n};\nstatic arc arcs_36_2[2] = {\n    {33, 1},\n    {0, 2},\n};\nstatic state states_36[3] = {\n    {1, arcs_36_0},\n    {1, arcs_36_1},\n    {2, arcs_36_2},\n};\nstatic arc arcs_37_0[1] = {\n    {90, 1},\n};\nstatic arc arcs_37_1[1] = {\n    {23, 2},\n};\nstatic arc arcs_37_2[2] = {\n    {33, 1},\n    {0, 2},\n};\nstatic state states_37[3] = {\n    {1, arcs_37_0},\n    {1, arcs_37_1},\n    {2, arcs_37_2},\n};\nstatic arc arcs_38_0[1] = {\n    {91, 1},\n};\nstatic arc arcs_38_1[1] = {\n    {26, 2},\n};\nstatic arc arcs_38_2[2] = {\n    {33, 3},\n    {0, 2},\n};\nstatic arc arcs_38_3[1] = {\n    {26, 4},\n};\nstatic arc arcs_38_4[1] = {\n    {0, 4},\n};\nstatic state states_38[5] = {\n    {1, arcs_38_0},\n    {1, arcs_38_1},\n    {2, arcs_38_2},\n    {1, arcs_38_3},\n    {1, arcs_38_4},\n};\nstatic arc arcs_39_0[9] = {\n    {92, 1},\n    {93, 1},\n    {94, 1},\n    {95, 1},\n    {96, 1},\n    {19, 1},\n    {18, 1},\n    {17, 1},\n    {97, 1},\n};\nstatic arc arcs_39_1[1] = {\n    {0, 1},\n};\nstatic state states_39[2] = {\n    {9, arcs_39_0},\n    {1, arcs_39_1},\n};\nstatic arc arcs_40_0[1] = {\n    {21, 1},\n};\nstatic arc arcs_40_1[3] = {\n    {19, 2},\n    {96, 2},\n    {94, 2},\n};\nstatic arc arcs_40_2[1] = {\n    {0, 2},\n};\nstatic state states_40[3] = {\n    {1, arcs_40_0},\n    {3, arcs_40_1},\n    {1, arcs_40_2},\n};\nstatic arc arcs_41_0[1] = {\n    {98, 1},\n};\nstatic arc arcs_41_1[1] = {\n    {26, 2},\n};\nstatic arc arcs_41_2[1] = {\n    {27, 3},\n};\nstatic arc arcs_41_3[1] = {\n    {29, 4},\n};\nstatic arc arcs_41_4[3] = {\n    {99, 1},\n    {100, 5},\n    {0, 4},\n};\nstatic arc arcs_41_5[1] = {\n    {27, 6},\n};\nstatic arc arcs_41_6[1] = {\n    {29, 7},\n};\nstatic arc arcs_41_7[1] = {\n    {0, 7},\n};\nstatic state states_41[8] = {\n    {1, arcs_41_0},\n    {1, arcs_41_1},\n    {1, arcs_41_2},\n    {1, arcs_41_3},\n    {3, arcs_41_4},\n    {1, arcs_41_5},\n    {1, arcs_41_6},\n    {1, arcs_41_7},\n};\nstatic arc arcs_42_0[1] = {\n    {101, 1},\n};\nstatic arc arcs_42_1[1] = {\n    {26, 2},\n};\nstatic arc arcs_42_2[1] = {\n    {27, 3},\n};\nstatic arc arcs_42_3[1] = {\n    {29, 4},\n};\nstatic arc arcs_42_4[2] = {\n    {100, 5},\n    {0, 4},\n};\nstatic arc arcs_42_5[1] = {\n    {27, 6},\n};\nstatic arc arcs_42_6[1] = {\n    {29, 7},\n};\nstatic arc arcs_42_7[1] = {\n    {0, 7},\n};\nstatic state states_42[8] = {\n    {1, arcs_42_0},\n    {1, arcs_42_1},\n    {1, arcs_42_2},\n    {1, arcs_42_3},\n    {2, arcs_42_4},\n    {1, arcs_42_5},\n    {1, arcs_42_6},\n    {1, arcs_42_7},\n};\nstatic arc arcs_43_0[1] = {\n    {102, 1},\n};\nstatic arc arcs_43_1[1] = {\n    {67, 2},\n};\nstatic arc arcs_43_2[1] = {\n    {103, 3},\n};\nstatic arc arcs_43_3[1] = {\n    {9, 4},\n};\nstatic arc arcs_43_4[1] = {\n    {27, 5},\n};\nstatic arc arcs_43_5[2] = {\n    {28, 6},\n    {29, 7},\n};\nstatic arc arcs_43_6[1] = {\n    {29, 7},\n};\nstatic arc arcs_43_7[2] = {\n    {100, 8},\n    {0, 7},\n};\nstatic arc arcs_43_8[1] = {\n    {27, 9},\n};\nstatic arc arcs_43_9[1] = {\n    {29, 10},\n};\nstatic arc arcs_43_10[1] = {\n    {0, 10},\n};\nstatic state states_43[11] = {\n    {1, arcs_43_0},\n    {1, arcs_43_1},\n    {1, arcs_43_2},\n    {1, arcs_43_3},\n    {1, arcs_43_4},\n    {2, arcs_43_5},\n    {1, arcs_43_6},\n    {2, arcs_43_7},\n    {1, arcs_43_8},\n    {1, arcs_43_9},\n    {1, arcs_43_10},\n};\nstatic arc arcs_44_0[1] = {\n    {104, 1},\n};\nstatic arc arcs_44_1[1] = {\n    {27, 2},\n};\nstatic arc arcs_44_2[1] = {\n    {29, 3},\n};\nstatic arc arcs_44_3[2] = {\n    {105, 4},\n    {106, 5},\n};\nstatic arc arcs_44_4[1] = {\n    {27, 6},\n};\nstatic arc arcs_44_5[1] = {\n    {27, 7},\n};\nstatic arc arcs_44_6[1] = {\n    {29, 8},\n};\nstatic arc arcs_44_7[1] = {\n    {29, 9},\n};\nstatic arc arcs_44_8[4] = {\n    {105, 4},\n    {100, 10},\n    {106, 5},\n    {0, 8},\n};\nstatic arc arcs_44_9[1] = {\n    {0, 9},\n};\nstatic arc arcs_44_10[1] = {\n    {27, 11},\n};\nstatic arc arcs_44_11[1] = {\n    {29, 12},\n};\nstatic arc arcs_44_12[2] = {\n    {106, 5},\n    {0, 12},\n};\nstatic state states_44[13] = {\n    {1, arcs_44_0},\n    {1, arcs_44_1},\n    {1, arcs_44_2},\n    {2, arcs_44_3},\n    {1, arcs_44_4},\n    {1, arcs_44_5},\n    {1, arcs_44_6},\n    {1, arcs_44_7},\n    {4, arcs_44_8},\n    {1, arcs_44_9},\n    {1, arcs_44_10},\n    {1, arcs_44_11},\n    {2, arcs_44_12},\n};\nstatic arc arcs_45_0[1] = {\n    {107, 1},\n};\nstatic arc arcs_45_1[1] = {\n    {108, 2},\n};\nstatic arc arcs_45_2[2] = {\n    {33, 1},\n    {27, 3},\n};\nstatic arc arcs_45_3[2] = {\n    {28, 4},\n    {29, 5},\n};\nstatic arc arcs_45_4[1] = {\n    {29, 5},\n};\nstatic arc arcs_45_5[1] = {\n    {0, 5},\n};\nstatic state states_45[6] = {\n    {1, arcs_45_0},\n    {1, arcs_45_1},\n    {2, arcs_45_2},\n    {2, arcs_45_3},\n    {1, arcs_45_4},\n    {1, arcs_45_5},\n};\nstatic arc arcs_46_0[1] = {\n    {26, 1},\n};\nstatic arc arcs_46_1[2] = {\n    {87, 2},\n    {0, 1},\n};\nstatic arc arcs_46_2[1] = {\n    {109, 3},\n};\nstatic arc arcs_46_3[1] = {\n    {0, 3},\n};\nstatic state states_46[4] = {\n    {1, arcs_46_0},\n    {2, arcs_46_1},\n    {1, arcs_46_2},\n    {1, arcs_46_3},\n};\nstatic arc arcs_47_0[1] = {\n    {110, 1},\n};\nstatic arc arcs_47_1[2] = {\n    {26, 2},\n    {0, 1},\n};\nstatic arc arcs_47_2[2] = {\n    {87, 3},\n    {0, 2},\n};\nstatic arc arcs_47_3[1] = {\n    {23, 4},\n};\nstatic arc arcs_47_4[1] = {\n    {0, 4},\n};\nstatic state states_47[5] = {\n    {1, arcs_47_0},\n    {2, arcs_47_1},\n    {2, arcs_47_2},\n    {1, arcs_47_3},\n    {1, arcs_47_4},\n};\nstatic arc arcs_48_0[2] = {\n    {3, 1},\n    {2, 2},\n};\nstatic arc arcs_48_1[1] = {\n    {0, 1},\n};\nstatic arc arcs_48_2[2] = {\n    {28, 3},\n    {111, 4},\n};\nstatic arc arcs_48_3[1] = {\n    {2, 5},\n};\nstatic arc arcs_48_4[1] = {\n    {6, 6},\n};\nstatic arc arcs_48_5[1] = {\n    {111, 4},\n};\nstatic arc arcs_48_6[2] = {\n    {6, 6},\n    {112, 1},\n};\nstatic state states_48[7] = {\n    {2, arcs_48_0},\n    {1, arcs_48_1},\n    {2, arcs_48_2},\n    {1, arcs_48_3},\n    {1, arcs_48_4},\n    {1, arcs_48_5},\n    {2, arcs_48_6},\n};\nstatic arc arcs_49_0[2] = {\n    {113, 1},\n    {114, 2},\n};\nstatic arc arcs_49_1[2] = {\n    {98, 3},\n    {0, 1},\n};\nstatic arc arcs_49_2[1] = {\n    {0, 2},\n};\nstatic arc arcs_49_3[1] = {\n    {113, 4},\n};\nstatic arc arcs_49_4[1] = {\n    {100, 5},\n};\nstatic arc arcs_49_5[1] = {\n    {26, 2},\n};\nstatic state states_49[6] = {\n    {2, arcs_49_0},\n    {2, arcs_49_1},\n    {1, arcs_49_2},\n    {1, arcs_49_3},\n    {1, arcs_49_4},\n    {1, arcs_49_5},\n};\nstatic arc arcs_50_0[2] = {\n    {113, 1},\n    {116, 1},\n};\nstatic arc arcs_50_1[1] = {\n    {0, 1},\n};\nstatic state states_50[2] = {\n    {2, arcs_50_0},\n    {1, arcs_50_1},\n};\nstatic arc arcs_51_0[1] = {\n    {117, 1},\n};\nstatic arc arcs_51_1[2] = {\n    {36, 2},\n    {27, 3},\n};\nstatic arc arcs_51_2[1] = {\n    {27, 3},\n};\nstatic arc arcs_51_3[1] = {\n    {26, 4},\n};\nstatic arc arcs_51_4[1] = {\n    {0, 4},\n};\nstatic state states_51[5] = {\n    {1, arcs_51_0},\n    {2, arcs_51_1},\n    {1, arcs_51_2},\n    {1, arcs_51_3},\n    {1, arcs_51_4},\n};\nstatic arc arcs_52_0[1] = {\n    {117, 1},\n};\nstatic arc arcs_52_1[2] = {\n    {36, 2},\n    {27, 3},\n};\nstatic arc arcs_52_2[1] = {\n    {27, 3},\n};\nstatic arc arcs_52_3[1] = {\n    {115, 4},\n};\nstatic arc arcs_52_4[1] = {\n    {0, 4},\n};\nstatic state states_52[5] = {\n    {1, arcs_52_0},\n    {2, arcs_52_1},\n    {1, arcs_52_2},\n    {1, arcs_52_3},\n    {1, arcs_52_4},\n};\nstatic arc arcs_53_0[1] = {\n    {118, 1},\n};\nstatic arc arcs_53_1[2] = {\n    {119, 0},\n    {0, 1},\n};\nstatic state states_53[2] = {\n    {1, arcs_53_0},\n    {2, arcs_53_1},\n};\nstatic arc arcs_54_0[1] = {\n    {120, 1},\n};\nstatic arc arcs_54_1[2] = {\n    {121, 0},\n    {0, 1},\n};\nstatic state states_54[2] = {\n    {1, arcs_54_0},\n    {2, arcs_54_1},\n};\nstatic arc arcs_55_0[2] = {\n    {122, 1},\n    {123, 2},\n};\nstatic arc arcs_55_1[1] = {\n    {120, 2},\n};\nstatic arc arcs_55_2[1] = {\n    {0, 2},\n};\nstatic state states_55[3] = {\n    {2, arcs_55_0},\n    {1, arcs_55_1},\n    {1, arcs_55_2},\n};\nstatic arc arcs_56_0[1] = {\n    {109, 1},\n};\nstatic arc arcs_56_1[2] = {\n    {124, 0},\n    {0, 1},\n};\nstatic state states_56[2] = {\n    {1, arcs_56_0},\n    {2, arcs_56_1},\n};\nstatic arc arcs_57_0[10] = {\n    {125, 1},\n    {126, 1},\n    {127, 1},\n    {128, 1},\n    {129, 1},\n    {130, 1},\n    {131, 1},\n    {103, 1},\n    {122, 2},\n    {132, 3},\n};\nstatic arc arcs_57_1[1] = {\n    {0, 1},\n};\nstatic arc arcs_57_2[1] = {\n    {103, 1},\n};\nstatic arc arcs_57_3[2] = {\n    {122, 1},\n    {0, 3},\n};\nstatic state states_57[4] = {\n    {10, arcs_57_0},\n    {1, arcs_57_1},\n    {1, arcs_57_2},\n    {2, arcs_57_3},\n};\nstatic arc arcs_58_0[1] = {\n    {34, 1},\n};\nstatic arc arcs_58_1[1] = {\n    {109, 2},\n};\nstatic arc arcs_58_2[1] = {\n    {0, 2},\n};\nstatic state states_58[3] = {\n    {1, arcs_58_0},\n    {1, arcs_58_1},\n    {1, arcs_58_2},\n};\nstatic arc arcs_59_0[1] = {\n    {133, 1},\n};\nstatic arc arcs_59_1[2] = {\n    {134, 0},\n    {0, 1},\n};\nstatic state states_59[2] = {\n    {1, arcs_59_0},\n    {2, arcs_59_1},\n};\nstatic arc arcs_60_0[1] = {\n    {135, 1},\n};\nstatic arc arcs_60_1[2] = {\n    {136, 0},\n    {0, 1},\n};\nstatic state states_60[2] = {\n    {1, arcs_60_0},\n    {2, arcs_60_1},\n};\nstatic arc arcs_61_0[1] = {\n    {137, 1},\n};\nstatic arc arcs_61_1[2] = {\n    {138, 0},\n    {0, 1},\n};\nstatic state states_61[2] = {\n    {1, arcs_61_0},\n    {2, arcs_61_1},\n};\nstatic arc arcs_62_0[1] = {\n    {139, 1},\n};\nstatic arc arcs_62_1[3] = {\n    {140, 0},\n    {141, 0},\n    {0, 1},\n};\nstatic state states_62[2] = {\n    {1, arcs_62_0},\n    {3, arcs_62_1},\n};\nstatic arc arcs_63_0[1] = {\n    {142, 1},\n};\nstatic arc arcs_63_1[3] = {\n    {143, 0},\n    {144, 0},\n    {0, 1},\n};\nstatic state states_63[2] = {\n    {1, arcs_63_0},\n    {3, arcs_63_1},\n};\nstatic arc arcs_64_0[1] = {\n    {145, 1},\n};\nstatic arc arcs_64_1[6] = {\n    {34, 0},\n    {11, 0},\n    {146, 0},\n    {147, 0},\n    {148, 0},\n    {0, 1},\n};\nstatic state states_64[2] = {\n    {1, arcs_64_0},\n    {6, arcs_64_1},\n};\nstatic arc arcs_65_0[4] = {\n    {143, 1},\n    {144, 1},\n    {149, 1},\n    {150, 2},\n};\nstatic arc arcs_65_1[1] = {\n    {145, 2},\n};\nstatic arc arcs_65_2[1] = {\n    {0, 2},\n};\nstatic state states_65[3] = {\n    {4, arcs_65_0},\n    {1, arcs_65_1},\n    {1, arcs_65_2},\n};\nstatic arc arcs_66_0[1] = {\n    {151, 1},\n};\nstatic arc arcs_66_1[2] = {\n    {35, 2},\n    {0, 1},\n};\nstatic arc arcs_66_2[1] = {\n    {145, 3},\n};\nstatic arc arcs_66_3[1] = {\n    {0, 3},\n};\nstatic state states_66[4] = {\n    {1, arcs_66_0},\n    {2, arcs_66_1},\n    {1, arcs_66_2},\n    {1, arcs_66_3},\n};\nstatic arc arcs_67_0[2] = {\n    {152, 1},\n    {153, 2},\n};\nstatic arc arcs_67_1[1] = {\n    {153, 2},\n};\nstatic arc arcs_67_2[2] = {\n    {154, 2},\n    {0, 2},\n};\nstatic state states_67[3] = {\n    {2, arcs_67_0},\n    {1, arcs_67_1},\n    {2, arcs_67_2},\n};\nstatic arc arcs_68_0[10] = {\n    {13, 1},\n    {156, 2},\n    {158, 3},\n    {23, 4},\n    {161, 4},\n    {162, 5},\n    {84, 4},\n    {163, 4},\n    {164, 4},\n    {165, 4},\n};\nstatic arc arcs_68_1[3] = {\n    {51, 6},\n    {155, 6},\n    {15, 4},\n};\nstatic arc arcs_68_2[2] = {\n    {155, 7},\n    {157, 4},\n};\nstatic arc arcs_68_3[2] = {\n    {159, 8},\n    {160, 4},\n};\nstatic arc arcs_68_4[1] = {\n    {0, 4},\n};\nstatic arc arcs_68_5[2] = {\n    {162, 5},\n    {0, 5},\n};\nstatic arc arcs_68_6[1] = {\n    {15, 4},\n};\nstatic arc arcs_68_7[1] = {\n    {157, 4},\n};\nstatic arc arcs_68_8[1] = {\n    {160, 4},\n};\nstatic state states_68[9] = {\n    {10, arcs_68_0},\n    {3, arcs_68_1},\n    {2, arcs_68_2},\n    {2, arcs_68_3},\n    {1, arcs_68_4},\n    {2, arcs_68_5},\n    {1, arcs_68_6},\n    {1, arcs_68_7},\n    {1, arcs_68_8},\n};\nstatic arc arcs_69_0[2] = {\n    {26, 1},\n    {52, 1},\n};\nstatic arc arcs_69_1[3] = {\n    {166, 2},\n    {33, 3},\n    {0, 1},\n};\nstatic arc arcs_69_2[1] = {\n    {0, 2},\n};\nstatic arc arcs_69_3[3] = {\n    {26, 4},\n    {52, 4},\n    {0, 3},\n};\nstatic arc arcs_69_4[2] = {\n    {33, 3},\n    {0, 4},\n};\nstatic state states_69[5] = {\n    {2, arcs_69_0},\n    {3, arcs_69_1},\n    {1, arcs_69_2},\n    {3, arcs_69_3},\n    {2, arcs_69_4},\n};\nstatic arc arcs_70_0[3] = {\n    {13, 1},\n    {156, 2},\n    {83, 3},\n};\nstatic arc arcs_70_1[2] = {\n    {14, 4},\n    {15, 5},\n};\nstatic arc arcs_70_2[1] = {\n    {167, 6},\n};\nstatic arc arcs_70_3[1] = {\n    {23, 5},\n};\nstatic arc arcs_70_4[1] = {\n    {15, 5},\n};\nstatic arc arcs_70_5[1] = {\n    {0, 5},\n};\nstatic arc arcs_70_6[1] = {\n    {157, 5},\n};\nstatic state states_70[7] = {\n    {3, arcs_70_0},\n    {2, arcs_70_1},\n    {1, arcs_70_2},\n    {1, arcs_70_3},\n    {1, arcs_70_4},\n    {1, arcs_70_5},\n    {1, arcs_70_6},\n};\nstatic arc arcs_71_0[1] = {\n    {168, 1},\n};\nstatic arc arcs_71_1[2] = {\n    {33, 2},\n    {0, 1},\n};\nstatic arc arcs_71_2[2] = {\n    {168, 1},\n    {0, 2},\n};\nstatic state states_71[3] = {\n    {1, arcs_71_0},\n    {2, arcs_71_1},\n    {2, arcs_71_2},\n};\nstatic arc arcs_72_0[2] = {\n    {26, 1},\n    {27, 2},\n};\nstatic arc arcs_72_1[2] = {\n    {27, 2},\n    {0, 1},\n};\nstatic arc arcs_72_2[3] = {\n    {26, 3},\n    {169, 4},\n    {0, 2},\n};\nstatic arc arcs_72_3[2] = {\n    {169, 4},\n    {0, 3},\n};\nstatic arc arcs_72_4[1] = {\n    {0, 4},\n};\nstatic state states_72[5] = {\n    {2, arcs_72_0},\n    {2, arcs_72_1},\n    {3, arcs_72_2},\n    {2, arcs_72_3},\n    {1, arcs_72_4},\n};\nstatic arc arcs_73_0[1] = {\n    {27, 1},\n};\nstatic arc arcs_73_1[2] = {\n    {26, 2},\n    {0, 1},\n};\nstatic arc arcs_73_2[1] = {\n    {0, 2},\n};\nstatic state states_73[3] = {\n    {1, arcs_73_0},\n    {2, arcs_73_1},\n    {1, arcs_73_2},\n};\nstatic arc arcs_74_0[2] = {\n    {109, 1},\n    {52, 1},\n};\nstatic arc arcs_74_1[2] = {\n    {33, 2},\n    {0, 1},\n};\nstatic arc arcs_74_2[3] = {\n    {109, 1},\n    {52, 1},\n    {0, 2},\n};\nstatic state states_74[3] = {\n    {2, arcs_74_0},\n    {2, arcs_74_1},\n    {3, arcs_74_2},\n};\nstatic arc arcs_75_0[1] = {\n    {26, 1},\n};\nstatic arc arcs_75_1[2] = {\n    {33, 2},\n    {0, 1},\n};\nstatic arc arcs_75_2[2] = {\n    {26, 1},\n    {0, 2},\n};\nstatic state states_75[3] = {\n    {1, arcs_75_0},\n    {2, arcs_75_1},\n    {2, arcs_75_2},\n};\nstatic arc arcs_76_0[3] = {\n    {26, 1},\n    {35, 2},\n    {52, 3},\n};\nstatic arc arcs_76_1[4] = {\n    {27, 4},\n    {166, 5},\n    {33, 6},\n    {0, 1},\n};\nstatic arc arcs_76_2[1] = {\n    {109, 7},\n};\nstatic arc arcs_76_3[3] = {\n    {166, 5},\n    {33, 6},\n    {0, 3},\n};\nstatic arc arcs_76_4[1] = {\n    {26, 7},\n};\nstatic arc arcs_76_5[1] = {\n    {0, 5},\n};\nstatic arc arcs_76_6[3] = {\n    {26, 8},\n    {52, 8},\n    {0, 6},\n};\nstatic arc arcs_76_7[3] = {\n    {166, 5},\n    {33, 9},\n    {0, 7},\n};\nstatic arc arcs_76_8[2] = {\n    {33, 6},\n    {0, 8},\n};\nstatic arc arcs_76_9[3] = {\n    {26, 10},\n    {35, 11},\n    {0, 9},\n};\nstatic arc arcs_76_10[1] = {\n    {27, 12},\n};\nstatic arc arcs_76_11[1] = {\n    {109, 13},\n};\nstatic arc arcs_76_12[1] = {\n    {26, 13},\n};\nstatic arc arcs_76_13[2] = {\n    {33, 9},\n    {0, 13},\n};\nstatic state states_76[14] = {\n    {3, arcs_76_0},\n    {4, arcs_76_1},\n    {1, arcs_76_2},\n    {3, arcs_76_3},\n    {1, arcs_76_4},\n    {1, arcs_76_5},\n    {3, arcs_76_6},\n    {3, arcs_76_7},\n    {2, arcs_76_8},\n    {3, arcs_76_9},\n    {1, arcs_76_10},\n    {1, arcs_76_11},\n    {1, arcs_76_12},\n    {2, arcs_76_13},\n};\nstatic arc arcs_77_0[1] = {\n    {170, 1},\n};\nstatic arc arcs_77_1[1] = {\n    {23, 2},\n};\nstatic arc arcs_77_2[2] = {\n    {13, 3},\n    {27, 4},\n};\nstatic arc arcs_77_3[2] = {\n    {14, 5},\n    {15, 6},\n};\nstatic arc arcs_77_4[1] = {\n    {29, 7},\n};\nstatic arc arcs_77_5[1] = {\n    {15, 6},\n};\nstatic arc arcs_77_6[1] = {\n    {27, 4},\n};\nstatic arc arcs_77_7[1] = {\n    {0, 7},\n};\nstatic state states_77[8] = {\n    {1, arcs_77_0},\n    {1, arcs_77_1},\n    {2, arcs_77_2},\n    {2, arcs_77_3},\n    {1, arcs_77_4},\n    {1, arcs_77_5},\n    {1, arcs_77_6},\n    {1, arcs_77_7},\n};\nstatic arc arcs_78_0[1] = {\n    {171, 1},\n};\nstatic arc arcs_78_1[2] = {\n    {33, 2},\n    {0, 1},\n};\nstatic arc arcs_78_2[2] = {\n    {171, 1},\n    {0, 2},\n};\nstatic state states_78[3] = {\n    {1, arcs_78_0},\n    {2, arcs_78_1},\n    {2, arcs_78_2},\n};\nstatic arc arcs_79_0[3] = {\n    {26, 1},\n    {35, 2},\n    {34, 2},\n};\nstatic arc arcs_79_1[3] = {\n    {166, 3},\n    {32, 2},\n    {0, 1},\n};\nstatic arc arcs_79_2[1] = {\n    {26, 3},\n};\nstatic arc arcs_79_3[1] = {\n    {0, 3},\n};\nstatic state states_79[4] = {\n    {3, arcs_79_0},\n    {3, arcs_79_1},\n    {1, arcs_79_2},\n    {1, arcs_79_3},\n};\nstatic arc arcs_80_0[2] = {\n    {166, 1},\n    {173, 1},\n};\nstatic arc arcs_80_1[1] = {\n    {0, 1},\n};\nstatic state states_80[2] = {\n    {2, arcs_80_0},\n    {1, arcs_80_1},\n};\nstatic arc arcs_81_0[1] = {\n    {102, 1},\n};\nstatic arc arcs_81_1[1] = {\n    {67, 2},\n};\nstatic arc arcs_81_2[1] = {\n    {103, 3},\n};\nstatic arc arcs_81_3[1] = {\n    {113, 4},\n};\nstatic arc arcs_81_4[2] = {\n    {172, 5},\n    {0, 4},\n};\nstatic arc arcs_81_5[1] = {\n    {0, 5},\n};\nstatic state states_81[6] = {\n    {1, arcs_81_0},\n    {1, arcs_81_1},\n    {1, arcs_81_2},\n    {1, arcs_81_3},\n    {2, arcs_81_4},\n    {1, arcs_81_5},\n};\nstatic arc arcs_82_0[2] = {\n    {21, 1},\n    {174, 2},\n};\nstatic arc arcs_82_1[1] = {\n    {174, 2},\n};\nstatic arc arcs_82_2[1] = {\n    {0, 2},\n};\nstatic state states_82[3] = {\n    {2, arcs_82_0},\n    {1, arcs_82_1},\n    {1, arcs_82_2},\n};\nstatic arc arcs_83_0[1] = {\n    {98, 1},\n};\nstatic arc arcs_83_1[1] = {\n    {115, 2},\n};\nstatic arc arcs_83_2[2] = {\n    {172, 3},\n    {0, 2},\n};\nstatic arc arcs_83_3[1] = {\n    {0, 3},\n};\nstatic state states_83[4] = {\n    {1, arcs_83_0},\n    {1, arcs_83_1},\n    {2, arcs_83_2},\n    {1, arcs_83_3},\n};\nstatic arc arcs_84_0[1] = {\n    {23, 1},\n};\nstatic arc arcs_84_1[1] = {\n    {0, 1},\n};\nstatic state states_84[2] = {\n    {1, arcs_84_0},\n    {1, arcs_84_1},\n};\nstatic arc arcs_85_0[1] = {\n    {176, 1},\n};\nstatic arc arcs_85_1[2] = {\n    {177, 2},\n    {0, 1},\n};\nstatic arc arcs_85_2[1] = {\n    {0, 2},\n};\nstatic state states_85[3] = {\n    {1, arcs_85_0},\n    {2, arcs_85_1},\n    {1, arcs_85_2},\n};\nstatic arc arcs_86_0[2] = {\n    {78, 1},\n    {9, 2},\n};\nstatic arc arcs_86_1[1] = {\n    {26, 2},\n};\nstatic arc arcs_86_2[1] = {\n    {0, 2},\n};\nstatic state states_86[3] = {\n    {2, arcs_86_0},\n    {1, arcs_86_1},\n    {1, arcs_86_2},\n};\nstatic arc arcs_87_0[1] = {\n    {179, 1},\n};\nstatic arc arcs_87_1[2] = {\n    {2, 1},\n    {7, 2},\n};\nstatic arc arcs_87_2[1] = {\n    {0, 2},\n};\nstatic state states_87[3] = {\n    {1, arcs_87_0},\n    {2, arcs_87_1},\n    {1, arcs_87_2},\n};\nstatic arc arcs_88_0[1] = {\n    {13, 1},\n};\nstatic arc arcs_88_1[2] = {\n    {180, 2},\n    {15, 3},\n};\nstatic arc arcs_88_2[1] = {\n    {15, 3},\n};\nstatic arc arcs_88_3[1] = {\n    {25, 4},\n};\nstatic arc arcs_88_4[1] = {\n    {26, 5},\n};\nstatic arc arcs_88_5[1] = {\n    {0, 5},\n};\nstatic state states_88[6] = {\n    {1, arcs_88_0},\n    {2, arcs_88_1},\n    {1, arcs_88_2},\n    {1, arcs_88_3},\n    {1, arcs_88_4},\n    {1, arcs_88_5},\n};\nstatic arc arcs_89_0[3] = {\n    {26, 1},\n    {34, 2},\n    {35, 3},\n};\nstatic arc arcs_89_1[2] = {\n    {33, 4},\n    {0, 1},\n};\nstatic arc arcs_89_2[3] = {\n    {26, 5},\n    {33, 6},\n    {0, 2},\n};\nstatic arc arcs_89_3[1] = {\n    {26, 7},\n};\nstatic arc arcs_89_4[4] = {\n    {26, 1},\n    {34, 8},\n    {35, 3},\n    {0, 4},\n};\nstatic arc arcs_89_5[2] = {\n    {33, 6},\n    {0, 5},\n};\nstatic arc arcs_89_6[2] = {\n    {26, 5},\n    {35, 3},\n};\nstatic arc arcs_89_7[1] = {\n    {0, 7},\n};\nstatic arc arcs_89_8[3] = {\n    {26, 9},\n    {33, 10},\n    {0, 8},\n};\nstatic arc arcs_89_9[2] = {\n    {33, 10},\n    {0, 9},\n};\nstatic arc arcs_89_10[2] = {\n    {26, 9},\n    {35, 3},\n};\nstatic state states_89[11] = {\n    {3, arcs_89_0},\n    {2, arcs_89_1},\n    {3, arcs_89_2},\n    {1, arcs_89_3},\n    {4, arcs_89_4},\n    {2, arcs_89_5},\n    {2, arcs_89_6},\n    {1, arcs_89_7},\n    {3, arcs_89_8},\n    {2, arcs_89_9},\n    {2, arcs_89_10},\n};\nstatic dfa dfas[90] = {\n    {256, \"single_input\", 0, 3, states_0,\n     \"\\004\\050\\340\\000\\004\\000\\000\\000\\024\\174\\022\\016\\144\\011\\040\\004\\000\\200\\041\\121\\076\\004\\001\"},\n    {257, \"file_input\", 0, 2, states_1,\n     \"\\204\\050\\340\\000\\004\\000\\000\\000\\024\\174\\022\\016\\144\\011\\040\\004\\000\\200\\041\\121\\076\\004\\001\"},\n    {258, \"eval_input\", 0, 3, states_2,\n     \"\\000\\040\\200\\000\\000\\000\\000\\000\\000\\000\\020\\000\\000\\000\\040\\004\\000\\200\\041\\121\\076\\000\\000\"},\n    {259, \"decorator\", 0, 7, states_3,\n     \"\\000\\010\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\"},\n    {260, \"decorators\", 0, 2, states_4,\n     \"\\000\\010\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\"},\n    {261, \"decorated\", 0, 3, states_5,\n     \"\\000\\010\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\"},\n    {262, \"async_funcdef\", 0, 3, states_6,\n     \"\\000\\000\\040\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\"},\n    {263, \"funcdef\", 0, 9, states_7,\n     \"\\000\\000\\100\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\"},\n    {264, \"parameters\", 0, 4, states_8,\n     \"\\000\\040\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\"},\n    {265, \"typedargslist\", 0, 23, states_9,\n     \"\\000\\000\\200\\000\\014\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\"},\n    {266, \"tfpdef\", 0, 4, states_10,\n     \"\\000\\000\\200\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\"},\n    {267, \"varargslist\", 0, 19, states_11,\n     \"\\000\\000\\200\\000\\014\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\"},\n    {268, \"vfpdef\", 0, 2, states_12,\n     \"\\000\\000\\200\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\"},\n    {269, \"stmt\", 0, 2, states_13,\n     \"\\000\\050\\340\\000\\004\\000\\000\\000\\024\\174\\022\\016\\144\\011\\040\\004\\000\\200\\041\\121\\076\\004\\001\"},\n    {270, \"simple_stmt\", 0, 4, states_14,\n     \"\\000\\040\\200\\000\\004\\000\\000\\000\\024\\174\\022\\016\\000\\000\\040\\004\\000\\200\\041\\121\\076\\000\\001\"},\n    {271, \"small_stmt\", 0, 2, states_15,\n     \"\\000\\040\\200\\000\\004\\000\\000\\000\\024\\174\\022\\016\\000\\000\\040\\004\\000\\200\\041\\121\\076\\000\\001\"},\n    {272, \"expr_stmt\", 0, 6, states_16,\n     \"\\000\\040\\200\\000\\004\\000\\000\\000\\000\\000\\020\\000\\000\\000\\040\\004\\000\\200\\041\\121\\076\\000\\000\"},\n    {273, \"annassign\", 0, 5, states_17,\n     \"\\000\\000\\000\\010\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\"},\n    {274, \"testlist_star_expr\", 0, 3, states_18,\n     \"\\000\\040\\200\\000\\004\\000\\000\\000\\000\\000\\020\\000\\000\\000\\040\\004\\000\\200\\041\\121\\076\\000\\000\"},\n    {275, \"augassign\", 0, 2, states_19,\n     \"\\000\\000\\000\\000\\000\\000\\340\\377\\003\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\"},\n    {276, \"del_stmt\", 0, 3, states_20,\n     \"\\000\\000\\000\\000\\000\\000\\000\\000\\004\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\"},\n    {277, \"pass_stmt\", 0, 2, states_21,\n     \"\\000\\000\\000\\000\\000\\000\\000\\000\\020\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\"},\n    {278, \"flow_stmt\", 0, 2, states_22,\n     \"\\000\\000\\000\\000\\000\\000\\000\\000\\000\\074\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\001\"},\n    {279, \"break_stmt\", 0, 2, states_23,\n     \"\\000\\000\\000\\000\\000\\000\\000\\000\\000\\004\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\"},\n    {280, \"continue_stmt\", 0, 2, states_24,\n     \"\\000\\000\\000\\000\\000\\000\\000\\000\\000\\010\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\"},\n    {281, \"return_stmt\", 0, 3, states_25,\n     \"\\000\\000\\000\\000\\000\\000\\000\\000\\000\\020\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\"},\n    {282, \"yield_stmt\", 0, 2, states_26,\n     \"\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\001\"},\n    {283, \"raise_stmt\", 0, 5, states_27,\n     \"\\000\\000\\000\\000\\000\\000\\000\\000\\000\\040\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\"},\n    {284, \"import_stmt\", 0, 2, states_28,\n     \"\\000\\000\\000\\000\\000\\000\\000\\000\\000\\100\\002\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\"},\n    {285, \"import_name\", 0, 3, states_29,\n     \"\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\002\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\"},\n    {286, \"import_from\", 0, 8, states_30,\n     \"\\000\\000\\000\\000\\000\\000\\000\\000\\000\\100\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\"},\n    {287, \"import_as_name\", 0, 4, states_31,\n     \"\\000\\000\\200\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\"},\n    {288, \"dotted_as_name\", 0, 4, states_32,\n     \"\\000\\000\\200\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\"},\n    {289, \"import_as_names\", 0, 3, states_33,\n     \"\\000\\000\\200\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\"},\n    {290, \"dotted_as_names\", 0, 2, states_34,\n     \"\\000\\000\\200\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\"},\n    {291, \"dotted_name\", 0, 2, states_35,\n     \"\\000\\000\\200\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\"},\n    {292, \"global_stmt\", 0, 3, states_36,\n     \"\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\002\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\"},\n    {293, \"nonlocal_stmt\", 0, 3, states_37,\n     \"\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\004\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\"},\n    {294, \"assert_stmt\", 0, 5, states_38,\n     \"\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\010\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\"},\n    {295, \"compound_stmt\", 0, 2, states_39,\n     \"\\000\\010\\140\\000\\000\\000\\000\\000\\000\\000\\000\\000\\144\\011\\000\\000\\000\\000\\000\\000\\000\\004\\000\"},\n    {296, \"async_stmt\", 0, 3, states_40,\n     \"\\000\\000\\040\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\"},\n    {297, \"if_stmt\", 0, 8, states_41,\n     \"\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\004\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\"},\n    {298, \"while_stmt\", 0, 8, states_42,\n     \"\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\040\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\"},\n    {299, \"for_stmt\", 0, 11, states_43,\n     \"\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\100\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\"},\n    {300, \"try_stmt\", 0, 13, states_44,\n     \"\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\001\\000\\000\\000\\000\\000\\000\\000\\000\\000\"},\n    {301, \"with_stmt\", 0, 6, states_45,\n     \"\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\010\\000\\000\\000\\000\\000\\000\\000\\000\\000\"},\n    {302, \"with_item\", 0, 4, states_46,\n     \"\\000\\040\\200\\000\\000\\000\\000\\000\\000\\000\\020\\000\\000\\000\\040\\004\\000\\200\\041\\121\\076\\000\\000\"},\n    {303, \"except_clause\", 0, 5, states_47,\n     \"\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\100\\000\\000\\000\\000\\000\\000\\000\\000\\000\"},\n    {304, \"suite\", 0, 7, states_48,\n     \"\\004\\040\\200\\000\\004\\000\\000\\000\\024\\174\\022\\016\\000\\000\\040\\004\\000\\200\\041\\121\\076\\000\\001\"},\n    {305, \"test\", 0, 6, states_49,\n     \"\\000\\040\\200\\000\\000\\000\\000\\000\\000\\000\\020\\000\\000\\000\\040\\004\\000\\200\\041\\121\\076\\000\\000\"},\n    {306, \"test_nocond\", 0, 2, states_50,\n     \"\\000\\040\\200\\000\\000\\000\\000\\000\\000\\000\\020\\000\\000\\000\\040\\004\\000\\200\\041\\121\\076\\000\\000\"},\n    {307, \"lambdef\", 0, 5, states_51,\n     \"\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\040\\000\\000\\000\\000\\000\\000\\000\\000\"},\n    {308, \"lambdef_nocond\", 0, 5, states_52,\n     \"\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\040\\000\\000\\000\\000\\000\\000\\000\\000\"},\n    {309, \"or_test\", 0, 2, states_53,\n     \"\\000\\040\\200\\000\\000\\000\\000\\000\\000\\000\\020\\000\\000\\000\\000\\004\\000\\200\\041\\121\\076\\000\\000\"},\n    {310, \"and_test\", 0, 2, states_54,\n     \"\\000\\040\\200\\000\\000\\000\\000\\000\\000\\000\\020\\000\\000\\000\\000\\004\\000\\200\\041\\121\\076\\000\\000\"},\n    {311, \"not_test\", 0, 3, states_55,\n     \"\\000\\040\\200\\000\\000\\000\\000\\000\\000\\000\\020\\000\\000\\000\\000\\004\\000\\200\\041\\121\\076\\000\\000\"},\n    {312, \"comparison\", 0, 2, states_56,\n     \"\\000\\040\\200\\000\\000\\000\\000\\000\\000\\000\\020\\000\\000\\000\\000\\000\\000\\200\\041\\121\\076\\000\\000\"},\n    {313, \"comp_op\", 0, 4, states_57,\n     \"\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\200\\000\\000\\344\\037\\000\\000\\000\\000\\000\\000\"},\n    {314, \"star_expr\", 0, 3, states_58,\n     \"\\000\\000\\000\\000\\004\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\"},\n    {315, \"expr\", 0, 2, states_59,\n     \"\\000\\040\\200\\000\\000\\000\\000\\000\\000\\000\\020\\000\\000\\000\\000\\000\\000\\200\\041\\121\\076\\000\\000\"},\n    {316, \"xor_expr\", 0, 2, states_60,\n     \"\\000\\040\\200\\000\\000\\000\\000\\000\\000\\000\\020\\000\\000\\000\\000\\000\\000\\200\\041\\121\\076\\000\\000\"},\n    {317, \"and_expr\", 0, 2, states_61,\n     \"\\000\\040\\200\\000\\000\\000\\000\\000\\000\\000\\020\\000\\000\\000\\000\\000\\000\\200\\041\\121\\076\\000\\000\"},\n    {318, \"shift_expr\", 0, 2, states_62,\n     \"\\000\\040\\200\\000\\000\\000\\000\\000\\000\\000\\020\\000\\000\\000\\000\\000\\000\\200\\041\\121\\076\\000\\000\"},\n    {319, \"arith_expr\", 0, 2, states_63,\n     \"\\000\\040\\200\\000\\000\\000\\000\\000\\000\\000\\020\\000\\000\\000\\000\\000\\000\\200\\041\\121\\076\\000\\000\"},\n    {320, \"term\", 0, 2, states_64,\n     \"\\000\\040\\200\\000\\000\\000\\000\\000\\000\\000\\020\\000\\000\\000\\000\\000\\000\\200\\041\\121\\076\\000\\000\"},\n    {321, \"factor\", 0, 3, states_65,\n     \"\\000\\040\\200\\000\\000\\000\\000\\000\\000\\000\\020\\000\\000\\000\\000\\000\\000\\200\\041\\121\\076\\000\\000\"},\n    {322, \"power\", 0, 4, states_66,\n     \"\\000\\040\\200\\000\\000\\000\\000\\000\\000\\000\\020\\000\\000\\000\\000\\000\\000\\000\\000\\121\\076\\000\\000\"},\n    {323, \"atom_expr\", 0, 3, states_67,\n     \"\\000\\040\\200\\000\\000\\000\\000\\000\\000\\000\\020\\000\\000\\000\\000\\000\\000\\000\\000\\121\\076\\000\\000\"},\n    {324, \"atom\", 0, 9, states_68,\n     \"\\000\\040\\200\\000\\000\\000\\000\\000\\000\\000\\020\\000\\000\\000\\000\\000\\000\\000\\000\\120\\076\\000\\000\"},\n    {325, \"testlist_comp\", 0, 5, states_69,\n     \"\\000\\040\\200\\000\\004\\000\\000\\000\\000\\000\\020\\000\\000\\000\\040\\004\\000\\200\\041\\121\\076\\000\\000\"},\n    {326, \"trailer\", 0, 7, states_70,\n     \"\\000\\040\\000\\000\\000\\000\\000\\000\\000\\000\\010\\000\\000\\000\\000\\000\\000\\000\\000\\020\\000\\000\\000\"},\n    {327, \"subscriptlist\", 0, 3, states_71,\n     \"\\000\\040\\200\\010\\000\\000\\000\\000\\000\\000\\020\\000\\000\\000\\040\\004\\000\\200\\041\\121\\076\\000\\000\"},\n    {328, \"subscript\", 0, 5, states_72,\n     \"\\000\\040\\200\\010\\000\\000\\000\\000\\000\\000\\020\\000\\000\\000\\040\\004\\000\\200\\041\\121\\076\\000\\000\"},\n    {329, \"sliceop\", 0, 3, states_73,\n     \"\\000\\000\\000\\010\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\"},\n    {330, \"exprlist\", 0, 3, states_74,\n     \"\\000\\040\\200\\000\\004\\000\\000\\000\\000\\000\\020\\000\\000\\000\\000\\000\\000\\200\\041\\121\\076\\000\\000\"},\n    {331, \"testlist\", 0, 3, states_75,\n     \"\\000\\040\\200\\000\\000\\000\\000\\000\\000\\000\\020\\000\\000\\000\\040\\004\\000\\200\\041\\121\\076\\000\\000\"},\n    {332, \"dictorsetmaker\", 0, 14, states_76,\n     \"\\000\\040\\200\\000\\014\\000\\000\\000\\000\\000\\020\\000\\000\\000\\040\\004\\000\\200\\041\\121\\076\\000\\000\"},\n    {333, \"classdef\", 0, 8, states_77,\n     \"\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\004\\000\"},\n    {334, \"arglist\", 0, 3, states_78,\n     \"\\000\\040\\200\\000\\014\\000\\000\\000\\000\\000\\020\\000\\000\\000\\040\\004\\000\\200\\041\\121\\076\\000\\000\"},\n    {335, \"argument\", 0, 4, states_79,\n     \"\\000\\040\\200\\000\\014\\000\\000\\000\\000\\000\\020\\000\\000\\000\\040\\004\\000\\200\\041\\121\\076\\000\\000\"},\n    {336, \"comp_iter\", 0, 2, states_80,\n     \"\\000\\000\\040\\000\\000\\000\\000\\000\\000\\000\\000\\000\\104\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\"},\n    {337, \"sync_comp_for\", 0, 6, states_81,\n     \"\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\100\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\"},\n    {338, \"comp_for\", 0, 3, states_82,\n     \"\\000\\000\\040\\000\\000\\000\\000\\000\\000\\000\\000\\000\\100\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\"},\n    {339, \"comp_if\", 0, 4, states_83,\n     \"\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\004\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\"},\n    {340, \"encoding_decl\", 0, 2, states_84,\n     \"\\000\\000\\200\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\"},\n    {341, \"yield_expr\", 0, 3, states_85,\n     \"\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\001\"},\n    {342, \"yield_arg\", 0, 3, states_86,\n     \"\\000\\040\\200\\000\\000\\000\\000\\000\\000\\100\\020\\000\\000\\000\\040\\004\\000\\200\\041\\121\\076\\000\\000\"},\n    {343, \"func_type_input\", 0, 3, states_87,\n     \"\\000\\040\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\"},\n    {344, \"func_type\", 0, 6, states_88,\n     \"\\000\\040\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\"},\n    {345, \"typelist\", 0, 11, states_89,\n     \"\\000\\040\\200\\000\\014\\000\\000\\000\\000\\000\\020\\000\\000\\000\\040\\004\\000\\200\\041\\121\\076\\000\\000\"},\n};\nstatic label labels[181] = {\n    {0, \"EMPTY\"},\n    {256, 0},\n    {4, 0},\n    {270, 0},\n    {295, 0},\n    {257, 0},\n    {269, 0},\n    {0, 0},\n    {258, 0},\n    {331, 0},\n    {259, 0},\n    {49, 0},\n    {291, 0},\n    {7, 0},\n    {334, 0},\n    {8, 0},\n    {260, 0},\n    {261, 0},\n    {333, 0},\n    {263, 0},\n    {262, 0},\n    {55, 0},\n    {1, \"def\"},\n    {1, 0},\n    {264, 0},\n    {51, 0},\n    {305, 0},\n    {11, 0},\n    {57, 0},\n    {304, 0},\n    {265, 0},\n    {266, 0},\n    {22, 0},\n    {12, 0},\n    {16, 0},\n    {35, 0},\n    {267, 0},\n    {268, 0},\n    {271, 0},\n    {13, 0},\n    {272, 0},\n    {276, 0},\n    {277, 0},\n    {278, 0},\n    {284, 0},\n    {292, 0},\n    {293, 0},\n    {294, 0},\n    {274, 0},\n    {273, 0},\n    {275, 0},\n    {341, 0},\n    {314, 0},\n    {36, 0},\n    {37, 0},\n    {38, 0},\n    {50, 0},\n    {39, 0},\n    {40, 0},\n    {41, 0},\n    {42, 0},\n    {43, 0},\n    {44, 0},\n    {45, 0},\n    {46, 0},\n    {48, 0},\n    {1, \"del\"},\n    {330, 0},\n    {1, \"pass\"},\n    {279, 0},\n    {280, 0},\n    {281, 0},\n    {283, 0},\n    {282, 0},\n    {1, \"break\"},\n    {1, \"continue\"},\n    {1, \"return\"},\n    {1, \"raise\"},\n    {1, \"from\"},\n    {285, 0},\n    {286, 0},\n    {1, \"import\"},\n    {290, 0},\n    {23, 0},\n    {52, 0},\n    {289, 0},\n    {287, 0},\n    {1, \"as\"},\n    {288, 0},\n    {1, \"global\"},\n    {1, \"nonlocal\"},\n    {1, \"assert\"},\n    {297, 0},\n    {298, 0},\n    {299, 0},\n    {300, 0},\n    {301, 0},\n    {296, 0},\n    {1, \"if\"},\n    {1, \"elif\"},\n    {1, \"else\"},\n    {1, \"while\"},\n    {1, \"for\"},\n    {1, \"in\"},\n    {1, \"try\"},\n    {303, 0},\n    {1, \"finally\"},\n    {1, \"with\"},\n    {302, 0},\n    {315, 0},\n    {1, \"except\"},\n    {5, 0},\n    {6, 0},\n    {309, 0},\n    {307, 0},\n    {306, 0},\n    {308, 0},\n    {1, \"lambda\"},\n    {310, 0},\n    {1, \"or\"},\n    {311, 0},\n    {1, \"and\"},\n    {1, \"not\"},\n    {312, 0},\n    {313, 0},\n    {20, 0},\n    {21, 0},\n    {27, 0},\n    {30, 0},\n    {29, 0},\n    {28, 0},\n    {28, 0},\n    {1, \"is\"},\n    {316, 0},\n    {18, 0},\n    {317, 0},\n    {32, 0},\n    {318, 0},\n    {19, 0},\n    {319, 0},\n    {33, 0},\n    {34, 0},\n    {320, 0},\n    {14, 0},\n    {15, 0},\n    {321, 0},\n    {17, 0},\n    {24, 0},\n    {47, 0},\n    {31, 0},\n    {322, 0},\n    {323, 0},\n    {54, 0},\n    {324, 0},\n    {326, 0},\n    {325, 0},\n    {9, 0},\n    {10, 0},\n    {25, 0},\n    {332, 0},\n    {26, 0},\n    {2, 0},\n    {3, 0},\n    {1, \"None\"},\n    {1, \"True\"},\n    {1, \"False\"},\n    {338, 0},\n    {327, 0},\n    {328, 0},\n    {329, 0},\n    {1, \"class\"},\n    {335, 0},\n    {336, 0},\n    {339, 0},\n    {337, 0},\n    {340, 0},\n    {1, \"yield\"},\n    {342, 0},\n    {343, 0},\n    {344, 0},\n    {345, 0},\n};\ngrammar _Ta3Parser_Grammar = {\n    90,\n    dfas,\n    {181, labels},\n    256\n};\n"
  },
  {
    "path": "ast3/tests/test_basics.py",
    "content": "import os\n\nimport pytest\n\nfrom typed_ast import _ast3\nfrom typed_ast import _ast27\nimport typed_ast.conversions\n\n# Lowest and highest supported Python 3 minor version (inclusive)\nMIN_VER = 4\nMAX_VER = 7\nNEXT_VER = MAX_VER + 1\n\n\nbasics = \"\"\"\\\ndef foo():\n    # type: () -> int\n    pass\n\ndef bar():  # type: () -> None\n    pass\n\"\"\"\ndef test_basics():\n    for version in range(MIN_VER, NEXT_VER):\n        tree = _ast3._parse(basics, \"<basics>\", \"exec\", version)\n        assert tree.body[0].type_comment == \"() -> int\"\n        assert tree.body[1].type_comment == \"() -> None\"\n\n\nredundantdef = \"\"\"\\\ndef foo():  # type: () -> int\n    # type: () -> str\n    return ''\n\"\"\"\ndef test_redundantdef():\n    for version in range(MIN_VER, NEXT_VER):\n        with pytest.raises(SyntaxError):\n            t = _ast3._parse(redundantdef, \"<redundantdef>\", \"exec\", version)\n\n\nvardecl = \"\"\"\\\na = 0  # type: int\na  # type: int\n\"\"\"\ndef test_vardecl():\n    for version in range(MIN_VER, NEXT_VER):\n        tree = _ast3._parse(vardecl, \"<vardecl>\", \"exec\", version)\n        assert tree.body[0].type_comment == \"int\"\n        # Curious fact: an expression can have a type comment\n        # but it is lost in the AST.\n\n\nforstmt = \"\"\"\\\nfor a in []:  # type: int\n    pass\n\"\"\"\ndef test_forstmt():\n    for version in range(MIN_VER, NEXT_VER):\n        tree = _ast3._parse(forstmt, \"<forstmt>\", \"exec\", version)\n        assert tree.body[0].type_comment == \"int\"\n\n\nwithstmt = \"\"\"\\\nwith context():  # type: int\n    pass\n\"\"\"\ndef test_withstmt():\n    for version in range(MIN_VER, NEXT_VER):\n        tree = _ast3._parse(withstmt, \"<withstmt>\", \"exec\", version)\n        assert tree.body[0].type_comment == \"int\"\n\n\n# A test function named 'fabvk' would have two positional args, a and b,\n# plus a var-arg *v, plus a kw-arg **k.  It is verified in test_longargs()\n# that it has exactly these arguments, no more, no fewer.\nlongargs = \"\"\"\\\ndef fa(\n    a = 1,  # type: A\n):\n    pass\n\ndef fa(\n    a = 1  # type: A\n):\n    pass\n\ndef fab(\n    a,  # type: A\n    b,  # type: B\n):\n    pass\n\ndef fab(\n    a,  # type: A\n    b  # type: B\n):\n    pass\n\ndef fv(\n    *v,  # type: V\n):\n    pass\n\ndef fv(\n    *v  # type: V\n):\n    pass\n\ndef fk(\n    **k,  # type: K\n):\n    pass\n\ndef fk(\n    **k  # type: K\n):\n    pass\n\ndef fvk(\n    *v,  # type: V\n    **k,  # type: K\n):\n    pass\n\ndef fvk(\n    *v,  # type: V\n    **k  # type: K\n):\n    pass\n\ndef fav(\n    a,  # type: A\n    *v,  # type: V\n):\n    pass\n\ndef fav(\n    a,  # type: A\n    *v  # type: V\n):\n    pass\n\ndef fak(\n    a,  # type: A\n    **k,  # type: K\n):\n    pass\n\ndef fak(\n    a,  # type: A\n    **k  # type: K\n):\n    pass\n\ndef favk(\n    a,  # type: A\n    *v,  # type: V\n    **k,  # type: K\n):\n    pass\n\ndef favk(\n    a,  # type: A\n    *v,  # type: V\n    **k  # type: K\n):\n    pass\n\n\"\"\"\ndef test_longargs():\n    for version in range(MIN_VER, NEXT_VER):\n        tree = _ast3._parse(longargs, \"<longargs>\", \"exec\", version)\n        for t in tree.body:\n            # The expected args are encoded in the function name\n            todo = set(t.name[1:])\n            assert len(t.args.args) == len(todo) - bool(t.args.vararg) - bool(t.args.kwarg)\n            assert t.name.startswith('f')\n            for c in t.name[1:]:\n                todo.remove(c)\n                if c == 'v':\n                    arg = t.args.vararg\n                elif c == 'k':\n                    arg = t.args.kwarg\n                else:\n                    assert 0 <= ord(c) - ord('a') < len(t.args.args)\n                    arg = t.args.args[ord(c) - ord('a')]\n                assert arg.arg == c  # That's the argument name\n                assert arg.type_comment == arg.arg.upper()\n            assert not todo\n\n\nignores = \"\"\"\\\ndef foo():\n    pass  # type: ignore\n\ndef bar():\n    x = 1  # type: ignore\n\ndef baz():\n    pass  # type: ignore[excuse]\n    pass  # type: ignore=excuse\n    pass  # type: ignore [excuse]\n    x = 1  # type: ignore whatever\n\"\"\"\ndef test_ignores():\n    expected = [\n        (2, ''),\n        (5, ''),\n        (8, '[excuse]'),\n        (9, '=excuse'),\n        (10, ' [excuse]'),\n        (11, ' whatever'),\n    ]\n\n    for version in range(MIN_VER, NEXT_VER):\n        tree = _ast3._parse(ignores, \"<ignores>\", \"exec\", version)\n        assert [(ti.lineno, ti.tag) for ti in tree.type_ignores] == expected\n        with pytest.raises(SyntaxError):\n            _ast3._parse(\"pass  # type: ignoreé\\n\", \"<ignores>\", \"exec\", version)\n\n\n    tree = _ast27.parse(ignores, \"<ignores>\", \"exec\")\n    assert [(ti.lineno, ti.tag) for ti in tree.type_ignores] == expected\n    with pytest.raises(SyntaxError):\n        _ast27.parse(\"pass  # type: ignoreé\\n\", \"<ignores>\", \"exec\")\n\n\n\nasyncfunc = \"\"\"\\\nasync def foo():\n    # type: () -> int\n    return await bar()\n\"\"\"\ndef test_asyncfunc():\n    for version in range(3, 5):\n        with pytest.raises(SyntaxError):\n            _ast3._parse(asyncfunc, \"<asyncfunc>\", \"exec\", version)\n    for version in range(5, NEXT_VER):\n        tree = _ast3._parse(asyncfunc, \"<asyncfunc>\", \"exec\", version)\n        assert tree.body[0].type_comment == \"() -> int\"\n\n\nasyncvar = \"\"\"\\\nasync = 12\nawait = 13\n\"\"\"\ndef test_asyncvar():\n    for version in range(3, 7):\n        tree = _ast3._parse(asyncvar, \"<asyncvar>\", \"exec\", version)\n    for version in range(7, NEXT_VER):\n        with pytest.raises(SyntaxError):\n            _ast3._parse(asyncvar, \"<asyncvar>\", \"exec\", version)\n\n\nasynccomp = \"\"\"\\\nasync def foo(xs):\n    [x async for x in xs]\n\"\"\"\ndef test_asynccomp():\n    for version in range(3, 6):\n        with pytest.raises(SyntaxError):\n            tree = _ast3._parse(asynccomp, \"<asynccomp>\", \"exec\", version)\n    for version in range(6, NEXT_VER):\n            _ast3._parse(asynccomp, \"<asynccomp>\", \"exec\", version)\n\n\nmatmul = \"\"\"\\\na = b @ c\n\"\"\"\ndef test_matmul():\n    for version in range(3, 5):\n        with pytest.raises(SyntaxError):\n            tree = _ast3._parse(matmul, \"<matmul>\", \"exec\", version)\n    for version in range(5, NEXT_VER):\n        tree = _ast3._parse(matmul, \"<matmul>\", \"exec\", version)\n\n\nstrkind = \"\"\"\\\nplain = 'abc'\nraw = r'abc'\nplain_bytes = b'abc'\nraw_bytes = br'abc'\n\"\"\"\ndef test_strkind():\n    # Test that Str() objects have a kind argument/attribute.\n    node = _ast3.Str(\"foo\", \"r\")\n    assert node.s == \"foo\"\n    assert node.kind == \"r\"\n    for version in range(MIN_VER, NEXT_VER):\n        tree = _ast3._parse(strkind, \"<strkind>\", \"exec\", version)\n        assert tree.body[0].value.kind == \"\"\n        assert tree.body[1].value.kind == \"r\"\n        assert tree.body[2].value.kind == \"b\"\n        assert tree.body[3].value.kind == \"br\"\n\n\nbasic_py2 = \"\"\"\\\na = 'hello'\nb = u'hello'\nc = b'hello'\n\"\"\"\ndef test_convert_strs():\n    ast = _ast27.parse(basic_py2, \"<basic_py2>\", \"exec\")\n    tree = typed_ast.conversions.py2to3(ast)\n    assert tree.body[0].value.kind == \"\"\n    assert tree.body[1].value.kind == \"u\"\n    assert tree.body[2].value.kind == \"b\"\n\nsimple_fstring = \"\"\"\\\nf'{5}'\n\"\"\"\ndef test_simple_fstring():\n    for version in range(6, NEXT_VER):\n        tree = _ast3._parse(simple_fstring, \"<fstring>\", \"exec\", version)\n        assert isinstance(tree.body[0].value, _ast3.JoinedStr)\n        assert isinstance(tree.body[0].value.values[0].value, _ast3.Num)\n\n# Test the interaction between versions and f strings\nawait_fstring = \"\"\"\\\nf'1 + {f\"{await}\"}'\n\"\"\"\ndef test_await_fstring():\n    # Should work on 6 but fail on 7\n    _ast3._parse(await_fstring, \"<bad-f-string>\", \"exec\", 6)\n    with pytest.raises(SyntaxError):\n        _ast3._parse(await_fstring, \"<bad-f-string>\", \"exec\", 7)\n"
  },
  {
    "path": "release_process.md",
    "content": "# Typed AST PyPI Release Process\n0. Thoroughly test the prospective release.\n1. Make a commit titled \"Release version \\[version number\\]\" which removes the\n   `-dev0` suffix of the version string in\n   [`typed_ast/__init__.py`](https://github.com/python/typed_ast/blob/master/typed_ast/__init__.py).\n   Switch the version to a new minor version if there have been\n   backwards-incompatible changes.\n2. Make a git tag pointing to this commit with the version number as the name\n   of the tag.\n3. Push the commit and the tag.\n4. Wait for the GitHub Actions build to complete.\n5. Download all artifacts from the relevant GitHub Actions build.\n6. Compare the wheels produced with the previous release of typed-ast to make sure\n   you have the full matrix.\n7. If possible, verify the final `typed_ast` wheels work on Windows, macOS,\n   and Linux platforms.\n8. Upload the sdist and wheels to PyPI with `twine upload dist/*`.\n9. Make a commit which bumps the bugfix version and adds back the `.dev0`\n   suffix.\n"
  },
  {
    "path": "setup.py",
    "content": "import ast\nimport re\nimport sys\nif sys.version_info[0] < 3 or sys.version_info[1] < 3:\n    sys.exit('Error: typed_ast only runs on Python 3.3 and above.')\n\ntry:\n    from setuptools import setup, Extension\nexcept ImportError:\n    from distutils.core import setup, Extension\n\n_ast27 = Extension(\n    '_ast27',\n    include_dirs = ['ast27/Include'],\n    sources = [\n        'ast27/Parser/acceler.c',\n        'ast27/Parser/bitset.c',\n        'ast27/Parser/grammar.c',\n        'ast27/Parser/grammar1.c',\n        'ast27/Parser/node.c',\n        'ast27/Parser/parser.c',\n        'ast27/Parser/parsetok.c',\n        'ast27/Parser/tokenizer.c',\n        'ast27/Python/asdl.c',\n        'ast27/Python/ast.c',\n        'ast27/Python/graminit.c',\n        'ast27/Python/mystrtoul.c',\n        'ast27/Python/Python-ast.c',\n        'ast27/Custom/typed_ast.c',\n    ],\n    depends = [\n        'ast27/Include/asdl.h',\n        'ast27/Include/ast.h',\n        'ast27/Include/bitset.h',\n        'ast27/Include/compile.h',\n        'ast27/Include/errcode.h',\n        'ast27/Include/graminit.h',\n        'ast27/Include/grammar.h',\n        'ast27/Include/node.h',\n        'ast27/Include/parsetok.h',\n        'ast27/Include/pgenheaders.h',\n        'ast27/Include/Python-ast.h',\n        'ast27/Include/token.h',\n        'ast27/Parser/parser.h',\n        'ast27/Parser/tokenizer.h',\n    ])\n\n\n_ast3 = Extension(\n    '_ast3',\n    include_dirs = ['ast3/Include'],\n    sources = [\n        'ast3/Parser/acceler.c',\n        'ast3/Parser/bitset.c',\n        'ast3/Parser/grammar.c',\n        'ast3/Parser/grammar1.c',\n        'ast3/Parser/node.c',\n        'ast3/Parser/parser.c',\n        'ast3/Parser/parsetok.c',\n        'ast3/Parser/tokenizer.c',\n        'ast3/Python/asdl.c',\n        'ast3/Python/ast.c',\n        'ast3/Python/graminit.c',\n        'ast3/Python/Python-ast.c',\n        'ast3/Custom/typed_ast.c',\n    ],\n    depends = [\n        'ast3/Include/asdl.h',\n        'ast3/Include/ast.h',\n        'ast3/Include/bitset.h',\n        'ast3/Include/compile-ast3.h',\n        'ast3/Include/errcode.h',\n        'ast3/Include/graminit.h',\n        'ast3/Include/grammar.h',\n        'ast3/Include/node.h',\n        'ast3/Include/parsetok.h',\n        'ast3/Include/pgenheaders.h',\n        'ast3/Include/Python-ast.h',\n        'ast3/Include/token.h',\n        'ast3/Parser/parser.h',\n        'ast3/Parser/tokenizer.h',\n    ])\n\nlong_description = \"\"\"\n===========\nEnd of life\n===========\n\nThis project is no longer maintained.\n\nUse the standard library `ast` module instead.\nSee https://github.com/python/typed_ast/issues/179.\n\n===========\nDescription\n===========\n\n`typed_ast` is a Python 3 package that provides a Python 2.7 and Python 3\nparser similar to the standard `ast` library.  Unlike `ast` below Python 3.8,\nthe parsers in\n`typed_ast` include PEP 484 type comments and are independent of the version of\nPython under which they are run.  The `typed_ast` parsers produce the standard\nPython AST (plus type comments), and are both fast and correct, as they are\nbased on the CPython 2.7 and 3.7 parsers.\n\n**Note:** The `ast` module of Python 3.8+ supports all features of `typed_ast`.\n`typed_ast` does not support parsing code that uses syntax introduced in\nPython 3.8 onwards.\nWe recommend using `ast` on Python 3.8 or above.\n\"\"\".strip()\n\n_version_re = re.compile(r'__version__\\s+=\\s+(?P<version>.*)')\n\nwith open('typed_ast/__init__.py', 'r', encoding='utf8') as f:\n    version = _version_re.search(f.read()).group('version')\n    version = str(ast.literal_eval(version))\n\nsetup (name = 'typed_ast',\n       version = version,\n       description = 'a fork of Python 2 and 3 ast modules with type comment support',\n       long_description = long_description,\n       author = 'David Fisher',\n       url = 'https://github.com/python/typed_ast',\n       license='Apache License 2.0',\n       platforms = ['POSIX', 'Windows'],\n       classifiers = [\n           'Development Status :: 7 - Inactive',\n           'Environment :: Console',\n           'Intended Audience :: Developers',\n           'Operating System :: POSIX',\n           'Operating System :: Microsoft',\n           'Programming Language :: Python :: 3.6',\n           'Programming Language :: Python :: 3.7',\n           'Programming Language :: Python :: 3.8',\n           'Programming Language :: Python :: 3.9',\n           'Programming Language :: Python :: 3.10',\n           'Programming Language :: Python :: 3.11',\n           'Topic :: Software Development',\n       ],\n       python_requires=\">=3.6\",\n       packages = ['typed_ast', 'typed_ast.tests'],\n       package_dir={ 'typed_ast.tests': 'ast3/tests' },\n       ext_package='typed_ast',\n       ext_modules = [_ast27, _ast3])\n"
  },
  {
    "path": "tools/Grammar.patch",
    "content": "diff --git a/ast3/Grammar/Grammar b/ast3/Grammar/Grammar\nindex b139e9f..dfd730f 100644\n--- a/ast3/Grammar/Grammar\n+++ b/ast3/Grammar/Grammar\n@@ -14,7 +14,10 @@\n #       single_input is a single interactive statement;\n #       file_input is a module or sequence of commands read from an input file;\n #       eval_input is the input for the eval() functions.\n+#       func_type_input is a PEP 484 Python 2 function type comment\n # NB: compound_stmt in single_input is followed by extra NEWLINE!\n+# NB: due to the way TYPE_COMMENT is tokenized it will always be followed by a\n+#      NEWLINE\n single_input: NEWLINE | simple_stmt | compound_stmt NEWLINE\n file_input: (NEWLINE | stmt)* ENDMARKER\n eval_input: testlist NEWLINE* ENDMARKER\n@@ -24,14 +27,14 @@ decorators: decorator+\n decorated: decorators (classdef | funcdef | async_funcdef)\n \n async_funcdef: ASYNC funcdef\n-funcdef: 'def' NAME parameters ['->' test] ':' suite\n+funcdef: 'def' NAME parameters ['->' test] ':' [TYPE_COMMENT] suite\n \n parameters: '(' [typedargslist] ')'\n-typedargslist: (tfpdef ['=' test] (',' tfpdef ['=' test])* [',' [\n-        '*' [tfpdef] (',' tfpdef ['=' test])* [',' ['**' tfpdef [',']]]\n-      | '**' tfpdef [',']]]\n-  | '*' [tfpdef] (',' tfpdef ['=' test])* [',' ['**' tfpdef [',']]]\n-  | '**' tfpdef [','])\n+typedargslist: (tfpdef ['=' test] (',' [TYPE_COMMENT] tfpdef ['=' test])* (TYPE_COMMENT | [',' [TYPE_COMMENT] [\n+        '*' [tfpdef] (',' [TYPE_COMMENT] tfpdef ['=' test])* (TYPE_COMMENT | [',' [TYPE_COMMENT] ['**' tfpdef [','] [TYPE_COMMENT]]])\n+      | '**' tfpdef [','] [TYPE_COMMENT]]])\n+  | '*' [tfpdef] (',' [TYPE_COMMENT] tfpdef ['=' test])* (TYPE_COMMENT | [',' [TYPE_COMMENT] ['**' tfpdef [','] [TYPE_COMMENT]]])\n+  | '**' tfpdef [','] [TYPE_COMMENT])\n tfpdef: NAME [':' test]\n varargslist: (vfpdef ['=' test] (',' vfpdef ['=' test])* [',' [\n         '*' [vfpdef] (',' vfpdef ['=' test])* [',' ['**' vfpdef [',']]]\n@@ -46,7 +49,7 @@ simple_stmt: small_stmt (';' small_stmt)* [';'] NEWLINE\n small_stmt: (expr_stmt | del_stmt | pass_stmt | flow_stmt |\n              import_stmt | global_stmt | nonlocal_stmt | assert_stmt)\n expr_stmt: testlist_star_expr (annassign | augassign (yield_expr|testlist) |\n-                     ('=' (yield_expr|testlist_star_expr))*)\n+                     ('=' (yield_expr|testlist_star_expr))* [TYPE_COMMENT])\n annassign: ':' test ['=' test]\n testlist_star_expr: (test|star_expr) (',' (test|star_expr))* [',']\n augassign: ('+=' | '-=' | '*=' | '@=' | '/=' | '%=' | '&=' | '|=' | '^=' |\n@@ -78,17 +81,18 @@ compound_stmt: if_stmt | while_stmt | for_stmt | try_stmt | with_stmt | funcdef\n async_stmt: ASYNC (funcdef | with_stmt | for_stmt)\n if_stmt: 'if' test ':' suite ('elif' test ':' suite)* ['else' ':' suite]\n while_stmt: 'while' test ':' suite ['else' ':' suite]\n-for_stmt: 'for' exprlist 'in' testlist ':' suite ['else' ':' suite]\n+for_stmt: 'for' exprlist 'in' testlist ':' [TYPE_COMMENT] suite ['else' ':' suite]\n try_stmt: ('try' ':' suite\n            ((except_clause ':' suite)+\n             ['else' ':' suite]\n             ['finally' ':' suite] |\n            'finally' ':' suite))\n-with_stmt: 'with' with_item (',' with_item)*  ':' suite\n+with_stmt: 'with' with_item (',' with_item)*  ':' [TYPE_COMMENT] suite\n with_item: test ['as' expr]\n # NB compile.c makes sure that the default except clause is last\n except_clause: 'except' [test ['as' NAME]]\n-suite: simple_stmt | NEWLINE INDENT stmt+ DEDENT\n+# the TYPE_COMMENT in suites is only parsed for funcdefs, but can't go elsewhere due to ambiguity\n+suite: simple_stmt | NEWLINE [TYPE_COMMENT NEWLINE] INDENT stmt+ DEDENT\n \n test: or_test ['if' or_test 'else' test] | lambdef\n test_nocond: or_test | lambdef_nocond\n@@ -154,3 +158,10 @@ encoding_decl: NAME\n \n yield_expr: 'yield' [yield_arg]\n yield_arg: 'from' test | testlist\n+\n+func_type_input: func_type NEWLINE* ENDMARKER\n+func_type: '(' [typelist] ')' '->' test\n+# typelist is a modified typedargslist (see above)\n+typelist: (test (',' test)* [','\n+       ['*' [test] (',' test)* [',' '**' test] | '**' test]]\n+     |  '*' [test] (',' test)* [',' '**' test] | '**' test)\n"
  },
  {
    "path": "tools/Python-asdl.patch",
    "content": "diff --git a/ast3/Parser/Python.asdl b/ast3/Parser/Python.asdl\nindex f470ad1..7bde99c 100644\n--- a/ast3/Parser/Python.asdl\n+++ b/ast3/Parser/Python.asdl\n@@ -6,17 +6,18 @@\n \n module Python\n {\n-    mod = Module(stmt* body)\n+    mod = Module(stmt* body, type_ignore *type_ignores)\n         | Interactive(stmt* body)\n         | Expression(expr body)\n+        | FunctionType(expr* argtypes, expr returns)\n \n         -- not really an actual node but useful in Jython's typesystem.\n         | Suite(stmt* body)\n \n     stmt = FunctionDef(identifier name, arguments args,\n-                       stmt* body, expr* decorator_list, expr? returns)\n+                       stmt* body, expr* decorator_list, expr? returns, string? type_comment)\n           | AsyncFunctionDef(identifier name, arguments args,\n-                             stmt* body, expr* decorator_list, expr? returns)\n+                             stmt* body, expr* decorator_list, expr? returns, string? type_comment)\n \n           | ClassDef(identifier name,\n              expr* bases,\n@@ -26,18 +27,18 @@ module Python\n           | Return(expr? value)\n \n           | Delete(expr* targets)\n-          | Assign(expr* targets, expr value)\n+          | Assign(expr* targets, expr value, string? type_comment)\n           | AugAssign(expr target, operator op, expr value)\n           -- 'simple' indicates that we annotate simple name without parens\n           | AnnAssign(expr target, expr annotation, expr? value, int simple)\n \n           -- use 'orelse' because else is a keyword in target languages\n-          | For(expr target, expr iter, stmt* body, stmt* orelse)\n-          | AsyncFor(expr target, expr iter, stmt* body, stmt* orelse)\n+          | For(expr target, expr iter, stmt* body, stmt* orelse, string? type_comment)\n+          | AsyncFor(expr target, expr iter, stmt* body, stmt* orelse, string? type_comment)\n           | While(expr test, stmt* body, stmt* orelse)\n           | If(expr test, stmt* body, stmt* orelse)\n-          | With(withitem* items, stmt* body)\n-          | AsyncWith(withitem* items, stmt* body)\n+          | With(withitem* items, stmt* body, string? type_comment)\n+          | AsyncWith(withitem* items, stmt* body, string? type_comment)\n \n           | Raise(expr? exc, expr? cause)\n           | Try(stmt* body, excepthandler* handlers, stmt* orelse, stmt* finalbody)\n@@ -118,7 +119,7 @@ module Python\n     arguments = (arg* args, arg? vararg, arg* kwonlyargs, expr* kw_defaults,\n                  arg? kwarg, expr* defaults)\n \n-    arg = (identifier arg, expr? annotation)\n+    arg = (identifier arg, expr? annotation, string? type_comment)\n            attributes (int lineno, int col_offset)\n \n     -- keyword arguments supplied to call (NULL identifier for **kwargs)\n@@ -128,5 +129,7 @@ module Python\n     alias = (identifier name, identifier? asname)\n \n     withitem = (expr context_expr, expr? optional_vars)\n+\n+    type_ignore = TypeIgnore(int lineno)\n }\n \n"
  },
  {
    "path": "tools/asdl_c.patch",
    "content": "--- /Users/guido/src/cpython37/Parser/asdl_c.py\t2018-09-10 08:18:23.000000000 -0700\n+++ ast3/Parser/asdl_c.py\t2019-01-15 16:13:24.000000000 -0800\n@@ -270,9 +270,9 @@\n         margs = \"a0\"\n         for i in range(1, len(args)+1):\n             margs += \", a%d\" % i\n-        self.emit(\"#define %s(%s) _Py_%s(%s)\" % (name, margs, name, margs), 0,\n+        self.emit(\"#define %s(%s) _Ta3_%s(%s)\" % (name, margs, name, margs), 0,\n                 reflow=False)\n-        self.emit(\"%s _Py_%s(%s);\" % (ctype, name, argstr), False)\n+        self.emit(\"%s _Ta3_%s(%s);\" % (ctype, name, argstr), False)\n \n     def visitProduct(self, prod, name):\n         self.emit_function(name, get_c_type(name),\n@@ -531,9 +531,9 @@\n             self.emit(\"}\", depth+1)\n             self.emit(\"len = PyList_GET_SIZE(tmp);\", depth+1)\n             if self.isSimpleType(field):\n-                self.emit(\"%s = _Py_asdl_int_seq_new(len, arena);\" % field.name, depth+1)\n+                self.emit(\"%s = _Ta3_asdl_int_seq_new(len, arena);\" % field.name, depth+1)\n             else:\n-                self.emit(\"%s = _Py_asdl_seq_new(len, arena);\" % field.name, depth+1)\n+                self.emit(\"%s = _Ta3_asdl_seq_new(len, arena);\" % field.name, depth+1)\n             self.emit(\"if (%s == NULL) goto failed;\" % field.name, depth+1)\n             self.emit(\"for (i = 0; i < len; i++) {\", depth+1)\n             self.emit(\"%s val;\" % ctype, depth+2)\n@@ -729,8 +729,8 @@\n };\n \n static PyTypeObject AST_type = {\n-    PyVarObject_HEAD_INIT(&PyType_Type, 0)\n-    \"_ast.AST\",\n+    PyVarObject_HEAD_INIT(NULL, 0)\n+    \"_ast3.AST\",\n     sizeof(AST_object),\n     0,\n     (destructor)ast_dealloc, /* tp_dealloc */\n@@ -774,7 +774,7 @@\n static PyTypeObject* make_type(char *type, PyTypeObject* base, char**fields, int num_fields)\n {\n     _Py_IDENTIFIER(__module__);\n-    _Py_IDENTIFIER(_ast);\n+    _Py_IDENTIFIER(_ast3);\n     PyObject *fnames, *result;\n     int i;\n     fnames = PyTuple_New(num_fields);\n@@ -791,7 +791,7 @@\n                     type, base,\n                     _PyUnicode_FromId(&PyId__fields), fnames,\n                     _PyUnicode_FromId(&PyId___module__),\n-                    _PyUnicode_FromId(&PyId__ast));\n+                    _PyUnicode_FromId(&PyId__ast3));\n     Py_DECREF(fnames);\n     return (PyTypeObject*)result;\n }\n@@ -1010,11 +1010,16 @@\n class ASTModuleVisitor(PickleVisitor):\n \n     def visitModule(self, mod):\n+        self.emit(\"PyObject *ast3_parse(PyObject *self, PyObject *args);\", 0)\n+        self.emit(\"static PyMethodDef ast3_methods[] = {\", 0)\n+        self.emit('    {\"_parse\",  ast3_parse, METH_VARARGS, \"Parse string into typed AST.\"},', 0)\n+        self.emit(\"    {NULL, NULL, 0, NULL}\", 0)\n+        self.emit(\"};\", 0)\n         self.emit(\"static struct PyModuleDef _astmodule = {\", 0)\n-        self.emit('  PyModuleDef_HEAD_INIT, \"_ast\"', 0)\n+        self.emit('    PyModuleDef_HEAD_INIT, \"_ast3\", NULL, 0, ast3_methods', 0)\n         self.emit(\"};\", 0)\n         self.emit(\"PyMODINIT_FUNC\", 0)\n-        self.emit(\"PyInit__ast(void)\", 0)\n+        self.emit(\"PyInit__ast3(void)\", 0)\n         self.emit(\"{\", 0)\n         self.emit(\"PyObject *m, *d;\", 1)\n         self.emit(\"if (!init_types()) return NULL;\", 1)\n@@ -1199,7 +1204,7 @@\n class PartingShots(StaticVisitor):\n \n     CODE = \"\"\"\n-PyObject* PyAST_mod2obj(mod_ty t)\n+PyObject* Ta3AST_mod2obj(mod_ty t)\n {\n     if (!init_types())\n         return NULL;\n@@ -1207,7 +1212,7 @@\n }\n \n /* mode is 0 for \"exec\", 1 for \"eval\" and 2 for \"single\" input */\n-mod_ty PyAST_obj2mod(PyObject* ast, PyArena* arena, int mode)\n+mod_ty Ta3AST_obj2mod(PyObject* ast, PyArena* arena, int mode)\n {\n     mod_ty res;\n     PyObject *req_type[3];\n@@ -1237,7 +1242,7 @@\n         return res;\n }\n \n-int PyAST_Check(PyObject* obj)\n+int Ta3AST_Check(PyObject* obj)\n {\n     if (!init_types())\n         return -1;\n@@ -1276,9 +1281,9 @@\n                                 PrototypeVisitor(f),\n                                 )\n             c.visit(mod)\n-            f.write(\"PyObject* PyAST_mod2obj(mod_ty t);\\n\")\n-            f.write(\"mod_ty PyAST_obj2mod(PyObject* ast, PyArena* arena, int mode);\\n\")\n-            f.write(\"int PyAST_Check(PyObject* obj);\\n\")\n+            f.write(\"PyObject* Ta3AST_mod2obj(mod_ty t);\\n\")\n+            f.write(\"mod_ty Ta3AST_obj2mod(PyObject* ast, PyArena* arena, int mode);\\n\")\n+            f.write(\"int Ta3AST_Check(PyObject* obj);\\n\")\n \n     if C_FILE:\n         with open(C_FILE, \"w\") as f:\n"
  },
  {
    "path": "tools/ast.patch",
    "content": "diff --git a/ast3/Python/ast.c b/ast3/Python/ast.c\nindex e12f8e6..1fa762d 100644\n--- a/ast3/Python/ast.c\n+++ b/ast3/Python/ast.c\n@@ -665,6 +665,13 @@ new_identifier(const char *n, struct compiling *c)\n \n #define NEW_IDENTIFIER(n) new_identifier(STR(n), c)\n \n+static string\n+new_type_comment(const char *s, struct compiling *c)\n+{\n+  return PyUnicode_DecodeUTF8(s, strlen(s), NULL);\n+}\n+#define NEW_TYPE_COMMENT(n) new_type_comment(STR(n), c)\n+\n static int\n ast_error(struct compiling *c, const node *n, const char *errmsg)\n {\n@@ -734,11 +741,15 @@ num_stmts(const node *n)\n         case simple_stmt:\n             return NCH(n) / 2; /* Divide by 2 to remove count of semi-colons */\n         case suite:\n+            /* suite: simple_stmt | NEWLINE [TYPE_COMMENT NEWLINE] INDENT stmt+ DEDENT */\n             if (NCH(n) == 1)\n                 return num_stmts(CHILD(n, 0));\n             else {\n+                i = 2;\n                 l = 0;\n-                for (i = 2; i < (NCH(n) - 1); i++)\n+                if (TYPE(CHILD(n, 1)) == TYPE_COMMENT)\n+                    i += 2;\n+                for (; i < (NCH(n) - 1); i++)\n                     l += num_stmts(CHILD(n, i));\n                 return l;\n             }\n@@ -763,10 +774,13 @@ Ta3AST_FromNodeObject(const node *n, PyCompilerFlags *flags,\n {\n     int i, j, k, num;\n     asdl_seq *stmts = NULL;\n+    asdl_seq *type_ignores = NULL;\n     stmt_ty s;\n     node *ch;\n     struct compiling c;\n     mod_ty res = NULL;\n+    asdl_seq *argtypes = NULL;\n+    expr_ty ret, arg;\n \n     c.c_arena = arena;\n     /* borrowed reference */\n@@ -806,7 +820,23 @@ Ta3AST_FromNodeObject(const node *n, PyCompilerFlags *flags,\n                     }\n                 }\n             }\n-            res = Module(stmts, arena);\n+\n+            /* Type ignores are stored under the ENDMARKER in file_input. */\n+            ch = CHILD(n, NCH(n) - 1);\n+            REQ(ch, ENDMARKER);\n+            num = NCH(ch);\n+            type_ignores = _Ta3_asdl_seq_new(num, arena);\n+            if (!type_ignores)\n+                goto out;\n+\n+            for (i = 0; i < num; i++) {\n+                type_ignore_ty ti = TypeIgnore(LINENO(CHILD(ch, i)), arena);\n+                if (!ti)\n+                    goto out;\n+                asdl_seq_SET(type_ignores, i, ti);\n+            }\n+\n+            res = Module(stmts, type_ignores, arena);\n             break;\n         case eval_input: {\n             expr_ty testlist_ast;\n@@ -857,6 +887,40 @@ Ta3AST_FromNodeObject(const node *n, PyCompilerFlags *flags,\n                 res = Interactive(stmts, arena);\n             }\n             break;\n+        case func_type_input:\n+            n = CHILD(n, 0);\n+            REQ(n, func_type);\n+\n+            if (TYPE(CHILD(n, 1)) == typelist) {\n+                ch = CHILD(n, 1);\n+                /* this is overly permissive -- we don't pay any attention to\n+                 * stars on the args -- just parse them into an ordered list */\n+                num = 0;\n+                for (i = 0; i < NCH(ch); i++) {\n+                    if (TYPE(CHILD(ch, i)) == test)\n+                        num++;\n+                }\n+\n+                argtypes = _Ta3_asdl_seq_new(num, arena);\n+\n+                j = 0;\n+                for (i = 0; i < NCH(ch); i++) {\n+                    if (TYPE(CHILD(ch, i)) == test) {\n+                        arg = ast_for_expr(&c, CHILD(ch, i));\n+                        if (!arg)\n+                            goto out;\n+                        asdl_seq_SET(argtypes, j++, arg);\n+                    }\n+                }\n+            }\n+            else\n+                argtypes = _Ta3_asdl_seq_new(0, arena);\n+\n+            ret = ast_for_expr(&c, CHILD(n, NCH(n) - 1));\n+            if (!ret)\n+                goto out;\n+            res = FunctionType(argtypes, ret, arena);\n+            break;\n         default:\n             PyErr_Format(PyExc_SystemError,\n                          \"invalid node %d for Ta3AST_FromNode\", TYPE(n));\n@@ -1250,7 +1314,7 @@ ast_for_arg(struct compiling *c, const node *n)\n             return NULL;\n     }\n \n-    ret = arg(name, annotation, LINENO(n), n->n_col_offset, c->c_arena);\n+    ret = arg(name, annotation, NULL, LINENO(n), n->n_col_offset, c->c_arena);\n     if (!ret)\n         return NULL;\n     return ret;\n@@ -1308,12 +1372,19 @@ handle_keywordonly_args(struct compiling *c, const node *n, int start,\n                     goto error;\n                 if (forbidden_name(c, argname, ch, 0))\n                     goto error;\n-                arg = arg(argname, annotation, LINENO(ch), ch->n_col_offset,\n+                arg = arg(argname, annotation, NULL, LINENO(ch), ch->n_col_offset,\n                           c->c_arena);\n                 if (!arg)\n                     goto error;\n                 asdl_seq_SET(kwonlyargs, j++, arg);\n-                i += 2; /* the name and the comma */\n+                i += 1; /* the name */\n+                if (TYPE(CHILD(n, i)) == COMMA)\n+                    i += 1; /* the comma, if present */\n+                break;\n+            case TYPE_COMMENT:\n+                /* arg will be equal to the last argument processed */\n+                arg->type_comment = NEW_TYPE_COMMENT(ch);\n+                i += 1;\n                 break;\n             case DOUBLESTAR:\n                 return i;\n@@ -1448,11 +1519,14 @@ ast_for_arguments(struct compiling *c, const node *n)\n                 if (!arg)\n                     return NULL;\n                 asdl_seq_SET(posargs, k++, arg);\n-                i += 2; /* the name and the comma */\n+                i += 1; /* the name */\n+                if (TYPE(CHILD(n, i)) == COMMA)\n+                    i += 1; /* the comma, if present */\n                 break;\n             case STAR:\n                 if (i+1 >= NCH(n) ||\n-                    (i+2 == NCH(n) && TYPE(CHILD(n, i+1)) == COMMA)) {\n+                    (i+2 == NCH(n) && (TYPE(CHILD(n, i+1)) == COMMA\n+                                       || TYPE(CHILD(n, i+1)) == TYPE_COMMENT))) {\n                     ast_error(c, CHILD(n, i),\n                         \"named arguments must follow bare *\");\n                     return NULL;\n@@ -1461,6 +1535,13 @@ ast_for_arguments(struct compiling *c, const node *n)\n                 if (TYPE(ch) == COMMA) {\n                     int res = 0;\n                     i += 2; /* now follows keyword only arguments */\n+\n+                    if (TYPE(CHILD(n, i)) == TYPE_COMMENT) {\n+                        ast_error(c, CHILD(n, i),\n+                                \"bare * has associated type comment\");\n+                        return NULL;\n+                    }\n+\n                     res = handle_keywordonly_args(c, n, i,\n                                                   kwonlyargs, kwdefaults);\n                     if (res == -1) return NULL;\n@@ -1471,7 +1552,15 @@ ast_for_arguments(struct compiling *c, const node *n)\n                     if (!vararg)\n                         return NULL;\n \n-                    i += 3;\n+                i += 2; /* the star and the name */\n+                if (TYPE(CHILD(n, i)) == COMMA)\n+                    i += 1; /* the comma, if present */\n+\n+                    if (TYPE(CHILD(n, i)) == TYPE_COMMENT) {\n+                        vararg->type_comment = NEW_TYPE_COMMENT(CHILD(n, i));\n+                        i += 1;\n+                    }\n+\n                     if (i < NCH(n) && (TYPE(CHILD(n, i)) == tfpdef\n                                     || TYPE(CHILD(n, i)) == vfpdef)) {\n                         int res = 0;\n@@ -1488,7 +1577,19 @@ ast_for_arguments(struct compiling *c, const node *n)\n                 kwarg = ast_for_arg(c, ch);\n                 if (!kwarg)\n                     return NULL;\n-                i += 3;\n+                i += 2; /* the double star and the name */\n+                if (TYPE(CHILD(n, i)) == COMMA)\n+                    i += 1; /* the comma, if present */\n+                break;\n+            case TYPE_COMMENT:\n+                assert(i);\n+\n+                if (kwarg)\n+                    arg = kwarg;\n+\n+                /* arg will be equal to the last argument processed */\n+                arg->type_comment = NEW_TYPE_COMMENT(ch);\n+                i += 1;\n                 break;\n             default:\n                 PyErr_Format(PyExc_SystemError,\n@@ -1593,12 +1694,14 @@ static stmt_ty\n ast_for_funcdef_impl(struct compiling *c, const node *n,\n                      asdl_seq *decorator_seq, int is_async)\n {\n-    /* funcdef: 'def' NAME parameters ['->' test] ':' suite */\n+    /* funcdef: 'def' NAME parameters ['->' test] ':' [TYPE_COMMENT] suite */\n     identifier name;\n     arguments_ty args;\n     asdl_seq *body;\n     expr_ty returns = NULL;\n     int name_i = 1;\n+    node *tc;\n+    string type_comment = NULL;\n \n     REQ(n, funcdef);\n \n@@ -1616,17 +1719,30 @@ ast_for_funcdef_impl(struct compiling *c, const node *n,\n             return NULL;\n         name_i += 2;\n     }\n+    if (TYPE(CHILD(n, name_i + 3)) == TYPE_COMMENT) {\n+        type_comment = NEW_TYPE_COMMENT(CHILD(n, name_i + 3));\n+        name_i += 1;\n+    }\n     body = ast_for_suite(c, CHILD(n, name_i + 3));\n     if (!body)\n         return NULL;\n \n+    if (!type_comment && NCH(CHILD(n, name_i + 3)) > 1) {\n+        /* If the function doesn't have a type comment on the same line, check\n+         * if the suite has a type comment in it. */\n+        tc = CHILD(CHILD(n, name_i + 3), 1);\n+\n+        if (TYPE(tc) == TYPE_COMMENT)\n+            type_comment = NEW_TYPE_COMMENT(tc);\n+    }\n+\n     if (is_async)\n         return AsyncFunctionDef(name, args, body, decorator_seq, returns,\n-                                LINENO(n),\n+                                type_comment, LINENO(n),\n                                 n->n_col_offset, c->c_arena);\n     else\n         return FunctionDef(name, args, body, decorator_seq, returns,\n-                           LINENO(n),\n+                           type_comment, LINENO(n),\n                            n->n_col_offset, c->c_arena);\n }\n \n@@ -2896,15 +3012,16 @@ ast_for_expr_stmt(struct compiling *c, const node *n)\n {\n     REQ(n, expr_stmt);\n     /* expr_stmt: testlist_star_expr (annassign | augassign (yield_expr|testlist) |\n-                            ('=' (yield_expr|testlist_star_expr))*)\n+                           ('=' (yield_expr|testlist_star_expr))* [TYPE_COMMENT])\n        annassign: ':' test ['=' test]\n        testlist_star_expr: (test|star_expr) (',' test|star_expr)* [',']\n        augassign: '+=' | '-=' | '*=' | '@=' | '/=' | '%=' | '&=' | '|=' | '^='\n                 | '<<=' | '>>=' | '**=' | '//='\n        test: ... here starts the operator precedence dance\n      */\n+    int num = NCH(n);\n \n-    if (NCH(n) == 1) {\n+    if (num == 1 || (num == 2 && TYPE(CHILD(n, 1)) == TYPE_COMMENT)) {\n         expr_ty e = ast_for_testlist(c, CHILD(n, 0));\n         if (!e)\n             return NULL;\n@@ -3020,17 +3137,22 @@ ast_for_expr_stmt(struct compiling *c, const node *n)\n         }\n     }\n     else {\n-        int i;\n+        int i, nch_minus_type, has_type_comment;\n         asdl_seq *targets;\n         node *value;\n         expr_ty expression;\n+        string type_comment;\n \n         /* a normal assignment */\n         REQ(CHILD(n, 1), EQUAL);\n-        targets = _Ta3_asdl_seq_new(NCH(n) / 2, c->c_arena);\n+\n+        has_type_comment = TYPE(CHILD(n, num - 1)) == TYPE_COMMENT;\n+        nch_minus_type = num - has_type_comment;\n+\n+        targets = _Ta3_asdl_seq_new(nch_minus_type / 2, c->c_arena);\n         if (!targets)\n             return NULL;\n-        for (i = 0; i < NCH(n) - 2; i += 2) {\n+        for (i = 0; i < nch_minus_type - 2; i += 2) {\n             expr_ty e;\n             node *ch = CHILD(n, i);\n             if (TYPE(ch) == yield_expr) {\n@@ -3047,14 +3169,18 @@ ast_for_expr_stmt(struct compiling *c, const node *n)\n \n             asdl_seq_SET(targets, i / 2, e);\n         }\n-        value = CHILD(n, NCH(n) - 1);\n+        value = CHILD(n, nch_minus_type - 1);\n         if (TYPE(value) == testlist_star_expr)\n             expression = ast_for_testlist(c, value);\n         else\n             expression = ast_for_expr(c, value);\n         if (!expression)\n             return NULL;\n-        return Assign(targets, expression, LINENO(n), n->n_col_offset, c->c_arena);\n+        if (has_type_comment)\n+            type_comment = NEW_TYPE_COMMENT(CHILD(n, nch_minus_type));\n+        else\n+            type_comment = NULL;\n+        return Assign(targets, expression, type_comment, LINENO(n), n->n_col_offset, c->c_arena);\n     }\n }\n \n@@ -3461,7 +3587,7 @@ ast_for_assert_stmt(struct compiling *c, const node *n)\n static asdl_seq *\n ast_for_suite(struct compiling *c, const node *n)\n {\n-    /* suite: simple_stmt | NEWLINE INDENT stmt+ DEDENT */\n+    /* suite: simple_stmt | NEWLINE [TYPE_COMMENT NEWLINE] INDENT stmt+ DEDENT */\n     asdl_seq *seq;\n     stmt_ty s;\n     int i, total, num, end, pos = 0;\n@@ -3491,7 +3617,11 @@ ast_for_suite(struct compiling *c, const node *n)\n         }\n     }\n     else {\n-        for (i = 2; i < (NCH(n) - 1); i++) {\n+        i = 2;\n+        if (TYPE(CHILD(n, 1)) == TYPE_COMMENT)\n+            i += 2;\n+\n+        for (; i < (NCH(n) - 1); i++) {\n             ch = CHILD(n, i);\n             REQ(ch, stmt);\n             num = num_stmts(ch);\n@@ -3692,11 +3822,15 @@ ast_for_for_stmt(struct compiling *c, const node *n, int is_async)\n     expr_ty expression;\n     expr_ty target, first;\n     const node *node_target;\n-    /* for_stmt: 'for' exprlist 'in' testlist ':' suite ['else' ':' suite] */\n+    int has_type_comment;\n+    string type_comment;\n+    /* for_stmt: 'for' exprlist 'in' testlist ':' [TYPE_COMMENT] suite ['else' ':' suite] */\n     REQ(n, for_stmt);\n \n-    if (NCH(n) == 9) {\n-        seq = ast_for_suite(c, CHILD(n, 8));\n+    has_type_comment = TYPE(CHILD(n, 5)) == TYPE_COMMENT;\n+\n+    if (NCH(n) == 9 + has_type_comment) {\n+        seq = ast_for_suite(c, CHILD(n, 8 + has_type_comment));\n         if (!seq)\n             return NULL;\n     }\n@@ -3716,17 +3850,22 @@ ast_for_for_stmt(struct compiling *c, const node *n, int is_async)\n     expression = ast_for_testlist(c, CHILD(n, 3));\n     if (!expression)\n         return NULL;\n-    suite_seq = ast_for_suite(c, CHILD(n, 5));\n+    suite_seq = ast_for_suite(c, CHILD(n, 5 + has_type_comment));\n     if (!suite_seq)\n         return NULL;\n \n+    if (has_type_comment)\n+        type_comment = NEW_TYPE_COMMENT(CHILD(n, 5));\n+    else\n+        type_comment = NULL;\n+\n     if (is_async)\n         return AsyncFor(target, expression, suite_seq, seq,\n-                        LINENO(n), n->n_col_offset,\n+                        type_comment, LINENO(n), n->n_col_offset,\n                         c->c_arena);\n     else\n         return For(target, expression, suite_seq, seq,\n-                   LINENO(n), n->n_col_offset,\n+                   type_comment, LINENO(n), n->n_col_offset,\n                    c->c_arena);\n }\n \n@@ -3872,20 +4011,24 @@ ast_for_with_item(struct compiling *c, const node *n)\n     return withitem(context_expr, optional_vars, c->c_arena);\n }\n \n-/* with_stmt: 'with' with_item (',' with_item)* ':' suite */\n+/* with_stmt: 'with' with_item (',' with_item)*  ':' [TYPE_COMMENT] suite */\n static stmt_ty\n ast_for_with_stmt(struct compiling *c, const node *n, int is_async)\n {\n-    int i, n_items;\n+    int i, n_items, nch_minus_type, has_type_comment;\n     asdl_seq *items, *body;\n+    string type_comment;\n \n     REQ(n, with_stmt);\n \n-    n_items = (NCH(n) - 2) / 2;\n+    has_type_comment = TYPE(CHILD(n, NCH(n) - 2)) == TYPE_COMMENT;\n+    nch_minus_type = NCH(n) - has_type_comment;\n+\n+    n_items = (nch_minus_type - 2) / 2;\n     items = _Ta3_asdl_seq_new(n_items, c->c_arena);\n     if (!items)\n         return NULL;\n-    for (i = 1; i < NCH(n) - 2; i += 2) {\n+    for (i = 1; i < nch_minus_type - 2; i += 2) {\n         withitem_ty item = ast_for_with_item(c, CHILD(n, i));\n         if (!item)\n             return NULL;\n@@ -3896,10 +4039,15 @@ ast_for_with_stmt(struct compiling *c, const node *n, int is_async)\n     if (!body)\n         return NULL;\n \n+    if (has_type_comment)\n+        type_comment = NEW_TYPE_COMMENT(CHILD(n, NCH(n) - 2));\n+    else\n+        type_comment = NULL;\n+\n     if (is_async)\n-        return AsyncWith(items, body, LINENO(n), n->n_col_offset, c->c_arena);\n+        return AsyncWith(items, body, type_comment, LINENO(n), n->n_col_offset, c->c_arena);\n     else\n-        return With(items, body, LINENO(n), n->n_col_offset, c->c_arena);\n+        return With(items, body, type_comment, LINENO(n), n->n_col_offset, c->c_arena);\n }\n \n static stmt_ty\n"
  },
  {
    "path": "tools/find_exported_symbols",
    "content": "#!/bin/bash\nPROJ_DIR=\"$( cd \"$( dirname \"${BASH_SOURCE[0]}\" )\" && pwd )/..\"\n\n# This requires GNU binutils (e.g. brew install binutils).\n\n/usr/local/opt/binutils/bin/gobjdump -t $PROJ_DIR/build/lib*/_ast${1}.*.so \\\n    | grep ' g ' \\\n    | grep -v UND \\\n    | sed 's/.* _//' \\\n    | grep -v PyInit__ast \\\n    | grep 'Py' \\\n    > \"exported_symbols${1}.txt\"\n"
  },
  {
    "path": "tools/parsetok.patch",
    "content": "diff --git a/ast3/Parser/parsetok.c b/ast3/Parser/parsetok.c\nindex 9f01a0d..5529feb 100644\n--- a/ast3/Parser/parsetok.c\n+++ b/ast3/Parser/parsetok.c\n@@ -177,6 +177,38 @@ warn(const char *msg, const char *filename, int lineno)\n #endif\n #endif\n \n+typedef struct {\n+    int *items;\n+    size_t size;\n+    size_t num_items;\n+} growable_int_array;\n+\n+int growable_int_array_init(growable_int_array *arr, size_t initial_size) {\n+    assert(initial_size > 0);\n+    arr->items = malloc(initial_size * sizeof(*arr->items));\n+    arr->size = initial_size;\n+    arr->num_items = 0;\n+\n+    return arr->items != NULL;\n+}\n+\n+int growable_int_array_add(growable_int_array *arr, int item) {\n+    if (arr->num_items >= arr->size) {\n+        arr->size *= 2;\n+        arr->items = realloc(arr->items, arr->size * sizeof(*arr->items));\n+        if (!arr->items)\n+            return 0;\n+    }\n+\n+    arr->items[arr->num_items] = item;\n+    arr->num_items++;\n+    return 1;\n+}\n+\n+void growable_int_array_deallocate(growable_int_array *arr) {\n+    free(arr->items);\n+}\n+\n /* Parse input coming from the given tokenizer structure.\n    Return error code. */\n \n@@ -188,6 +220,13 @@ parsetok(struct tok_state *tok, grammar *g, int start, perrdetail *err_ret,\n     node *n;\n     int started = 0;\n \n+    growable_int_array type_ignores;\n+    if (!growable_int_array_init(&type_ignores, 10)) {\n+        err_ret->error = E_NOMEM;\n+        Ta3Tokenizer_Free(tok);\n+        return NULL;\n+    }\n+\n     if ((ps = Ta3Parser_New(g, start)) == NULL) {\n         err_ret->error = E_NOMEM;\n         Ta3Tokenizer_Free(tok);\n@@ -259,6 +298,14 @@ parsetok(struct tok_state *tok, grammar *g, int start, perrdetail *err_ret,\n         else\n             col_offset = -1;\n \n+        if (type == TYPE_IGNORE) {\n+            if (!growable_int_array_add(&type_ignores, tok->lineno)) {\n+                err_ret->error = E_NOMEM;\n+                break;\n+            }\n+            continue;\n+        }\n+\n         if ((err_ret->error =\n              Ta3Parser_AddToken(ps, (int)type, str,\n                                tok->lineno, col_offset,\n@@ -275,6 +322,22 @@ parsetok(struct tok_state *tok, grammar *g, int start, perrdetail *err_ret,\n         n = ps->p_tree;\n         ps->p_tree = NULL;\n \n+        if (n->n_type == file_input) {\n+            /* Put type_ignore nodes in the ENDMARKER of file_input. */\n+            int num;\n+            node *ch;\n+            size_t i;\n+\n+            num = NCH(n);\n+            ch = CHILD(n, num - 1);\n+            REQ(ch, ENDMARKER);\n+\n+            for (i = 0; i < type_ignores.num_items; i++) {\n+                Ta3Node_AddChild(ch, TYPE_IGNORE, NULL, type_ignores.items[i], 0);\n+            }\n+        }\n+        growable_int_array_deallocate(&type_ignores);\n+\n #ifndef PGEN\n         /* Check that the source for a single input statement really\n            is a single statement by looking at what is left in the\n"
  },
  {
    "path": "tools/script",
    "content": "#!/bin/bash -ex\n\n# Automate steps 1-4 of update_process.md (Mac).\n\nHERE=$(dirname ${BASH_SOURCE[0]})\ncd $HERE/..\npwd\n\nCPYTHON=~/src/cpython37\n\nDIRS=\"Grammar Include Parser Python\"\nC_FILES=\"Parser/acceler.c Parser/bitset.c Parser/grammar.c Parser/grammar1.c Parser/node.c Parser/parser.c Parser/parsetok.c Parser/tokenizer.c Python/asdl.c Python/ast.c Python/graminit.c Python/Python-ast.c\"\nH_FILES=\"Include/asdl.h Include/ast.h Include/bitset.h Include/errcode.h Include/graminit.h Include/grammar.h Include/node.h Include/parsetok.h Include/Python-ast.h Include/token.h Parser/parser.h Parser/tokenizer.h\"\nOTHER_FILES=\"Grammar/Grammar Parser/Python.asdl Parser/asdl.py Parser/asdl_c.py\"\n\nfor dir in $DIRS\ndo\n    rm -rf ast3/$dir\n    mkdir -p ast3/$dir\ndone\n\nfor file in $C_FILES $H_FILES $OTHER_FILES\ndo\n    cp $CPYTHON/$file ast3/$file\ndone\n\n./tools/update_header_guards 3\n\nrm -rf build\ngrep -v ast3/Custom setup.py | python3.7 - build\n\n./tools/find_exported_symbols 3\n./tools/update_exported_symbols 3\n\npatch ast3/Parser/asdl_c.py <tools/asdl_c.patch\n\npython3.7 ast3/Parser/asdl_c.py -h ast3/Include/Python-ast.h ast3/Parser/Python.asdl\npython3.7 ast3/Parser/asdl_c.py -c ast3/Python/Python-ast.c ast3/Parser/Python.asdl\n\npython3.7 setup.py build\n\n# Lots of manual changes go here...\n\n##PYTHONPATH=build/lib.macosx-10.9-x86_64-3.7/ python3.7 -m pytest -s ast3/tests\n"
  },
  {
    "path": "tools/token.patch",
    "content": "diff --git a/ast3/Include/token.h b/ast3/Include/token.h\nindex a657fdd..d0b2b94 100644\n--- a/ast3/Include/token.h\n+++ b/ast3/Include/token.h\n@@ -68,8 +68,10 @@ extern \"C\" {\n /* These aren't used by the C tokenizer but are needed for tokenize.py */\n #define COMMENT         55\n #define NL              56\n-#define ENCODING                57\n-#define N_TOKENS        58\n+#define ENCODING        57\n+#define TYPE_IGNORE     58\n+#define TYPE_COMMENT    59\n+#define N_TOKENS        60\n \n /* Special definitions for cooperation with parser */\n \n"
  },
  {
    "path": "tools/tokenizer.patch",
    "content": "diff --git a/ast3/Parser/tokenizer.c b/ast3/Parser/tokenizer.c\nindex 617a744..667fb4a 100644\n--- a/ast3/Parser/tokenizer.c\n+++ b/ast3/Parser/tokenizer.c\n@@ -105,10 +105,16 @@ const char *_Ta3Parser_TokenNames[] = {\n     \"OP\",\n     \"AWAIT\",\n     \"ASYNC\",\n+    \"TYPE_IGNORE\",\n+    \"TYPE_COMMENT\",\n     \"<ERRORTOKEN>\",\n     \"<N_TOKENS>\"\n };\n \n+/* Spaces in this constant are treated as \"zero or more spaces or tabs\" when\n+   tokenizing. */\n+static const char* type_comment_prefix = \"# type: \";\n+\n \n /* Create and initialize a new tok_state structure */\n \n@@ -1493,10 +1499,56 @@ tok_get(struct tok_state *tok, char **p_start, char **p_end)\n     /* Set start of current token */\n     tok->start = tok->cur - 1;\n \n-    /* Skip comment */\n+    /* Skip comment, unless it's a type comment */\n     if (c == '#') {\n-        while (c != EOF && c != '\\n') {\n+        const char *prefix, *p, *type_start;\n+\n+        while (c != EOF && c != '\\n')\n             c = tok_nextc(tok);\n+\n+        p = tok->start;\n+        prefix = type_comment_prefix;\n+        while (*prefix && p < tok->cur) {\n+            if (*prefix == ' ') {\n+                while (*p == ' ' || *p == '\\t')\n+                    p++;\n+            } else if (*prefix == *p) {\n+                p++;\n+            } else {\n+                break;\n+            }\n+\n+            prefix++;\n+        }\n+\n+        /* This is a type comment if we matched all of type_comment_prefix. */\n+        if (!*prefix) {\n+            int is_type_ignore = 1;\n+            tok_backup(tok, c);  /* don't eat the newline or EOF */\n+\n+            type_start = p;\n+\n+            is_type_ignore = tok->cur >= p + 6 && memcmp(p, \"ignore\", 6) == 0;\n+            p += 6;\n+            while (is_type_ignore && p < tok->cur) {\n+              if (*p == '#')\n+                  break;\n+              is_type_ignore = is_type_ignore && (*p == ' ' || *p == '\\t');\n+              p++;\n+            }\n+\n+            if (is_type_ignore) {\n+                /* If this type ignore is the only thing on the line, consume the newline also. */\n+                if (blankline) {\n+                    tok_nextc(tok);\n+                    tok->atbol = 1;\n+                }\n+                return TYPE_IGNORE;\n+            } else {\n+                *p_start = (char *) type_start;  /* after type_comment_prefix */\n+                *p_end = tok->cur;\n+                return TYPE_COMMENT;\n+            }\n         }\n     }\n \n"
  },
  {
    "path": "tools/update_ast27_asdl",
    "content": "#!/bin/bash -eux\n\n# Run after changing `Parser/Python.asdl`\n\nPROJ_DIR=\"$( cd \"$( dirname \"${BASH_SOURCE[0]}\" )\" && pwd )/..\"\n\npython2 ast27/Parser/asdl_c.py -h ast27/Include/ ast27/Parser/Python.asdl\npython2 ast27/Parser/asdl_c.py -c ast27/Python/ ast27/Parser/Python.asdl\n"
  },
  {
    "path": "tools/update_ast3_asdl",
    "content": "#!/bin/bash -eux\n\n# Run after changing `Parser/Python.asdl`\n\nPROJ_DIR=\"$( cd \"$( dirname \"${BASH_SOURCE[0]}\" )\" && pwd )/..\"\n\npython3 ast3/Parser/asdl_c.py -h ast3/Include/Python-ast.h ast3/Parser/Python.asdl\npython3 ast3/Parser/asdl_c.py -c ast3/Python/Python-ast.c ast3/Parser/Python.asdl\n"
  },
  {
    "path": "tools/update_ast3_grammar",
    "content": "#!/bin/bash -eux\n\n# Run after changing `Grammar/Grammar`\n\nPROJ_DIR=\"$( cd \"$( dirname \"${BASH_SOURCE[0]}\" )\" && pwd )/..\"\n\necho 'Copying pgen'\ncp ~/src/cpython37/Parser/pgen tools/pgen3\n\necho 'Updating graminit files'\ntools/pgen3 ast3/Grammar/Grammar ast3/Include/graminit.h ast3/Python/graminit.c\n\necho 'Grammar file update complete'\n"
  },
  {
    "path": "tools/update_exported_symbols",
    "content": "#!/bin/bash\nPROJ_DIR=\"$( cd \"$( dirname \"${BASH_SOURCE[0]}\" )\" && pwd )/..\"\n\nfor CHANGE in $( cat \"$PROJ_DIR/exported_symbols${1}.txt\" ); do\n  if [[ ${CHANGE:0:1} == \"_\" ]] ; then\n    NEW=\"_Ta${1}${CHANGE:3}\"\n  else\n    NEW=\"Ta${1}${CHANGE:2}\"\n  fi\n  find \"$PROJ_DIR/ast${1}\" -type f -name '*.h' -or -name '*.c' | xargs -n 1 sed -i '' \"s/$CHANGE/$NEW/\"\ndone\n\necho \"Symbols updated.  Remember to also update autogeneration code like Parser/asdl_c.py.\"\n"
  },
  {
    "path": "tools/update_header_guards",
    "content": "#!/bin/bash -eux\n\n# usage: ./update_header_guards VERSION_NUMBER\n\nPROJ_DIR=\"$( cd \"$( dirname \"${BASH_SOURCE[0]}\" )\" && pwd )/..\"\n\n# only works on OS X due to silly sed incompatibility\nFOLDER=\"ast$1\"\nPATTERN='s/Py\\([A-Z_]*_H\\( \\*\\/\\)\\{0,1\\}\\)$/'\nPATTERN+=\"Ta$1\"\nPATTERN+='\\1/'\nfind \"$FOLDER\" -type f -name '*.h' | xargs -n 1 sed -i '' \"$PATTERN\"\n"
  },
  {
    "path": "typed_ast/__init__.py",
    "content": "__version__ = \"1.5.5\"\n"
  },
  {
    "path": "typed_ast/ast27.py",
    "content": "# -*- coding: utf-8 -*-\n\"\"\"\n    ast27\n    ~~~\n\n    The `ast27` module helps Python applications to process trees of the Python\n    abstract syntax grammar.  The abstract syntax itself might change with\n    each Python release; this module helps to find out programmatically what\n    the current grammar looks like and allows modifications of it.  The `ast27`\n    module is similar to the builtin `ast` module on Python 2.7, except `ast27`\n    runs on Python 3 and provides PEP 484 type comments as part of the AST.\n\n    Specifically, these changes are made to the Python 2.7 AST:\n    - The `FunctionDef`, `Assign`, `For`, and `With` classes all have a\n      `type_comment` field which contains a `str` with the text of the\n      associated type comment, if any.\n    - `arguments` has a `type_comments` list of per-argument type comments.\n    - `parse` has been augmented so it can parse function signature types when\n      called with `mode=func_type`.\n    - `Module` has a `type_ignores` field which contains a list of\n      lines which have been `# type: ignore`d.\n    - `Str` has a `kind` string field which preserves the original string\n      prefix, so that `ast27.parse('br\"test\"').body[0].value.kind == 'br'`.\n\n    An abstract syntax tree can be generated by using the `parse()`\n    function from this module.  The result will be a tree of objects whose\n    classes all inherit from `ast27.AST`.\n\n    A modified abstract syntax tree can be compiled into a Python code object\n    using the built-in `compile()` function.\n\n    Additionally various helper functions are provided that make working with\n    the trees simpler.  The main intention of the helper functions and this\n    module in general is to provide an easy to use interface for libraries\n    that work tightly with the python syntax (template engines for example).\n\n\n    :copyright: Copyright 2008 by Armin Ronacher.\n    :license: Python License.\n\"\"\"\nfrom typed_ast import _ast27\nfrom typed_ast._ast27 import *\n\n\ndef parse(source, filename='<unknown>', mode='exec'):\n    \"\"\"\n    Parse the source into an AST node with type comments.\n    Equivalent to compile(source, filename, mode, PyCF_ONLY_AST).\n    \"\"\"\n    return _ast27.parse(source, filename, mode)\n\n\ndef literal_eval(node_or_string):\n    \"\"\"\n    Safely evaluate an expression node or a string containing a Python\n    expression.  The string or node provided may only consist of the following\n    Python literal structures: strings, numbers, tuples, lists, dicts, booleans,\n    and None.\n    \"\"\"\n    _safe_names = {'None': None, 'True': True, 'False': False}\n    if isinstance(node_or_string, (str, bytes)):\n        node_or_string = parse(node_or_string, mode='eval')\n    if isinstance(node_or_string, Expression):\n        node_or_string = node_or_string.body\n    def _convert(node):\n        if isinstance(node, Str):\n            return node.s\n        elif isinstance(node, Num):\n            return node.n\n        elif isinstance(node, Tuple):\n            return tuple(map(_convert, node.elts))\n        elif isinstance(node, List):\n            return list(map(_convert, node.elts))\n        elif isinstance(node, Dict):\n            return dict((_convert(k), _convert(v)) for k, v\n                        in zip(node.keys, node.values))\n        elif isinstance(node, Name):\n            if node.id in _safe_names:\n                return _safe_names[node.id]\n        elif isinstance(node, BinOp) and \\\n             isinstance(node.op, (Add, Sub)) and \\\n             isinstance(node.right, Num) and \\\n             isinstance(node.right.n, complex) and \\\n             isinstance(node.left, Num) and \\\n             isinstance(node.left.n, (int, long, float)):\n            left = node.left.n\n            right = node.right.n\n            if isinstance(node.op, Add):\n                return left + right\n            else:\n                return left - right\n        raise ValueError('malformed string')\n    return _convert(node_or_string)\n\n\ndef dump(node, annotate_fields=True, include_attributes=False):\n    \"\"\"\n    Return a formatted dump of the tree in *node*.  This is mainly useful for\n    debugging purposes.  The returned string will show the names and the values\n    for fields.  This makes the code impossible to evaluate, so if evaluation is\n    wanted *annotate_fields* must be set to False.  Attributes such as line\n    numbers and column offsets are not dumped by default.  If this is wanted,\n    *include_attributes* can be set to True.\n    \"\"\"\n    def _format(node):\n        if isinstance(node, AST):\n            fields = [(a, _format(b)) for a, b in iter_fields(node)]\n            rv = '%s(%s' % (node.__class__.__name__, ', '.join(\n                ('%s=%s' % field for field in fields)\n                if annotate_fields else\n                (b for a, b in fields)\n            ))\n            if include_attributes and node._attributes:\n                rv += fields and ', ' or ' '\n                rv += ', '.join('%s=%s' % (a, _format(getattr(node, a)))\n                                for a in node._attributes)\n            return rv + ')'\n        elif isinstance(node, list):\n            return '[%s]' % ', '.join(_format(x) for x in node)\n        return repr(node)\n    if not isinstance(node, AST):\n        raise TypeError('expected AST, got %r' % node.__class__.__name__)\n    return _format(node)\n\n\ndef copy_location(new_node, old_node):\n    \"\"\"\n    Copy source location (`lineno` and `col_offset` attributes) from\n    *old_node* to *new_node* if possible, and return *new_node*.\n    \"\"\"\n    for attr in 'lineno', 'col_offset':\n        if attr in old_node._attributes and attr in new_node._attributes \\\n           and hasattr(old_node, attr):\n            setattr(new_node, attr, getattr(old_node, attr))\n    return new_node\n\n\ndef fix_missing_locations(node):\n    \"\"\"\n    When you compile a node tree with compile(), the compiler expects lineno and\n    col_offset attributes for every node that supports them.  This is rather\n    tedious to fill in for generated nodes, so this helper adds these attributes\n    recursively where not already set, by setting them to the values of the\n    parent node.  It works recursively starting at *node*.\n    \"\"\"\n    def _fix(node, lineno, col_offset):\n        if 'lineno' in node._attributes:\n            if not hasattr(node, 'lineno'):\n                node.lineno = lineno\n            else:\n                lineno = node.lineno\n        if 'col_offset' in node._attributes:\n            if not hasattr(node, 'col_offset'):\n                node.col_offset = col_offset\n            else:\n                col_offset = node.col_offset\n        for child in iter_child_nodes(node):\n            _fix(child, lineno, col_offset)\n    _fix(node, 1, 0)\n    return node\n\n\ndef increment_lineno(node, n=1):\n    \"\"\"\n    Increment the line number of each node in the tree starting at *node* by *n*.\n    This is useful to \"move code\" to a different location in a file.\n    \"\"\"\n    for child in walk(node):\n        if 'lineno' in child._attributes:\n            child.lineno = getattr(child, 'lineno', 0) + n\n    return node\n\n\ndef iter_fields(node):\n    \"\"\"\n    Yield a tuple of ``(fieldname, value)`` for each field in ``node._fields``\n    that is present on *node*.\n    \"\"\"\n    for field in node._fields:\n        try:\n            yield field, getattr(node, field)\n        except AttributeError:\n            pass\n\n\ndef iter_child_nodes(node):\n    \"\"\"\n    Yield all direct child nodes of *node*, that is, all fields that are nodes\n    and all items of fields that are lists of nodes.\n    \"\"\"\n    for name, field in iter_fields(node):\n        if isinstance(field, AST):\n            yield field\n        elif isinstance(field, list):\n            for item in field:\n                if isinstance(item, AST):\n                    yield item\n\n\ndef get_docstring(node, clean=True):\n    \"\"\"\n    Return the docstring for the given node or None if no docstring can\n    be found.  If the node provided does not have docstrings a TypeError\n    will be raised.\n    \"\"\"\n    if not isinstance(node, (FunctionDef, ClassDef, Module)):\n        raise TypeError(\"%r can't have docstrings\" % node.__class__.__name__)\n    if node.body and isinstance(node.body[0], Expr) and \\\n       isinstance(node.body[0].value, Str):\n        if clean:\n            import inspect\n            return inspect.cleandoc(node.body[0].value.s)\n        return node.body[0].value.s\n\n\ndef walk(node):\n    \"\"\"\n    Recursively yield all descendant nodes in the tree starting at *node*\n    (including *node* itself), in no specified order.  This is useful if you\n    only want to modify nodes in place and don't care about the context.\n    \"\"\"\n    from collections import deque\n    todo = deque([node])\n    while todo:\n        node = todo.popleft()\n        todo.extend(iter_child_nodes(node))\n        yield node\n\n\nclass NodeVisitor(object):\n    \"\"\"\n    A node visitor base class that walks the abstract syntax tree and calls a\n    visitor function for every node found.  This function may return a value\n    which is forwarded by the `visit` method.\n\n    This class is meant to be subclassed, with the subclass adding visitor\n    methods.\n\n    Per default the visitor functions for the nodes are ``'visit_'`` +\n    class name of the node.  So a `TryFinally` node visit function would\n    be `visit_TryFinally`.  This behavior can be changed by overriding\n    the `visit` method.  If no visitor function exists for a node\n    (return value `None`) the `generic_visit` visitor is used instead.\n\n    Don't use the `NodeVisitor` if you want to apply changes to nodes during\n    traversing.  For this a special visitor exists (`NodeTransformer`) that\n    allows modifications.\n    \"\"\"\n\n    def visit(self, node):\n        \"\"\"Visit a node.\"\"\"\n        method = 'visit_' + node.__class__.__name__\n        visitor = getattr(self, method, self.generic_visit)\n        return visitor(node)\n\n    def generic_visit(self, node):\n        \"\"\"Called if no explicit visitor function exists for a node.\"\"\"\n        for field, value in iter_fields(node):\n            if isinstance(value, list):\n                for item in value:\n                    if isinstance(item, AST):\n                        self.visit(item)\n            elif isinstance(value, AST):\n                self.visit(value)\n\n\nclass NodeTransformer(NodeVisitor):\n    \"\"\"\n    A :class:`NodeVisitor` subclass that walks the abstract syntax tree and\n    allows modification of nodes.\n\n    The `NodeTransformer` will walk the AST and use the return value of the\n    visitor methods to replace or remove the old node.  If the return value of\n    the visitor method is ``None``, the node will be removed from its location,\n    otherwise it is replaced with the return value.  The return value may be the\n    original node in which case no replacement takes place.\n\n    Here is an example transformer that rewrites all occurrences of name lookups\n    (``foo``) to ``data['foo']``::\n\n       class RewriteName(NodeTransformer):\n\n           def visit_Name(self, node):\n               return copy_location(Subscript(\n                   value=Name(id='data', ctx=Load()),\n                   slice=Index(value=Str(s=node.id, kind='')),\n                   ctx=node.ctx\n               ), node)\n\n    Keep in mind that if the node you're operating on has child nodes you must\n    either transform the child nodes yourself or call the :meth:`generic_visit`\n    method for the node first.\n\n    For nodes that were part of a collection of statements (that applies to all\n    statement nodes), the visitor may also return a list of nodes rather than\n    just a single node.\n\n    Usually you use the transformer like this::\n\n       node = YourTransformer().visit(node)\n    \"\"\"\n\n    def generic_visit(self, node):\n        for field, old_value in iter_fields(node):\n            old_value = getattr(node, field, None)\n            if isinstance(old_value, list):\n                new_values = []\n                for value in old_value:\n                    if isinstance(value, AST):\n                        value = self.visit(value)\n                        if value is None:\n                            continue\n                        elif not isinstance(value, AST):\n                            new_values.extend(value)\n                            continue\n                    new_values.append(value)\n                old_value[:] = new_values\n            elif isinstance(old_value, AST):\n                new_node = self.visit(old_value)\n                if new_node is None:\n                    delattr(node, field)\n                else:\n                    setattr(node, field, new_node)\n        return node\n"
  },
  {
    "path": "typed_ast/ast3.py",
    "content": "\"\"\"\n    typed_ast.ast3\n    ~~~\n\n    The `ast3` module helps Python applications to process trees of the Python\n    abstract syntax grammar.  The abstract syntax itself might change with\n    each Python release; this module helps to find out programmatically what\n    the current grammar looks like and allows modifications of it.  The\n    difference between the `ast3` module and the builtin `ast` module is\n    that `ast3` is version-independent and provides PEP 484 type comments as\n    part of the AST.\n\n    Specifically, these changes are made to the latest Python 3 AST:\n    - The `FunctionDef`, `AsyncFunctionDef`, `Assign`, `For`, `AsyncFor`,\n      `With`, `AsyncWith`, and `arg` classes all have a `type_comment` field\n      which contains a `str` with the text of the associated type comment, if\n      any.\n    - `parse` has been augmented so it can parse function signature types when\n      called with `mode=func_type`.\n    - `parse` has an additional argument `feature_version`, which disables\n      newer Python syntax features.\n    - `Module` has a `type_ignores` field which contains a list of\n      lines which have been `# type: ignore`d.\n    - `Str` has a `kind` string field which preserves the original string\n      prefix, so that `ast3.parse('u\"test\"').body[0].value.kind == 'u'`.\n\n    An abstract syntax tree can be generated by using the `parse()`\n    function from this module.  The result will be a tree of objects whose\n    classes all inherit from `ast3.AST`.\n\n    Additionally various helper functions are provided that make working with\n    the trees simpler.  The main intention of the helper functions and this\n    module in general is to provide an easy to use interface for libraries\n    that work tightly with the python syntax (template engines for example).\n\n\n    :copyright: Copyright 2008 by Armin Ronacher.\n    :license: Python License.\n\"\"\"\nfrom typed_ast import _ast3\nfrom typed_ast._ast3 import *\n\nLATEST_MINOR_VERSION = 7\n\ndef parse(source, filename='<unknown>', mode='exec', feature_version=LATEST_MINOR_VERSION):\n    \"\"\"\n    Parse the source into an AST node including type comments.\n    Similar to compile(source, filename, mode, PyCF_ONLY_AST).\n\n    Set feature_version to limit the syntax parsed to that minor version of\n    Python 3.  For example, feature_version=5 will prevent new syntax features\n    from Python 3.6+ from being used, such as fstrings.  Currently only\n    fully supported for Python 3.5+ with partial support for Python 3.4.\n    So, feature_version=3 or less are all equivalent to feature_version=4.\n\n    When feature_version=4, the parser will forbid the use of the async/await\n    keywords and the '@' operator, but will not forbid the use of PEP 448\n    additional unpacking generalizations, which were also added in Python 3.5.\n\n    When feature_version>=7, 'async' and 'await' are always keywords.\n    \"\"\"\n    return _ast3._parse(source, filename, mode, feature_version)\n\n_NUM_TYPES = (int, float, complex)\n\ndef literal_eval(node_or_string):\n    \"\"\"\n    Safely evaluate an expression node or a string containing a Python\n    expression.  The string or node provided may only consist of the following\n    Python literal structures: strings, bytes, numbers, tuples, lists, dicts,\n    sets, booleans, and None.\n    \"\"\"\n    if isinstance(node_or_string, str):\n        node_or_string = parse(node_or_string, mode='eval')\n    if isinstance(node_or_string, Expression):\n        node_or_string = node_or_string.body\n    def _convert(node):\n        if isinstance(node, Constant):\n            return node.value\n        elif isinstance(node, (Str, Bytes)):\n            return node.s\n        elif isinstance(node, Num):\n            return node.n\n        elif isinstance(node, Tuple):\n            return tuple(map(_convert, node.elts))\n        elif isinstance(node, List):\n            return list(map(_convert, node.elts))\n        elif isinstance(node, Set):\n            return set(map(_convert, node.elts))\n        elif isinstance(node, Dict):\n            return dict((_convert(k), _convert(v)) for k, v\n                        in zip(node.keys, node.values))\n        elif isinstance(node, NameConstant):\n            return node.value\n        elif isinstance(node, UnaryOp) and isinstance(node.op, (UAdd, USub)):\n            operand = _convert(node.operand)\n            if isinstance(operand, _NUM_TYPES):\n                if isinstance(node.op, UAdd):\n                    return + operand\n                else:\n                    return - operand\n        elif isinstance(node, BinOp) and isinstance(node.op, (Add, Sub)):\n            left = _convert(node.left)\n            right = _convert(node.right)\n            if isinstance(left, _NUM_TYPES) and isinstance(right, _NUM_TYPES):\n                if isinstance(node.op, Add):\n                    return left + right\n                else:\n                    return left - right\n        raise ValueError('malformed node or string: ' + repr(node))\n    return _convert(node_or_string)\n\n\ndef dump(node, annotate_fields=True, include_attributes=False):\n    \"\"\"\n    Return a formatted dump of the tree in *node*.  This is mainly useful for\n    debugging purposes.  The returned string will show the names and the values\n    for fields.  This makes the code impossible to evaluate, so if evaluation is\n    wanted *annotate_fields* must be set to False.  Attributes such as line\n    numbers and column offsets are not dumped by default.  If this is wanted,\n    *include_attributes* can be set to True.\n    \"\"\"\n    def _format(node):\n        if isinstance(node, AST):\n            fields = [(a, _format(b)) for a, b in iter_fields(node)]\n            rv = '%s(%s' % (node.__class__.__name__, ', '.join(\n                ('%s=%s' % field for field in fields)\n                if annotate_fields else\n                (b for a, b in fields)\n            ))\n            if include_attributes and node._attributes:\n                rv += fields and ', ' or ' '\n                rv += ', '.join('%s=%s' % (a, _format(getattr(node, a)))\n                                for a in node._attributes)\n            return rv + ')'\n        elif isinstance(node, list):\n            return '[%s]' % ', '.join(_format(x) for x in node)\n        return repr(node)\n    if not isinstance(node, AST):\n        raise TypeError('expected AST, got %r' % node.__class__.__name__)\n    return _format(node)\n\n\ndef copy_location(new_node, old_node):\n    \"\"\"\n    Copy source location (`lineno` and `col_offset` attributes) from\n    *old_node* to *new_node* if possible, and return *new_node*.\n    \"\"\"\n    for attr in 'lineno', 'col_offset':\n        if attr in old_node._attributes and attr in new_node._attributes \\\n           and hasattr(old_node, attr):\n            setattr(new_node, attr, getattr(old_node, attr))\n    return new_node\n\n\ndef fix_missing_locations(node):\n    \"\"\"\n    When you compile a node tree with compile(), the compiler expects lineno and\n    col_offset attributes for every node that supports them.  This is rather\n    tedious to fill in for generated nodes, so this helper adds these attributes\n    recursively where not already set, by setting them to the values of the\n    parent node.  It works recursively starting at *node*.\n    \"\"\"\n    def _fix(node, lineno, col_offset):\n        if 'lineno' in node._attributes:\n            if not hasattr(node, 'lineno'):\n                node.lineno = lineno\n            else:\n                lineno = node.lineno\n        if 'col_offset' in node._attributes:\n            if not hasattr(node, 'col_offset'):\n                node.col_offset = col_offset\n            else:\n                col_offset = node.col_offset\n        for child in iter_child_nodes(node):\n            _fix(child, lineno, col_offset)\n    _fix(node, 1, 0)\n    return node\n\n\ndef increment_lineno(node, n=1):\n    \"\"\"\n    Increment the line number of each node in the tree starting at *node* by *n*.\n    This is useful to \"move code\" to a different location in a file.\n    \"\"\"\n    for child in walk(node):\n        if 'lineno' in child._attributes:\n            child.lineno = getattr(child, 'lineno', 0) + n\n    return node\n\n\ndef iter_fields(node):\n    \"\"\"\n    Yield a tuple of ``(fieldname, value)`` for each field in ``node._fields``\n    that is present on *node*.\n    \"\"\"\n    for field in node._fields:\n        try:\n            yield field, getattr(node, field)\n        except AttributeError:\n            pass\n\n\ndef iter_child_nodes(node):\n    \"\"\"\n    Yield all direct child nodes of *node*, that is, all fields that are nodes\n    and all items of fields that are lists of nodes.\n    \"\"\"\n    for name, field in iter_fields(node):\n        if isinstance(field, AST):\n            yield field\n        elif isinstance(field, list):\n            for item in field:\n                if isinstance(item, AST):\n                    yield item\n\n\ndef get_docstring(node, clean=True):\n    \"\"\"\n    Return the docstring for the given node or None if no docstring can\n    be found.  If the node provided does not have docstrings a TypeError\n    will be raised.\n    \"\"\"\n    if not isinstance(node, (AsyncFunctionDef, FunctionDef, ClassDef, Module)):\n        raise TypeError(\"%r can't have docstrings\" % node.__class__.__name__)\n    if not(node.body and isinstance(node.body[0], Expr)):\n        return\n    node = node.body[0].value\n    if isinstance(node, Str):\n        text = node.s\n    elif isinstance(node, Constant) and isinstance(node.value, str):\n        text = node.value\n    else:\n        return\n    if clean:\n        import inspect\n        text = inspect.cleandoc(text)\n    return text\n\n\ndef walk(node):\n    \"\"\"\n    Recursively yield all descendant nodes in the tree starting at *node*\n    (including *node* itself), in no specified order.  This is useful if you\n    only want to modify nodes in place and don't care about the context.\n    \"\"\"\n    from collections import deque\n    todo = deque([node])\n    while todo:\n        node = todo.popleft()\n        todo.extend(iter_child_nodes(node))\n        yield node\n\n\nclass NodeVisitor(object):\n    \"\"\"\n    A node visitor base class that walks the abstract syntax tree and calls a\n    visitor function for every node found.  This function may return a value\n    which is forwarded by the `visit` method.\n\n    This class is meant to be subclassed, with the subclass adding visitor\n    methods.\n\n    Per default the visitor functions for the nodes are ``'visit_'`` +\n    class name of the node.  So a `TryFinally` node visit function would\n    be `visit_TryFinally`.  This behavior can be changed by overriding\n    the `visit` method.  If no visitor function exists for a node\n    (return value `None`) the `generic_visit` visitor is used instead.\n\n    Don't use the `NodeVisitor` if you want to apply changes to nodes during\n    traversing.  For this a special visitor exists (`NodeTransformer`) that\n    allows modifications.\n    \"\"\"\n\n    def visit(self, node):\n        \"\"\"Visit a node.\"\"\"\n        method = 'visit_' + node.__class__.__name__\n        visitor = getattr(self, method, self.generic_visit)\n        return visitor(node)\n\n    def generic_visit(self, node):\n        \"\"\"Called if no explicit visitor function exists for a node.\"\"\"\n        for field, value in iter_fields(node):\n            if isinstance(value, list):\n                for item in value:\n                    if isinstance(item, AST):\n                        self.visit(item)\n            elif isinstance(value, AST):\n                self.visit(value)\n\n\nclass NodeTransformer(NodeVisitor):\n    \"\"\"\n    A :class:`NodeVisitor` subclass that walks the abstract syntax tree and\n    allows modification of nodes.\n\n    The `NodeTransformer` will walk the AST and use the return value of the\n    visitor methods to replace or remove the old node.  If the return value of\n    the visitor method is ``None``, the node will be removed from its location,\n    otherwise it is replaced with the return value.  The return value may be the\n    original node in which case no replacement takes place.\n\n    Here is an example transformer that rewrites all occurrences of name lookups\n    (``foo``) to ``data['foo']``::\n\n       class RewriteName(NodeTransformer):\n\n           def visit_Name(self, node):\n               return copy_location(Subscript(\n                   value=Name(id='data', ctx=Load()),\n                   slice=Index(value=Str(s=node.id, kind='')),\n                   ctx=node.ctx\n               ), node)\n\n    Keep in mind that if the node you're operating on has child nodes you must\n    either transform the child nodes yourself or call the :meth:`generic_visit`\n    method for the node first.\n\n    For nodes that were part of a collection of statements (that applies to all\n    statement nodes), the visitor may also return a list of nodes rather than\n    just a single node.\n\n    Usually you use the transformer like this::\n\n       node = YourTransformer().visit(node)\n    \"\"\"\n\n    def generic_visit(self, node):\n        for field, old_value in iter_fields(node):\n            if isinstance(old_value, list):\n                new_values = []\n                for value in old_value:\n                    if isinstance(value, AST):\n                        value = self.visit(value)\n                        if value is None:\n                            continue\n                        elif not isinstance(value, AST):\n                            new_values.extend(value)\n                            continue\n                    new_values.append(value)\n                old_value[:] = new_values\n            elif isinstance(old_value, AST):\n                new_node = self.visit(old_value)\n                if new_node is None:\n                    delattr(node, field)\n                else:\n                    setattr(node, field, new_node)\n        return node\n"
  },
  {
    "path": "typed_ast/conversions.py",
    "content": "from typed_ast import ast27\nfrom typed_ast import ast3\n\ndef py2to3(ast):\n    \"\"\"Converts a typed Python 2.7 ast to a typed Python 3.5 ast.  The returned\n        ast is a valid Python 3 ast with two exceptions:\n\n        - `arg` objects may contain Tuple objects instead of just identifiers\n           in the case of Python 2 function definitions/lambdas that use the tuple\n           unpacking syntax.\n        - `Raise` objects will have a `traceback` attribute added if the 3\n           argument version of the Python 2 raise is used.\n\n\n    Strange and Rare Uncovered Edge Cases:\n        - Raise: if the second argument to a raise statement is a tuple, its\n          contents are unpacked as arguments to the exception constructor.  This\n          case is handled correctly if it's a literal tuple, but not if it's any\n          other sort of tuple expression.\n    \"\"\"\n    return _AST2To3().visit(ast)\n\ndef _copy_attributes(new_value, old_value):\n    attrs = getattr(old_value, '_attributes', None)\n    if attrs is not None:\n        for attr in attrs:\n            setattr(new_value, attr, getattr(old_value, attr))\n    return new_value\n\nclass _AST2To3(ast27.NodeTransformer):\n    # note: None, True, and False are *not* translated into NameConstants.\n    def __init__(self):\n        pass\n\n    def visit(self, node):\n        \"\"\"Visit a node.\"\"\"\n        method = 'visit_' + node.__class__.__name__\n        visitor = getattr(self, method, self.generic_visit)\n        ret = _copy_attributes(visitor(node), node)\n        return ret\n\n    def maybe_visit(self, node):\n        if node is not None:\n            return self.visit(node)\n        else:\n            return None\n\n    def generic_visit(self, node):\n        class_name = node.__class__.__name__\n        converted_class = getattr(ast3, class_name)\n        new_node = converted_class()\n        for field, old_value in ast27.iter_fields(node):\n            if isinstance(old_value, (ast27.AST, list)):\n                setattr(new_node, field, self.visit(old_value))\n            else:\n                setattr(new_node, field, old_value)\n        return new_node\n\n\n    def visit_list(self, l):\n        return [self.visit(e) if isinstance(e, (ast27.AST, list)) else e for e in l]\n\n    def visit_FunctionDef(self, n):\n        new = self.generic_visit(n)\n        new.returns = None\n        return new\n\n    def visit_ClassDef(self, n):\n        new = self.generic_visit(n)\n        new.keywords = []\n        return new\n\n    def visit_TryExcept(self, n):\n        return ast3.Try(self.visit(n.body),\n                        self.visit(n.handlers),\n                        self.visit(n.orelse),\n                        [])\n\n    def visit_TryFinally(self, n):\n        if len(n.body) == 1 and isinstance(n.body[0], ast27.TryExcept):\n            new = self.visit(n.body[0])\n            new.finalbody = self.visit(n.finalbody)\n            return new\n        else:\n            return ast3.Try(self.visit(n.body),\n                            [],\n                            [],\n                            self.visit(n.finalbody))\n\n\n    def visit_ExceptHandler(self, n):\n        if n.name is None:\n            name = None\n        elif isinstance(n.name, ast27.Name):\n            name = n.name.id\n        else:\n            raise RuntimeError(\"'{}' has non-Name name.\".format(ast27.dump(n)))\n\n        return ast3.ExceptHandler(self.maybe_visit(n.type),\n                                  name,\n                                  self.visit(n.body))\n\n    def visit_Print(self, n):\n        keywords = []\n        if n.dest is not None:\n            keywords.append(ast3.keyword(\"file\", self.visit(n.dest)))\n\n        if not n.nl:\n            keywords.append(ast3.keyword(\"end\",\n                                         ast3.Str(s=\" \", kind='', lineno=n.lineno, col_offset=-1)))\n\n        return ast3.Expr(ast3.Call(ast3.Name(\"print\", ast3.Load(), lineno=n.lineno, col_offset=-1),\n                                   self.visit(n.values),\n                                   keywords,\n                                   lineno=n.lineno, col_offset=-1))\n\n    def visit_Raise(self, n):\n        e = None\n        if n.type is not None:\n            e = self.visit(n.type)\n\n            if n.inst is not None and not (isinstance(n.inst, ast27.Name) and n.inst.id == \"None\"):\n                inst = self.visit(n.inst)\n                if isinstance(inst, ast3.Tuple):\n                    args = inst.elts\n                else:\n                    args = [inst]\n                e = ast3.Call(e, args, [], lineno=e.lineno, col_offset=-1)\n\n        ret = ast3.Raise(e, None)\n        if n.tback is not None:\n            ret.traceback = self.visit(n.tback)\n        return ret\n\n    def visit_Exec(self, n):\n        new_globals = self.maybe_visit(n.globals)\n        if new_globals is None:\n            new_globals = ast3.Name(\"None\", ast3.Load(), lineno=-1, col_offset=-1)\n        new_locals = self.maybe_visit(n.locals)\n        if new_locals is None:\n            new_locals = ast3.Name(\"None\", ast3.Load(), lineno=-1, col_offset=-1)\n\n        return ast3.Expr(ast3.Call(ast3.Name(\"exec\", ast3.Load(), lineno=n.lineno, col_offset=-1),\n                                   [self.visit(n.body), new_globals, new_locals],\n                                   [],\n                                   lineno=n.lineno, col_offset=-1))\n\n    # TODO(ddfisher): the name repr could be used locally as something else; disambiguate\n    def visit_Repr(self, n):\n        return ast3.Call(ast3.Name(\"repr\", ast3.Load(), lineno=n.lineno, col_offset=-1),\n                         [self.visit(n.value)],\n                         [])\n\n    # TODO(ddfisher): this will cause strange behavior on multi-item with statements with type comments\n    def visit_With(self, n):\n        return ast3.With([ast3.withitem(self.visit(n.context_expr), self.maybe_visit(n.optional_vars))],\n                          self.visit(n.body),\n                          n.type_comment)\n\n    def visit_Call(self, n):\n        args = self.visit(n.args)\n        if n.starargs is not None:\n            args.append(ast3.Starred(self.visit(n.starargs), ast3.Load(), lineno=n.starargs.lineno, col_offset=n.starargs.col_offset))\n\n        keywords = self.visit(n.keywords)\n        if n.kwargs is not None:\n            keywords.append(ast3.keyword(None, self.visit(n.kwargs)))\n\n        return ast3.Call(self.visit(n.func),\n                         args,\n                         keywords)\n\n    # TODO(ddfisher): find better attributes to give Ellipses\n    def visit_Ellipsis(self, n):\n        # ellipses in Python 2 only exist as a slice index\n        return ast3.Index(ast3.Ellipsis(lineno=-1, col_offset=-1))\n\n    def visit_arguments(self, n):\n        def convert_arg(arg, type_comment):\n            if isinstance(arg, ast27.Name):\n                v = arg.id\n            elif isinstance(arg, ast27.Tuple):\n                v = self.visit(arg)\n            else:\n                raise RuntimeError(\"'{}' is not a valid argument.\".format(ast27.dump(arg)))\n            return ast3.arg(v, None, type_comment, lineno=arg.lineno, col_offset=arg.col_offset)\n\n        def get_type_comment(i):\n            if i < len(n.type_comments) and n.type_comments[i] is not None:\n                return n.type_comments[i]\n            return None\n\n        args = [convert_arg(arg, get_type_comment(i)) for i, arg in enumerate(n.args)]\n\n        vararg = None\n        if n.vararg is not None:\n            vararg = ast3.arg(n.vararg,\n                              None,\n                              get_type_comment(len(args)),\n                              lineno=-1, col_offset=-1)\n\n        kwarg = None\n        if n.kwarg is not None:\n            kwarg = ast3.arg(n.kwarg,\n                             None,\n                             get_type_comment(len(args) + (0 if n.vararg is None else 1)),\n                             lineno=-1, col_offset=-1)\n\n        defaults = self.visit(n.defaults)\n\n        return ast3.arguments(args,\n                              vararg,\n                              [],\n                              [],\n                              kwarg,\n                              defaults)\n\n    def visit_Str(self, s):\n        if isinstance(s.s, bytes):\n            return ast3.Bytes(s.s, s.kind)\n        else:\n            return ast3.Str(s.s, s.kind)\n\n    def visit_Num(self, n):\n        new = self.generic_visit(n)\n        if new.n < 0:\n            # Python 3 uses a unary - operator for negative literals.\n            new.n = -new.n\n            return ast3.UnaryOp(op=ast3.USub(),\n                                operand=_copy_attributes(new, n))\n        else:\n            return new\n"
  }
]