{ "info": { "author": "mincrmatt12", "author_email": "matthewmirvish@hotmail.com", "bugtrack_url": null, "classifiers": [], "description": "ParseIt\r\n=======\r\n\r\nA simple parsing tool in 200 lines of python\r\n\r\nGive it a grammar and tokens, and it\u2019ll give you back an ast.\r\n\r\nInputs\r\n------\r\n\r\nUse the ``parse()`` function to parse text. The ``tokens`` parameter is\r\na dictionary of token names to compiled regular expressions. Prefixing a\r\ntoken with ``%`` will ignore it. Token names must be uppercase.\r\n\r\nThe ``rules`` parameter is a dictionary of names to lists of rules, and\r\nthe ``start`` parameter is what node to start parsing first. ``postlex``\r\nand ``postparse`` and post-processing functions. The default will:\r\n\r\n- after lexing remove all tokens that start with a ``%``\r\n- after parsing flatten all nodes with 1 child\r\n\r\nRules\r\n~~~~~\r\n\r\nA rule is a list of rulesegments. A rulesegment can be a string, which\r\nmeans parse that TOKEN/rule_name. A list rule segement is a group, the\r\nlast item in it can be one of the following:\r\n\r\n- ``?``: this group is optional\r\n- ``+``: match at least one of this group, and possibly more\r\n- ``*``: match any number of this group, including zero\r\n\r\nAn example rule looks like this:\r\n\r\n.. code:: python\r\n\r\n [[\"NUM\", \"?\"], [\"var\", \"*\"]]\r\n\r\nThe rule dictionary is a dictionary of rule_names to lists of these\r\nrules, each one being a possibility, like this:\r\n\r\n.. code:: python\r\n\r\n {\r\n \"multi_poly\": [\r\n [\"LPAREN\", \"polynomial\", \"RPAREN\", \"LPAREN\", \"polynomial\", \"RPAREN\"],\r\n [\"NUM\", \"LPAREN\", \"polynomial\", \"RPAREN\"],\r\n [\"polynomial\"]\r\n ]\r\n }\r\n\r\nOutput\r\n------\r\n\r\nThe tree format of ParseIt is very simple: for rule instances (nodes)\r\nyou have a tuple with the first value being the node name, and the\r\nsecond being its children.\r\n\r\nTokens are represented as a tuple of: the token name, the token content,\r\nand its position in the stream\r\n\r\n``treeify``\r\n-----------\r\n\r\nThere is also a module called treeify in the package that (if pydot is\r\ninstalled) allows you to create a graphical representation of the\r\ngenerated trees.\r\n\r\nExample\r\n-------\r\n\r\n``example.py`` has an example grammar and code to convert the generated\r\ntree into a pydot\r\n\r\n\r\n", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "parseit", "package_url": "https://pypi.org/project/parseit/", "platform": "", "project_url": "https://pypi.org/project/parseit/", "project_urls": { "Homepage": "https://github.com/" }, "release_url": "https://pypi.org/project/parseit/1.0.1/", "requires_dist": [ "future" ], "requires_python": ">=2.7", "summary": "Simple parser that creates ASTs", "version": "1.0.1" }, "last_serial": 3337216, "releases": { "1.0": [ { "comment_text": "", "digests": { "md5": "bac3592679ddb08ff5fc34eeba7bc9cb", "sha256": "0572ae551786bcc1f45e39610a77840b9236940354c6eca18e428255e4aebf16" }, "downloads": -1, "filename": "parseit-1.0-py2.7.egg", "has_sig": false, "md5_digest": "bac3592679ddb08ff5fc34eeba7bc9cb", "packagetype": "bdist_egg", "python_version": "2.7", "requires_python": null, "size": 8821, "upload_time": "2017-11-16T02:42:04", "url": "https://files.pythonhosted.org/packages/86/6b/8ee85cec55eedc91a4024f529f7ef80b9ccdd5664efad91fa3d71c2bc1bd/parseit-1.0-py2.7.egg" }, { "comment_text": "", "digests": { "md5": "dff781ac35cc90f3cfbaeeff449e7214", "sha256": "76b862919c492e8057d6c117a489f2ccda1f47a3b6de5915e367ee15f2bf7937" }, "downloads": -1, "filename": "parseit-1.0-py2-none-any.whl", "has_sig": false, "md5_digest": "dff781ac35cc90f3cfbaeeff449e7214", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 4934, "upload_time": "2017-11-16T02:42:00", "url": "https://files.pythonhosted.org/packages/7f/07/ed3c65053243c5f94d3ec87769767cef47cce3a5c804d216e0a344e55cbc/parseit-1.0-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "743e23ce48f3d9cb7e61e9a639296851", "sha256": "b4430f92c7f483e3b988bd7e85fe3c14a03679ee88aa8778c5e2701062ffd891" }, "downloads": -1, "filename": "parseit-1.0-py3.6.egg", "has_sig": false, "md5_digest": "743e23ce48f3d9cb7e61e9a639296851", "packagetype": "bdist_egg", "python_version": "3.6", "requires_python": null, "size": 8905, "upload_time": "2017-11-16T02:42:05", "url": "https://files.pythonhosted.org/packages/b5/15/c8b8596f1fbe482652b5fc69b40cb370e0baf0288adc1fb20b6c49d58ae2/parseit-1.0-py3.6.egg" }, { "comment_text": "", "digests": { "md5": "6f6dffef9d568f3462fd1fd743b663a8", "sha256": "c6b7b35d02cda128e3fcec2a7a4fedebe91a4041146a0ad0cde49c952e13a4f4" }, "downloads": -1, "filename": "parseit-1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "6f6dffef9d568f3462fd1fd743b663a8", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 4957, "upload_time": "2017-11-16T02:42:03", "url": "https://files.pythonhosted.org/packages/91/dc/b0fef69f11e7a4b0ae57fabcc5d7d5e2a1db6b72f55446c9509680978951/parseit-1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "315abe76031d145c00c29b8f3fa46509", "sha256": "c1d2a7e075d0641868dbda164d2edf5250350dc84fdfc84b31d30eba9083b72e" }, "downloads": -1, "filename": "parseit-1.0.tar.gz", "has_sig": false, "md5_digest": "315abe76031d145c00c29b8f3fa46509", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3465, "upload_time": "2017-11-16T02:42:06", "url": "https://files.pythonhosted.org/packages/b7/c1/cdc54cd8783679671128b8d61ab0c19ee8afcd06a9fc46ea2e47058f419d/parseit-1.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "4e32e120dd2985098a84223cac396eae", "sha256": "5c0a9f1b4ce16c65540cd1d1126e9a153e211d56ea0a143c9334fbf9928cf4d6" }, "downloads": -1, "filename": "parseit-1.0.1-py2.7.egg", "has_sig": false, "md5_digest": "4e32e120dd2985098a84223cac396eae", "packagetype": "bdist_egg", "python_version": "2.7", "requires_python": ">=2.7", "size": 9845, "upload_time": "2017-11-16T02:53:40", "url": "https://files.pythonhosted.org/packages/2d/6f/b68cca6dcbc84d40797751edbad19e79f00dd1cd97641c43cde8b7dfd01a/parseit-1.0.1-py2.7.egg" }, { "comment_text": "", "digests": { "md5": "04f98ac1305392c691adfabd74542415", "sha256": "aa09a70c8207b216657b0b720e6f42186ef72134dc52a27b2bb4f5f0b303770c" }, "downloads": -1, "filename": "parseit-1.0.1-py2-none-any.whl", "has_sig": false, "md5_digest": "04f98ac1305392c691adfabd74542415", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": ">=2.7", "size": 6924, "upload_time": "2017-11-16T02:53:37", "url": "https://files.pythonhosted.org/packages/f5/3f/477dee48e0cd0a8458ea175766aa48b2f4e39d818fbd39b965080f8e71f0/parseit-1.0.1-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "6b3fe83cd51e9d26cb7a6469e135337b", "sha256": "580d1d2dc2127623a2b41e099c263a129f35529e237fcdbebaa0a1b700a73cb3" }, "downloads": -1, "filename": "parseit-1.0.1-py3.6.egg", "has_sig": false, "md5_digest": "6b3fe83cd51e9d26cb7a6469e135337b", "packagetype": "bdist_egg", "python_version": "3.6", "requires_python": ">=2.7", "size": 5094, "upload_time": "2017-11-16T02:53:41", "url": "https://files.pythonhosted.org/packages/62/d0/f2f2dcd7f461ad6c6c90d67811824bab842b939e675d92db6ef19a4b5c4c/parseit-1.0.1-py3.6.egg" }, { "comment_text": "", "digests": { "md5": "b49dccab6658c91624a16b363698d813", "sha256": "8ed8d639124bbb9c7017d6bed2cee55e63ed1f124c47c8b2b07f3efb16d2ea10" }, "downloads": -1, "filename": "parseit-1.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "b49dccab6658c91624a16b363698d813", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=2.7", "size": 6885, "upload_time": "2017-11-16T02:53:39", "url": "https://files.pythonhosted.org/packages/a8/67/a2f8ea8ff2d1b02b4e199a75dbd2d66fc9ce98718e4a4848a83005a6920a/parseit-1.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "c8125a599ef2d71b91737312bb4a6eca", "sha256": "fcc54bd5b83ae734f2e86249834be74bf0f552157656d7225e98b9bfb429f0ef" }, "downloads": -1, "filename": "parseit-1.0.1.tar.gz", "has_sig": false, "md5_digest": "c8125a599ef2d71b91737312bb4a6eca", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7", "size": 4922, "upload_time": "2017-11-16T02:53:42", "url": "https://files.pythonhosted.org/packages/44/a6/b34b5f636e689429f96621295ed6e1f234a8e2b9ba2622029ac9f530661b/parseit-1.0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "4e32e120dd2985098a84223cac396eae", "sha256": "5c0a9f1b4ce16c65540cd1d1126e9a153e211d56ea0a143c9334fbf9928cf4d6" }, "downloads": -1, "filename": "parseit-1.0.1-py2.7.egg", "has_sig": false, "md5_digest": "4e32e120dd2985098a84223cac396eae", "packagetype": "bdist_egg", "python_version": "2.7", "requires_python": ">=2.7", "size": 9845, "upload_time": "2017-11-16T02:53:40", "url": "https://files.pythonhosted.org/packages/2d/6f/b68cca6dcbc84d40797751edbad19e79f00dd1cd97641c43cde8b7dfd01a/parseit-1.0.1-py2.7.egg" }, { "comment_text": "", "digests": { "md5": "04f98ac1305392c691adfabd74542415", "sha256": "aa09a70c8207b216657b0b720e6f42186ef72134dc52a27b2bb4f5f0b303770c" }, "downloads": -1, "filename": "parseit-1.0.1-py2-none-any.whl", "has_sig": false, "md5_digest": "04f98ac1305392c691adfabd74542415", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": ">=2.7", "size": 6924, "upload_time": "2017-11-16T02:53:37", "url": "https://files.pythonhosted.org/packages/f5/3f/477dee48e0cd0a8458ea175766aa48b2f4e39d818fbd39b965080f8e71f0/parseit-1.0.1-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "6b3fe83cd51e9d26cb7a6469e135337b", "sha256": "580d1d2dc2127623a2b41e099c263a129f35529e237fcdbebaa0a1b700a73cb3" }, "downloads": -1, "filename": "parseit-1.0.1-py3.6.egg", "has_sig": false, "md5_digest": "6b3fe83cd51e9d26cb7a6469e135337b", "packagetype": "bdist_egg", "python_version": "3.6", "requires_python": ">=2.7", "size": 5094, "upload_time": "2017-11-16T02:53:41", "url": "https://files.pythonhosted.org/packages/62/d0/f2f2dcd7f461ad6c6c90d67811824bab842b939e675d92db6ef19a4b5c4c/parseit-1.0.1-py3.6.egg" }, { "comment_text": "", "digests": { "md5": "b49dccab6658c91624a16b363698d813", "sha256": "8ed8d639124bbb9c7017d6bed2cee55e63ed1f124c47c8b2b07f3efb16d2ea10" }, "downloads": -1, "filename": "parseit-1.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "b49dccab6658c91624a16b363698d813", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=2.7", "size": 6885, "upload_time": "2017-11-16T02:53:39", "url": "https://files.pythonhosted.org/packages/a8/67/a2f8ea8ff2d1b02b4e199a75dbd2d66fc9ce98718e4a4848a83005a6920a/parseit-1.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "c8125a599ef2d71b91737312bb4a6eca", "sha256": "fcc54bd5b83ae734f2e86249834be74bf0f552157656d7225e98b9bfb429f0ef" }, "downloads": -1, "filename": "parseit-1.0.1.tar.gz", "has_sig": false, "md5_digest": "c8125a599ef2d71b91737312bb4a6eca", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7", "size": 4922, "upload_time": "2017-11-16T02:53:42", "url": "https://files.pythonhosted.org/packages/44/a6/b34b5f636e689429f96621295ed6e1f234a8e2b9ba2622029ac9f530661b/parseit-1.0.1.tar.gz" } ] }