pyebnf/compiler.py
def _get_token_type_enum(self):
    """Builds the python source code for the Parser TokenType enum."""
    fmt = "class TokenType(Enum):\n" \
          "{indent}\"\"\"The token types for parse nodes generated by the Parser.\"\"\"\n" \
          "{indent}" + \
          "\n{indent}".join("{1} = {0}".format(num + 1, r.name) for num, r in enumerate(self.rules))
    return fmt.format(indent=self.indent)
def _get_token_type_enum(self):
    fmt = "class TokenType(Enum):\n" \
          "{indent}\"\"\"The token types for parse nodes generated by the Parser.\"\"\"\n" \
          "{indent}" + \
          "\n{indent}".join("{1} = {0}".format(num + 1, r.name) for num, r in enumerate(self.rules))
    return fmt.format(indent=self.indent)
def _get_token_type_enum ( self ) : fmt = "class TokenType(Enum):\n" "{indent}\"\"\"The token types for parse nodes generated by the Parser.\"\"\"\n" "{indent}" + "\n{indent}" . join ( "{1} = {0}" . format ( num + 1 , r . name ) for num , r in enumerate ( self . rules ) ) return fmt . format ( indent = self . indent )
Builds the python source code for the Parser TokenType enum.
Builds the python source code for the Parser TokenType enum .