Languages

parse

pyensae.languages.build_grammar (g4, version = ‘4.7.1’, fLOG = <function noLOG at 0x7fb2d395a400>)

Compiles the grammar for a specific file.

pyensae.languages.get_parser_lexer (language)

Returns two classes, a parser and a lexer from antlr4.

pyensae.languages.parse_code (code, class_parser, class_lexer)

Parses a code and returns a tree.

pyensae.languages.get_tree_string (tree, parser, format = <class ‘pyensae.languages.tree_string_listener.TreeStringListener’>)

Returns a string which shows the parsed tree.

pyensae.languages.get_tree_graph (tree, parser, format = <class ‘pyensae.languages.tree_graph_listener.TreeGraphListener’>)

Returns a graph with networkx.

conversion

pyensae.languages.r2python (code, pep8 = False, fLOG = None)

Converts a R script into Python.