pyebnf/compiler.py
def _compile(self):
    """Returns the python source code for the generated parser."""
    fmt = """\"\"\"This parser was generated by pyebnf on {date}.\"\"\"
    from enum import Enum

    from pyebnf import parser_base as PB
    from pyebnf.primitive import alternation, concatenation, exclusion, one_or_more
    from pyebnf.primitive import option, repeated, repetition, terminal, zero_or_more
    {imports}

    {token_type_enum}


    {class_definition}
    """

    fmt = self._clean_fmt(fmt)

    return fmt.format(date=datetime.utcnow().isoformat(),
                      imports=self._get_imports(),
                      token_type_enum=self._get_token_type_enum(),
                      class_definition=self._get_class_definition())
def _compile(self):
    """Returns the python source code for the generated parser."""
    fmt = """\"\"\"This parser was generated by pyebnf on {date}.\"\"\"
    from enum import Enum

    from pyebnf import parser_base as PB
    from pyebnf.primitive import alternation, concatenation, exclusion, one_or_more
    from pyebnf.primitive import option, repeated, repetition, terminal, zero_or_more
    {imports}

    {token_type_enum}


    {class_definition}
    """

    fmt = self._clean_fmt(fmt)

    return fmt.format(date=datetime.utcnow().isoformat(),
                      imports=self._get_imports(),
                      token_type_enum=self._get_token_type_enum(),
                      class_definition=self._get_class_definition())
Returns the python source code for the generated parser.