{ "info": { "author": "Andreas Schmidl", "author_email": "Andreas.Schmidl@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Topic :: Software Development" ], "description": "setuptools-antlr\n================\n\n|Build Status| |Coverage Status| |PyPI Version| |GitHub Version| |License|\n\n.. |Build Status| image:: https://travis-ci.com/ferraith/setuptools-antlr.svg\n :target: https://travis-ci.com/ferraith/setuptools-antlr\n :alt: Build Status\n\n.. |Coverage Status| image:: https://coveralls.io/repos/github/ferraith/setuptools-antlr/badge.svg?branch=master\n :target: https://coveralls.io/github/ferraith/setuptools-antlr?branch=master\n :alt: Coverage Status\n\n.. |PyPI Version| image:: https://badge.fury.io/py/setuptools-antlr.svg\n :target: https://pypi.org/project/setuptools-antlr\n :alt: PyPI Version\n\n.. |GitHub Version| image:: https://badge.fury.io/gh/ferraith%2Fsetuptools-antlr.svg\n :target: https://github.com/ferraith/setuptools-antlr/releases\n :alt: GitHub Version\n\n.. |License| image:: https://img.shields.io/github/license/ferraith/setuptools-antlr.svg\n :target: https://raw.githubusercontent.com/ferraith/setuptools-antlr/master/LICENSE\n :alt: License\n\nOverview\n--------\n\nA ``setuptools`` command for generating ANTLR based parsers.\n\nThis is an extension for `setuptools `__ integrating the famous `ANTLR `__ parser generator into the Python packaging process. It encapsulates the Java based generator of ANTLR and provides the user a single command to control the generation process.\n\nAll command line options of ANTLR are also available through the setuptools command. The user has the choice to pass the options on the command line or configure ANTLR in a dedicated section in the ``setup.cfg`` file.\n\nANTLR grammars and its dependencies like imported grammars or token files are automatically detected. For each grammar a Python package will be generated during execution of the ``antlr`` command.\n\nInstallation\n------------\n\n``setuptools-antlr`` can be installed in various ways. To run it the following prerequisites have to be fulfilled:\n\n- Python 3.5+\n- setuptools\n- Java JRE 1.7+\n\nThe source distribution is already shipped with ANTLR 4.7.1. It isn't necessary to download ANTLR additionally.\n\nAfter installation, the used Python environment has a new setuptools command called ``antlr``.\n\nFrom Source Code\n****************\n\n::\n\n > git clone https://github.com/ferraith/setuptools-antlr.git\n > cd setuptools-antlr\n > pip install .\n\nFrom PyPI\n*********\n\n::\n\n > pip install setuptools-antlr\n\nFrom GitHub Releases\n********************\n\n::\n\n > pip install \n\nUsage\n-----\n\nIntegration\n***********\n\nFor a smooth user experience it's recommended to pass ``setuptools-antlr`` using the ``setup_requires`` argument of setup function. Additionally each generated parser requires the ANTLR runtime library which should be added to ``install_requires`` argument:\n\n.. code:: python\n\n setup(\n ...\n setup_requires=['setuptools-antlr'],\n install_requires=['antlr4-python3-runtime']\n ...\n )\n\nBefore generating a parser ``setuptools`` will automatically check the Python environment and download ``setuptools-antlr`` from `PyPI `__ if it's missing. During the installation of the project package ``pip`` will install ``antlr4-python3-runtime`` into the Python environment.\n\nConfiguration\n*************\n\n``setuptools-antlr`` provides two possibilities to configure the ANTLR parser generator.\n\nAll options of ANTLR can be passed on the command line after the ``antlr`` command:\n\n::\n\n > python setup.py antlr --visitor\n\nIt's also possible to pass several options to ANTLR or execute multiple commands at once:\n\n::\n\n > python setup.py antlr --visitor --grammar-options \"superClass=Abc tokenVocab=SomeLexer\" bdist_wheel\n\nSee ``python setup.py antlr --help`` for available command line options:\n\n::\n\n > python setup.py antlr --help\n ...\n Options for 'AntlrCommand' command:\n --grammars (-g) specify grammars to generate parsers for\n --output (-o) specify directories where output is generated\n --atn generate rule augmented transition network diagrams\n --encoding specify grammar file encoding e.g. euc-jp\n --message-format specify output style for messages in antlr, gnu, vs2005\n --long-messages show exception details when available for errors and\n warnings\n --listener generate parse tree listener (default)\n --no-listener don't generate parse tree listener\n --visitor generate parse tree visitor\n --no-visitor don't generate parse tree visitor (default)\n --depend generate file dependencies\n --grammar-options set/override a grammar-level option\n --w-error treat warnings as error\n --x-dbg-st launch StringTemplate visualizer on generated code\n --x-dbg-st-wait wait for STViz to close before continuing\n --x-force-atn use the ATN simulator for all predictions\n --x-exact-output-dir output goes into -o directories regardless of paths/package\n --x-log dump lots of logging info to antlr-.log\n ...\n\nThe ANTLR documentation explains all `command line options `__ and `grammar options `__ in detail.\n\nApart from passing options on the command line it's also possible to add a dedicated ``[antlr]`` section to ``setup.cfg``. The following example section contains all available options:\n\n.. code:: ini\n\n [antlr]\n # Specify grammars to generate parsers for; default: None\n #grammars = [ ...]\n # Specify directories where all output is generated; default: ./\n output = default=gen\n # Generate DOT graph files that represent the internal ATN data structures (yes|no); default: no\n #atn = no\n # Specify grammar file encoding; default: utf-8\n #encoding = utf-8\n # Specify output style for messages in antlr (antlr|gnu|vs2005); default: antlr\n #message-format = antlr\n # Show exception details when available for errors and warnings (yes|no); default: no\n #long-messages = no\n # Generate a parse tree listener (yes|no); default: yes\n #listener = yes\n # Generate parse tree visitor (yes|no); default: no\n visitor = yes\n # Generate file dependencies (yes|no); default: no\n #depend = no\n # Set/override grammar-level options (