{ "info": { "author": "Eliott Dumeix", "author_email": "eliott.dumeix@gmail.com", "bugtrack_url": null, "classifiers": [ "Intended Audience :: Developers", "Operating System :: OS Independent", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "py-lua-parser\n===============================================================================\n\n.. image:: https://travis-ci.org/boolangery/py-lua-parser.svg?branch=master\n :target: https://travis-ci.org/boolangery/py-lua-parser\n.. image:: https://img.shields.io/pypi/v/luaparser.svg\n :target: https://pypi.python.org/pypi/luaparser/\n.. image:: https://img.shields.io/pypi/pyversions/luaparser.svg\n :target: https://pypi.python.org/pypi/luaparser/\n\nA Lua parser and AST builder written in Python.\n\nIt's both a development library and a command line tool.\n\n\nInstallation:\n------------------------------------------------------------------------------\n\nThe package can be installed through `pip`:\n\n.. code-block::\n\n $ python3.6 -m pip install luaparser\n\nIt will install the shell command 'luaparser'.\n\n\nOptions\n------------------------------------------------------------------------------\n\nThese are the command-line flags:\n\nUsage: luaparser [options] filename\n\n.. code-block::\n\n CLI Options:\n --version Show program's version number and exit\n -h, --help Show this help message and exit\n -s, --source Source passed in a string\n -x, --xml Set output format to xml\n -o, --output Write output to file\n\n\nQuickstart\n==============================================================================\n\nWorking on AST tree\n------------------------------------------------------------------------------\n\nMinimal exemple:\n\n.. code-block:: python\n\n from luaparser import ast\n\n src = \"\"\"\n local function sayHello()\n print('hello world !')\n end\n sayHello()\n \"\"\"\n\n tree = ast.parse(src)\n print(ast.to_pretty_str(tree))\n\nwill display:\n\n.. code-block::\n\n Chunk: {} 1 key\n body: {} 1 key\n Block: {} 1 key\n body: [] 2 items\n 0: {} 1 key\n LocalFunction: {} 3 keys\n name: {} 1 key\n Name: {} 1 key\n id: \"sayHello\"\n args: [] 0 item\n body: [] 1 item\n 0: {} 1 key\n Call: {} 2 keys\n func: {} 1 key\n Name: {} 1 key\n id: \"print\"\n args: [] 1 item\n 0: {} 1 key\n String: {} 1 key\n s: \"hello world !\"\n 1: {} 1 key\n Call: {} 2 keys\n func: {} 1 key\n Name: {} 1 key\n id: \"sayHello\"\n args: [] 0 item\n\n\nYou can run through the list of all the nodes in the tree using ast.walk(tree):\n\n.. code-block:: python\n\n from luaparser import ast\n from luaparser import astnodes\n\n tree = ast.parse(\"local foo = 'bar'\")\n\n for node in ast.walk(tree):\n if isinstance(node, astnodes.Name):\n process(node)\n\n\nAlternatively, you can use a node visitor:\n\n.. code-block:: python\n\n from luaparser import ast\n from luaparser import astnodes\n\n src = \"local a = 42\"\n\n class NumberVisitor(ast.ASTVisitor):\n def visit_Number(self, node):\n print('Number value = ' + str(node.n))\n\n tree = ast.parse(src)\n NumberVisitor().visit(tree)\n\n\nCommand line\n==============================================================================\n\nGiven:\n\n.. code-block:: lua\n\n local function log(msg)\n print(msg)\n end\n\n log(\"hello world !\")\n\n\n.. code-block:: bash\n\n $ luaparser source.lua\n\n\nWill output:\n\n.. code-block:: json\n\n {\n \"Chunk\": {\n \"body\": {\n \"Block\": {\n \"body\": [\n {\n \"LocalFunction\": {\n \"name\": {\n \"Name\": {\n \"id\": \"log\"\n }\n },\n \"args\": [\n {\n \"Name\": {\n \"id\": \"msg\"\n }\n }\n ],\n \"body\": {\n \"Block\": {\n \"body\": [\n {\n \"Call\": {\n \"func\": {\n \"Name\": {\n \"id\": \"print\"\n }\n },\n \"args\": [\n {\n \"Name\": {\n \"id\": \"msg\"\n }\n }\n ]\n }\n }\n ]\n }\n }\n }\n },\n {\n \"Call\": {\n \"func\": {\n \"Name\": {\n \"id\": \"log\"\n }\n },\n \"args\": [\n {\n \"String\": {\n \"s\": \"hello world !\"\n }\n }\n ]\n }\n }\n ]\n }\n }\n }\n }\n", "description_content_type": "", "docs_url": null, "download_url": "https://github.com/boolangery/py-lua-parser/archive/2.2.0.tar.gz", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/boolangery/py-lua-parser", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "luaparser", "package_url": "https://pypi.org/project/luaparser/", "platform": "", "project_url": "https://pypi.org/project/luaparser/", "project_urls": { "Download": "https://github.com/boolangery/py-lua-parser/archive/2.2.0.tar.gz", "Homepage": "https://github.com/boolangery/py-lua-parser" }, "release_url": "https://pypi.org/project/luaparser/2.2.0/", "requires_dist": null, "requires_python": "", "summary": "A lua parser in Python", "version": "2.2.0" }, "last_serial": 5930188, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "2df04d6582d989a666a5028dce7e87a6", "sha256": "8c0282d8706e0b23afeeb49158ffd295abb4d5e02b3d3ae0ac43c2f22db77ff1" }, "downloads": -1, "filename": "luaparser-0.1.tar.gz", "has_sig": false, "md5_digest": "2df04d6582d989a666a5028dce7e87a6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 36383, "upload_time": "2018-01-07T21:19:11", "url": "https://files.pythonhosted.org/packages/fc/fb/4b8a45f2c1090d7e66ad0373b06b9e7f9172e65deddf941f3a260a3ef3dd/luaparser-0.1.tar.gz" } ], "1.0": [ { "comment_text": "", "digests": { "md5": "40da9661dc48ce2ad9e9cb0ac74b76d2", "sha256": "66999a4967dd7bc9675a3133d3b5b05ad9bddf511cc1e300d8196446641032c4" }, "downloads": -1, "filename": "luaparser-1.0.tar.gz", "has_sig": false, "md5_digest": "40da9661dc48ce2ad9e9cb0ac74b76d2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 47373, "upload_time": "2018-02-04T20:57:58", "url": "https://files.pythonhosted.org/packages/86/5e/d724ee0b0dfddcc4b8b443abe20190f821d1336a53136e9836491dd1becd/luaparser-1.0.tar.gz" } ], "1.1": [ { "comment_text": "", "digests": { "md5": "89dc1ce9a678c213a6ddbdf070a3b275", "sha256": "8249fcb4b47387d93ce1cd42325a3b9be57b58fe680274e0e06385de0ea68570" }, "downloads": -1, "filename": "luaparser-1.1.tar.gz", "has_sig": false, "md5_digest": "89dc1ce9a678c213a6ddbdf070a3b275", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 47537, "upload_time": "2018-02-06T20:27:06", "url": "https://files.pythonhosted.org/packages/fa/20/a2a5458313211829fea551caec22179fef13189fd7bda2a5e575222f46ca/luaparser-1.1.tar.gz" } ], "1.1.1": [ { "comment_text": "", "digests": { "md5": "75d0439d62ebb43f0081014b05fbde24", "sha256": "235664b1bcf8777a4016409efdb9f12d905aa3b96f50228e3c0e7f49c105476b" }, "downloads": -1, "filename": "luaparser-1.1.1.tar.gz", "has_sig": false, "md5_digest": "75d0439d62ebb43f0081014b05fbde24", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 47609, "upload_time": "2018-02-06T21:16:24", "url": "https://files.pythonhosted.org/packages/70/7d/48e4e62adb92f9d9e714c16d60352da464befb7cf9f01332d3d32f93d16c/luaparser-1.1.1.tar.gz" } ], "1.1.2": [ { "comment_text": "", "digests": { "md5": "a9eff940a74a0587f63cdba9eafd8430", "sha256": "4591f449271e6d704d9b280bba780e511e2e45daf5361124b3b7cf1b1c1ddbef" }, "downloads": -1, "filename": "luaparser-1.1.2.tar.gz", "has_sig": false, "md5_digest": "a9eff940a74a0587f63cdba9eafd8430", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 47682, "upload_time": "2018-02-08T19:48:20", "url": "https://files.pythonhosted.org/packages/35/4a/e789bea9825d6b9c64631bd23fc505d77a208eb9382e4b3f7b1d56ab2fac/luaparser-1.1.2.tar.gz" } ], "1.1.3": [ { "comment_text": "", "digests": { "md5": "22fcc9909eacd40c67a74f853e9af5c0", "sha256": "c553119a6136f568426f4277473c4a988f49937bf8328106431003cc421c96d5" }, "downloads": -1, "filename": "luaparser-1.1.3.tar.gz", "has_sig": false, "md5_digest": "22fcc9909eacd40c67a74f853e9af5c0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 47536, "upload_time": "2018-02-10T22:03:16", "url": "https://files.pythonhosted.org/packages/7d/d1/c046d4eb74bf810f47a03e62dface77decb0b34672f2a6634f4c9bc57e69/luaparser-1.1.3.tar.gz" } ], "1.1.4": [ { "comment_text": "", "digests": { "md5": "19bae742971a893c478f2a62dbe441c2", "sha256": "7c19113f9358f0bcd3d69215fb30640d7df65bee345358e9ba349d1ff3195a9d" }, "downloads": -1, "filename": "luaparser-1.1.4.tar.gz", "has_sig": false, "md5_digest": "19bae742971a893c478f2a62dbe441c2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 47491, "upload_time": "2018-02-11T17:35:44", "url": "https://files.pythonhosted.org/packages/7b/e9/b5ecc114d43b11262a29ba79ae3369d5739a10f7a40b94547b69f62a3004/luaparser-1.1.4.tar.gz" } ], "1.1.5": [ { "comment_text": "", "digests": { "md5": "008e59cd8e89d938244ac8c2a6f1763a", "sha256": "8552f2aec423fe7ee8b837f1291248d1772912cebcea452aec434db6e9a4fdfb" }, "downloads": -1, "filename": "luaparser-1.1.5.tar.gz", "has_sig": false, "md5_digest": "008e59cd8e89d938244ac8c2a6f1763a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 47565, "upload_time": "2018-02-11T20:35:19", "url": "https://files.pythonhosted.org/packages/34/c8/0036678c3863ae123d693fc8d576a2fccf06880f4aca57219aa2d33f9b65/luaparser-1.1.5.tar.gz" } ], "1.1.6": [ { "comment_text": "", "digests": { "md5": "84c0bf9bf185fb49d3acb6f7c82a18ad", "sha256": "1012d06e7fd2a4dd09748bcc3c0fbf73dff3a3f6d19cdd845cac646a371a84e7" }, "downloads": -1, "filename": "luaparser-1.1.6.tar.gz", "has_sig": false, "md5_digest": "84c0bf9bf185fb49d3acb6f7c82a18ad", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 47891, "upload_time": "2018-02-25T16:45:43", "url": "https://files.pythonhosted.org/packages/7e/53/085b2ed6c2661e5cb3c0447ecb97332743ca4f0546dafe769a146c6677c5/luaparser-1.1.6.tar.gz" } ], "1.2.0": [ { "comment_text": "", "digests": { "md5": "76cfe33b9eba7c162e6551c8c6dde077", "sha256": "1e60d757ba07d31b2b14a83d16417dc14e1210fdad14ba21b3aaabff99df825a" }, "downloads": -1, "filename": "luaparser-1.2.0.tar.gz", "has_sig": false, "md5_digest": "76cfe33b9eba7c162e6551c8c6dde077", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 49007, "upload_time": "2018-03-02T17:32:22", "url": "https://files.pythonhosted.org/packages/7c/5f/1c49d03bf37443771b4986b397eccadedbb4606a106afe6b3e5eaf914e6c/luaparser-1.2.0.tar.gz" } ], "1.2.1": [ { "comment_text": "", "digests": { "md5": "94dc82f08c9edca960dde165371daf86", "sha256": "1f2edc9546979d0982de24c5512418249b14e336cb138d1b8dfce45be66787dd" }, "downloads": -1, "filename": "luaparser-1.2.1.tar.gz", "has_sig": false, "md5_digest": "94dc82f08c9edca960dde165371daf86", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 47425, "upload_time": "2018-03-06T07:57:17", "url": "https://files.pythonhosted.org/packages/60/d7/9bda7df965d4dfa41ef784b44db0a09867310b3723092d937f18ee43851c/luaparser-1.2.1.tar.gz" } ], "1.2.2": [ { "comment_text": "", "digests": { "md5": "b88f463d02a23263f6d735a399f69e6c", "sha256": "ca851fe6d23f384db4c0359f3a601f9aee9567b9d3bdca24c49dd0c88ee64c3e" }, "downloads": -1, "filename": "luaparser-1.2.2.tar.gz", "has_sig": false, "md5_digest": "b88f463d02a23263f6d735a399f69e6c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 55506, "upload_time": "2018-04-04T20:29:49", "url": "https://files.pythonhosted.org/packages/e5/ac/9b8fc29c3efe361d99e9d2a9d4611989326baf89676abb5376a41a5dcc6b/luaparser-1.2.2.tar.gz" } ], "2.0.0": [ { "comment_text": "", "digests": { "md5": "1085234d6b76a28f9c626389f17c3255", "sha256": "12726e0513228b8efb5fdc04459591abbd485ec16ec900d85f11aa7a4486232d" }, "downloads": -1, "filename": "luaparser-2.0.0.tar.gz", "has_sig": false, "md5_digest": "1085234d6b76a28f9c626389f17c3255", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 26063, "upload_time": "2018-06-07T18:25:32", "url": "https://files.pythonhosted.org/packages/7f/75/1df9bdc90b37e09d85827d04692f18ac593c12fe17982a36b44aaf089c6a/luaparser-2.0.0.tar.gz" } ], "2.0.1": [ { "comment_text": "", "digests": { "md5": "90613dffd8714552917913ba4ea6b740", "sha256": "c2598091b8d300dfeefc78274c2fe83e233bd2f8b0bf9086f1fe63684e6a2bfb" }, "downloads": -1, "filename": "luaparser-2.0.1.tar.gz", "has_sig": false, "md5_digest": "90613dffd8714552917913ba4ea6b740", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 26682, "upload_time": "2018-06-07T18:59:28", "url": "https://files.pythonhosted.org/packages/ac/19/b6017cf3b88e0029bffb572920b8cfcb501a3d739c6a3a1493fd9aedb938/luaparser-2.0.1.tar.gz" } ], "2.0.2": [ { "comment_text": "", "digests": { "md5": "cac0583d543485e167bf254baabdae2f", "sha256": "8b4721dc79e9474dff381b750812efa7df7749ec3c13c8a5821f463ca6851408" }, "downloads": -1, "filename": "luaparser-2.0.2.tar.gz", "has_sig": false, "md5_digest": "cac0583d543485e167bf254baabdae2f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 26749, "upload_time": "2018-07-18T17:44:54", "url": "https://files.pythonhosted.org/packages/b0/38/2a053625cf727ba13e6c277a11b04dfd9cf0aebc54e4178f0f0ccf78ffc7/luaparser-2.0.2.tar.gz" } ], "2.1.2": [ { "comment_text": "", "digests": { "md5": "00f017ccf3f2bc79efcfba77ace15db9", "sha256": "33b58931d1ae828d71cb1b3c0605580679560671901c60077328d63043fda840" }, "downloads": -1, "filename": "luaparser-2.1.2.tar.gz", "has_sig": false, "md5_digest": "00f017ccf3f2bc79efcfba77ace15db9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 29068, "upload_time": "2019-02-05T13:47:11", "url": "https://files.pythonhosted.org/packages/06/2e/c0964246f4a0a58c319c2bf24f6e1cf918d473351d6230711352cf1be22c/luaparser-2.1.2.tar.gz" } ], "2.2.0": [ { "comment_text": "", "digests": { "md5": "5e1318951f8429d78792e9eb136531d8", "sha256": "f0c4816cf29ddbd546f2d23e124e1ec6adf26d351b0f970db5f2f76454d8d481" }, "downloads": -1, "filename": "luaparser-2.2.0.tar.gz", "has_sig": false, "md5_digest": "5e1318951f8429d78792e9eb136531d8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 30199, "upload_time": "2019-10-04T21:03:59", "url": "https://files.pythonhosted.org/packages/93/5d/4e59184447751785aa182e031fcee7a3467d24f03a44fdf7d7a0fd9faece/luaparser-2.2.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "5e1318951f8429d78792e9eb136531d8", "sha256": "f0c4816cf29ddbd546f2d23e124e1ec6adf26d351b0f970db5f2f76454d8d481" }, "downloads": -1, "filename": "luaparser-2.2.0.tar.gz", "has_sig": false, "md5_digest": "5e1318951f8429d78792e9eb136531d8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 30199, "upload_time": "2019-10-04T21:03:59", "url": "https://files.pythonhosted.org/packages/93/5d/4e59184447751785aa182e031fcee7a3467d24f03a44fdf7d7a0fd9faece/luaparser-2.2.0.tar.gz" } ] }