{ "info": { "author": "Alex Gaynor", "author_email": "alex.gaynor@gmail.com", "bugtrack_url": null, "classifiers": [], "description": "RPLY\n====\n\n.. image:: https://secure.travis-ci.org/alex/rply.png\n :target: https://travis-ci.org/alex/rply\n\nWelcome to RPLY! A pure Python parser generator, that also works with RPython.\nIt is a more-or-less direct port of David Beazley's awesome PLY, with a new\npublic API, and RPython support.\n\nYou can find the documentation `online`_.\n\nBasic API:\n\n.. code:: python\n\n from rply import ParserGenerator, LexerGenerator\n from rply.token import BaseBox\n\n lg = LexerGenerator()\n # Add takes a rule name, and a regular expression that defines the rule.\n lg.add(\"PLUS\", r\"\\+\")\n lg.add(\"MINUS\", r\"-\")\n lg.add(\"NUMBER\", r\"\\d+\")\n\n lg.ignore(r\"\\s+\")\n\n # This is a list of the token names. precedence is an optional list of\n # tuples which specifies order of operation for avoiding ambiguity.\n # precedence must be one of \"left\", \"right\", \"nonassoc\".\n # cache_id is an optional string which specifies an ID to use for\n # caching. It should *always* be safe to use caching,\n # RPly will automatically detect when your grammar is\n # changed and refresh the cache for you.\n pg = ParserGenerator([\"NUMBER\", \"PLUS\", \"MINUS\"],\n precedence=[(\"left\", ['PLUS', 'MINUS'])], cache_id=\"myparser\")\n\n @pg.production(\"main : expr\")\n def main(p):\n # p is a list, of each of the pieces on the right hand side of the\n # grammar rule\n return p[0]\n\n @pg.production(\"expr : expr PLUS expr\")\n @pg.production(\"expr : expr MINUS expr\")\n def expr_op(p):\n lhs = p[0].getint()\n rhs = p[2].getint()\n if p[1].gettokentype() == \"PLUS\":\n return BoxInt(lhs + rhs)\n elif p[1].gettokentype() == \"MINUS\":\n return BoxInt(lhs - rhs)\n else:\n raise AssertionError(\"This is impossible, abort the time machine!\")\n\n @pg.production(\"expr : NUMBER\")\n def expr_num(p):\n return BoxInt(int(p[0].getstr()))\n\n lexer = lg.build()\n parser = pg.build()\n\n class BoxInt(BaseBox):\n def __init__(self, value):\n self.value = value\n\n def getint(self):\n return self.value\n\nThen you can do:\n\n.. code:: python\n\n parser.parse(lexer.lex(\"1 + 3 - 2+12-32\"))\n\nYou can also substitute your own lexer. A lexer is an object with a ``next()``\nmethod that returns either the next token in sequence, or ``None`` if the token\nstream has been exhausted.\n\nWhy do we have the boxes?\n-------------------------\n\nIn RPython, like other statically typed languages, a variable must have a\nspecific type, we take advantage of polymorphism to keep values in a box so\nthat everything is statically typed. You can write whatever boxes you need for\nyour project.\n\nIf you don't intend to use your parser from RPython, and just want a cool pure\nPython parser you can ignore all the box stuff and just return whatever you\nlike from each production method.\n\nError handling\n--------------\n\nBy default, when a parsing error is encountered, an ``rply.ParsingError`` is\nraised, it has a method ``getsourcepos()``, which returns an\n``rply.token.SourcePosition`` object.\n\nYou may also provide an error handler, which, at the moment, must raise an\nexception. It receives the ``Token`` object that the parser errored on.\n\n.. code:: python\n\n pg = ParserGenerator(...)\n\n @pg.error\n def error_handler(token):\n raise ValueError(\"Ran into a %s where it wasn't expected\" % token.gettokentype())\n\nPython compatibility\n--------------------\n\nRPly is tested and known to work under Python 2.6, 2.7, 3.4+, and PyPy. It is\nalso valid RPython for PyPy checkouts from ``6c642ae7a0ea`` onwards.\n\nLinks\n-----\n\n* `Source code and issue tracker `_\n* `PyPI releases `_\n* `Talk at PyCon US 2013: So you want to write an interpreter? `_\n\n.. _`online`: https://rply.readthedocs.io/\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "", "keywords": "", "license": "BSD 3-Clause License", "maintainer": "", "maintainer_email": "", "name": "rply", "package_url": "https://pypi.org/project/rply/", "platform": "", "project_url": "https://pypi.org/project/rply/", "project_urls": null, "release_url": "https://pypi.org/project/rply/0.7.7/", "requires_dist": [ "appdirs" ], "requires_python": "", "summary": "A pure Python Lex/Yacc that works with RPython", "version": "0.7.7" }, "last_serial": 4723856, "releases": { "0.5": [ { "comment_text": "", "digests": { "md5": "5e4f26d60588ffe8e84fc0140667df5a", "sha256": "71c8dd675987653df7a7faa882b6f756a645578a3fb4f3aaa59dd0b709c676aa" }, "downloads": -1, "filename": "rply-0.5.tar.gz", "has_sig": false, "md5_digest": "5e4f26d60588ffe8e84fc0140667df5a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8680, "upload_time": "2012-12-15T09:35:25", "url": "https://files.pythonhosted.org/packages/53/ed/337b3f9b072f36d3e898952bd52c43a75300996372afea711dade1a53c8c/rply-0.5.tar.gz" } ], "0.5.1": [ { "comment_text": "", "digests": { "md5": "b28606f9946a12e08bf6e2df798c132a", "sha256": "145ee397d786cc7daa19365859c2a87d5c613333fc6cd319e0fe3c1f70a9de88" }, "downloads": -1, "filename": "rply-0.5.1.tar.gz", "has_sig": false, "md5_digest": "b28606f9946a12e08bf6e2df798c132a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9760, "upload_time": "2012-12-15T09:50:29", "url": "https://files.pythonhosted.org/packages/e2/88/5c982dc09ece93f84845ccd10decfcab2ae871be5a16414d336baf75d679/rply-0.5.1.tar.gz" } ], "0.6.0": [ { "comment_text": "", "digests": { "md5": "72ebfa5ef184ff1d5b29e39e228f8b5e", "sha256": "328f9e4b7fbbd75175505233f1994148b25874f3b7585898f08dc21e7f2e1558" }, "downloads": -1, "filename": "rply-0.6.0.tar.gz", "has_sig": false, "md5_digest": "72ebfa5ef184ff1d5b29e39e228f8b5e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11808, "upload_time": "2013-03-09T18:02:50", "url": "https://files.pythonhosted.org/packages/81/af/abb730b99c08f37801bcfb080b1faf316fa15b9cb6af97565a5a2aa97a17/rply-0.6.0.tar.gz" } ], "0.6.1": [ { "comment_text": "", "digests": { "md5": "659119ca8047ef732fae22a3518bfdef", "sha256": "1c9c5f9a432ef45431a20245e6dd547e4fd04ff87f327297504e72a0b0b6beef" }, "downloads": -1, "filename": "rply-0.6.1.tar.gz", "has_sig": false, "md5_digest": "659119ca8047ef732fae22a3518bfdef", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11825, "upload_time": "2013-03-10T16:27:53", "url": "https://files.pythonhosted.org/packages/30/88/498d6a4fc4e5f2de56afad873623f7d269295473fb8258bfa00bd130839b/rply-0.6.1.tar.gz" } ], "0.7.0": [ { "comment_text": "", "digests": { "md5": "d0c820172d1af1f20ffad65898468e49", "sha256": "15eb2c50ab3a09065194409413f392ddaa6cc807eb1680293e0a7a53d6c86ad1" }, "downloads": -1, "filename": "rply-0.7.0.tar.gz", "has_sig": true, "md5_digest": "d0c820172d1af1f20ffad65898468e49", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12230, "upload_time": "2013-12-07T18:22:09", "url": "https://files.pythonhosted.org/packages/09/a0/6969275158a194509f6e415dc813cedcb8351e9a8908434a593d784a59ca/rply-0.7.0.tar.gz" } ], "0.7.1": [ { "comment_text": "", "digests": { "md5": "11f6498c46f360e52ce7a864feef1253", "sha256": "d35eb78996dca43a2dbce56c426bd70744121298d77fed376b35ecafb137a189" }, "downloads": -1, "filename": "rply-0.7.1-py2.py3-none-any.whl", "has_sig": true, "md5_digest": "11f6498c46f360e52ce7a864feef1253", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 16313, "upload_time": "2014-01-17T23:21:02", "url": "https://files.pythonhosted.org/packages/05/e9/18dbd2fbc12a84e27ff5d79ded2eca49d8fa11759e3fa083168610038b1b/rply-0.7.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "5e2970627da13d63d904be9a50187485", "sha256": "d254901aa80a1de01d1fe25e7e7e97e8c70a756903803d24bd27a6a4e6094604" }, "downloads": -1, "filename": "rply-0.7.1.tar.gz", "has_sig": true, "md5_digest": "5e2970627da13d63d904be9a50187485", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14492, "upload_time": "2014-01-17T23:21:09", "url": "https://files.pythonhosted.org/packages/b0/93/07cf4bf4964214cb283a12d3446b7065416f641c6071c35265dcda95c7fa/rply-0.7.1.tar.gz" } ], "0.7.2": [ { "comment_text": "", "digests": { "md5": "b2f52db09778b724bd86f34c334df18a", "sha256": "0a79c1ac43e2fedba3165eb8327d96663aa18906897bc2c1bb4c74372c7a4675" }, "downloads": -1, "filename": "rply-0.7.2-py2.py3-none-any.whl", "has_sig": true, "md5_digest": "b2f52db09778b724bd86f34c334df18a", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 16382, "upload_time": "2014-01-18T17:36:36", "url": "https://files.pythonhosted.org/packages/39/51/e08988ad8add51c64118c5712fb9e52e4fe43239536936fc5b957f03ad3e/rply-0.7.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "7a67a9ba6aa86eda094cfb2c13eaecea", "sha256": "b5e41f4161d7c286b37b77e7cc610a90bf926200c0bf0276cb5a7d87ef3d009d" }, "downloads": -1, "filename": "rply-0.7.2.tar.gz", "has_sig": true, "md5_digest": "7a67a9ba6aa86eda094cfb2c13eaecea", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14548, "upload_time": "2014-01-18T17:36:43", "url": "https://files.pythonhosted.org/packages/ca/26/6092759c2a24c7f04ac2c43e51185c9f12cfedfb3d50ff97cac42c06414b/rply-0.7.2.tar.gz" } ], "0.7.3": [ { "comment_text": "", "digests": { "md5": "ae69cddd58f621cd8e04748c6e065972", "sha256": "cf10f9839784026e3f181ec3c5bca0de5bf96853f84a84c688960b9170086fe7" }, "downloads": -1, "filename": "rply-0.7.3-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "ae69cddd58f621cd8e04748c6e065972", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 18603, "upload_time": "2014-12-02T21:51:52", "url": "https://files.pythonhosted.org/packages/ab/9b/2ea07e575111de4408d79c6489dd2dc3b74221ad8920f92963fdc9218b69/rply-0.7.3-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "b672dda5f3b3673b792803c1f9845196", "sha256": "5c3c4ba2fb0b28827743d1a5fa3246f4e6ab95fc73c37a10d236fae6650589d0" }, "downloads": -1, "filename": "rply-0.7.3.tar.gz", "has_sig": false, "md5_digest": "b672dda5f3b3673b792803c1f9845196", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16471, "upload_time": "2014-12-02T21:51:54", "url": "https://files.pythonhosted.org/packages/cb/68/05cceec8a018edd09e8991420b89944f9409e02536228e00176d67d9f29e/rply-0.7.3.tar.gz" } ], "0.7.4": [ { "comment_text": "", "digests": { "md5": "a7879aa012a5a8e50239aaf4e2ca6df0", "sha256": "601b55ac64f88533239df9e0acafa801967dc165cca1fad573dbcf1f6214390e" }, "downloads": -1, "filename": "rply-0.7.4-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "a7879aa012a5a8e50239aaf4e2ca6df0", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 18497, "upload_time": "2015-09-01T12:43:06", "url": "https://files.pythonhosted.org/packages/4d/a6/71d098f5ac148f86fc0444b9b05a7bc7f284e06f67baec541ee97efb5dca/rply-0.7.4-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "9647256c1ca4c107e0190feca2dca935", "sha256": "723303d6c5f05a7ee19f59531f66c8c7d41cfaef2676057369db1eb5520b378b" }, "downloads": -1, "filename": "rply-0.7.4.tar.gz", "has_sig": false, "md5_digest": "9647256c1ca4c107e0190feca2dca935", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16339, "upload_time": "2015-09-01T12:43:11", "url": "https://files.pythonhosted.org/packages/f8/f4/c1fc57461dda9370e9600933162afb144429f7296fe7aa9bd8c8bc562934/rply-0.7.4.tar.gz" } ], "0.7.5": [ { "comment_text": "", "digests": { "md5": "060ec3f6d72df9ef2ef95892df574d88", "sha256": "d4ab9b0c0a7aa4f6f1e52ff091283de93dce09590ed5b07f1c4bc45bcab86d7e" }, "downloads": -1, "filename": "rply-0.7.5-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "060ec3f6d72df9ef2ef95892df574d88", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 18512, "upload_time": "2017-07-12T20:46:25", "url": "https://files.pythonhosted.org/packages/02/e9/05c04324d1bd0581df638d34415d5549f054830534dda60ddc1976f41006/rply-0.7.5-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "cbcb11fae0a997980e04c826fe79bc97", "sha256": "50c2bf9fe02514bce46de4373bbdb398d7b812061d239306f9baff9210126453" }, "downloads": -1, "filename": "rply-0.7.5.tar.gz", "has_sig": false, "md5_digest": "cbcb11fae0a997980e04c826fe79bc97", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16378, "upload_time": "2017-07-12T20:46:27", "url": "https://files.pythonhosted.org/packages/0d/4a/b3b18a02aa95c3bf3324dc0c222fd978ec7b8cc68f36f3388c59e2e76cb0/rply-0.7.5.tar.gz" } ], "0.7.6": [ { "comment_text": "", "digests": { "md5": "3ed5c37ea69b931d0a7b14324d416189", "sha256": "083edc71214ecaa7f2e3c6e60c11cc1aeb8f99d7a31bafcbd79886b5b7f98137" }, "downloads": -1, "filename": "rply-0.7.6-py2.py3-none-any.whl", "has_sig": true, "md5_digest": "3ed5c37ea69b931d0a7b14324d416189", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 14933, "upload_time": "2018-05-26T15:31:56", "url": "https://files.pythonhosted.org/packages/87/b9/119bc3c4bdb727667cd925f99b2b22c7222abe81cb6dcb262ae33f94abf1/rply-0.7.6-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "f14e9f040b596e81e0cfdd3c11e4505e", "sha256": "ab443c6c90539ec4d720da3023ab7a5e38e9222c8765a45f759d06df3564dda9" }, "downloads": -1, "filename": "rply-0.7.6.tar.gz", "has_sig": true, "md5_digest": "f14e9f040b596e81e0cfdd3c11e4505e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15075, "upload_time": "2018-05-26T15:32:01", "url": "https://files.pythonhosted.org/packages/c7/3a/722ea26d48ec0ed4478bdfb5d9751f6cc7a0bc41937c2e6cae2ad70f1e6c/rply-0.7.6.tar.gz" } ], "0.7.7": [ { "comment_text": "", "digests": { "md5": "bbec67a2b4c6f92760d799d1d43c9ca5", "sha256": "2c8083bf2853642a0e24de9a9db3ce2d25b3153037a7298d2ff9434413744e33" }, "downloads": -1, "filename": "rply-0.7.7-py2.py3-none-any.whl", "has_sig": true, "md5_digest": "bbec67a2b4c6f92760d799d1d43c9ca5", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 15982, "upload_time": "2019-01-22T00:05:59", "url": "https://files.pythonhosted.org/packages/e7/82/388e0845abda4bba5ba041aa32e411b3eed56f518c96c6565559e713a5ed/rply-0.7.7-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "803f9f4b851083cd3acb3b38b288a02d", "sha256": "4d6d25703efd28fb3d5707f7b3bd4fe66c306159a5c25af10ba26d206a66d00d" }, "downloads": -1, "filename": "rply-0.7.7.tar.gz", "has_sig": true, "md5_digest": "803f9f4b851083cd3acb3b38b288a02d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15237, "upload_time": "2019-01-22T00:06:04", "url": "https://files.pythonhosted.org/packages/71/04/e52242871e606389f232f07042747567fb354a91d9449cad7fa9febbe3b3/rply-0.7.7.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "bbec67a2b4c6f92760d799d1d43c9ca5", "sha256": "2c8083bf2853642a0e24de9a9db3ce2d25b3153037a7298d2ff9434413744e33" }, "downloads": -1, "filename": "rply-0.7.7-py2.py3-none-any.whl", "has_sig": true, "md5_digest": "bbec67a2b4c6f92760d799d1d43c9ca5", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 15982, "upload_time": "2019-01-22T00:05:59", "url": "https://files.pythonhosted.org/packages/e7/82/388e0845abda4bba5ba041aa32e411b3eed56f518c96c6565559e713a5ed/rply-0.7.7-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "803f9f4b851083cd3acb3b38b288a02d", "sha256": "4d6d25703efd28fb3d5707f7b3bd4fe66c306159a5c25af10ba26d206a66d00d" }, "downloads": -1, "filename": "rply-0.7.7.tar.gz", "has_sig": true, "md5_digest": "803f9f4b851083cd3acb3b38b288a02d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15237, "upload_time": "2019-01-22T00:06:04", "url": "https://files.pythonhosted.org/packages/71/04/e52242871e606389f232f07042747567fb354a91d9449cad7fa9febbe3b3/rply-0.7.7.tar.gz" } ] }