{ "info": { "author": "Subhajeet Dey", "author_email": "subhajeet2107@gmail.com", "bugtrack_url": null, "classifiers": [], "description": "pylexer\n==========================\nA python implementation of a lexical analyzer which supports full scan, state based lexing and lookahead\n\n\n[![Build Status](https://travis-ci.org/subhajeet2107/pylexer.svg?branch=master)](https://travis-ci.org/subhajeet2107/pylexer) ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/Django.svg) [![PyPI version](https://badge.fury.io/py/pylexer.svg)](https://badge.fury.io/py/pylexer) [![PyPI license](https://img.shields.io/pypi/l/ansicolortags.svg)](https://pypi.python.org/pypi/ansicolortags/)\n\n> **Warning**\n> This is not a GENERATOR like classical lexer is. It does not produce any python code. It's a simple plain scanner\n> of the given input string and tokenizer into given set of tokens by matching regular expressions.\n> Thus, at runtime you can change the token definition and use one same code for any token set\n\n## Installation\n\nInstall in your project with pip:\n\n```bash\npip install pylexer\n```\n\n## Usage\n\nAn example use:\n\n```python\n\nfrom pylexer import PyLexer\nconfig = {\n\t'\\\\s' :'',\n '\\\\d+' :'number',\n '\\\\+' : 'plus',\n '-': 'minus',\n '\\\\*' : 'mul',\n '/' : 'div',\n}\n#Static Scan method that returns list of tokens\ntokens = PyLexer.scan(config, '2 + 3')\nmap(lambda x:x.get_name(), tokens)\n\n#PyLexer Config is a dict, so you can also use it like\nlexer = PyLexer()\nlexer.set_input('2 + 3')\nlexer.move_next()\nwhile lexer.get_look_ahead():\n\tprint(lexer.get_look_ahead().get_name())\n\tlexer.move_next()\n\n\n```\n\n## Token Definition\nTokens are defined with ```TokenDefinition``` class that holds token name and regular expression. Token name can be empty, and in that case lexer will ignore/skip such tokens\n\n## Lexer Configuration\nThe lexer configuration holds a list of all token definitions. With LexerDictConfig it can be easily created from an array where keys are regular expressions and values are names of tokens\n\n## Full scan\nPylexer's static scan method can be used to scan given input string and returns a list of tokens, Pylexer can also be used to walk through scanned tokens with single look ahead\n\n## License\n\nMIT license. See `LICENSE.md` for more information.\n\n## Contributors\nPylexer is inspired from PHP's Lexer(https://github.com/tmilos/lexer) and takes code heavily from doctrine API, all credits due with Milos Tomic\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/subhajeet2107/pylexer/", "keywords": "", "license": "MIT License", "maintainer": "", "maintainer_email": "", "name": "pylexer", "package_url": "https://pypi.org/project/pylexer/", "platform": "", "project_url": "https://pypi.org/project/pylexer/", "project_urls": { "Homepage": "https://github.com/subhajeet2107/pylexer/" }, "release_url": "https://pypi.org/project/pylexer/1.0.0/", "requires_dist": [ "pytest", "six" ], "requires_python": "", "summary": "A python implementation of a lexical analyzer which supports full scan, state based lexing and lookahead", "version": "1.0.0" }, "last_serial": 5630705, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "172a462bbe3c7ba1c288b1fe9d9a778b", "sha256": "6bab41f2469361d6b9c1d96b9c6332a8fb734fe4bcf3e2c9055e18562ecd7e27" }, "downloads": -1, "filename": "pylexer-1.0.0-py3-none-any.whl", "has_sig": false, "md5_digest": "172a462bbe3c7ba1c288b1fe9d9a778b", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 7791, "upload_time": "2019-08-04T14:12:44", "url": "https://files.pythonhosted.org/packages/60/5d/0455a5dfc1fe2438ea88277c47396320d7962761feb7d15b176467bf1ecd/pylexer-1.0.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "50fcb8058e5548a2f0fef7896cd13224", "sha256": "7173e1d730cca0a03870da8bfaf7ddd1085d1aba21f25cd78cfff4e8c892beff" }, "downloads": -1, "filename": "pylexer-1.0.0.tar.gz", "has_sig": false, "md5_digest": "50fcb8058e5548a2f0fef7896cd13224", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5887, "upload_time": "2019-08-04T14:12:48", "url": "https://files.pythonhosted.org/packages/aa/93/785cc297351c762bcaf0e43001e3e924581216ed03c2fe28334fe8beccea/pylexer-1.0.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "172a462bbe3c7ba1c288b1fe9d9a778b", "sha256": "6bab41f2469361d6b9c1d96b9c6332a8fb734fe4bcf3e2c9055e18562ecd7e27" }, "downloads": -1, "filename": "pylexer-1.0.0-py3-none-any.whl", "has_sig": false, "md5_digest": "172a462bbe3c7ba1c288b1fe9d9a778b", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 7791, "upload_time": "2019-08-04T14:12:44", "url": "https://files.pythonhosted.org/packages/60/5d/0455a5dfc1fe2438ea88277c47396320d7962761feb7d15b176467bf1ecd/pylexer-1.0.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "50fcb8058e5548a2f0fef7896cd13224", "sha256": "7173e1d730cca0a03870da8bfaf7ddd1085d1aba21f25cd78cfff4e8c892beff" }, "downloads": -1, "filename": "pylexer-1.0.0.tar.gz", "has_sig": false, "md5_digest": "50fcb8058e5548a2f0fef7896cd13224", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5887, "upload_time": "2019-08-04T14:12:48", "url": "https://files.pythonhosted.org/packages/aa/93/785cc297351c762bcaf0e43001e3e924581216ed03c2fe28334fe8beccea/pylexer-1.0.0.tar.gz" } ] }