module languages.rconverterListener
¶
Short summary¶
module pyensae.languages.rconverterListener
Convert R into Python
Classes¶
class |
truncated documentation |
---|---|
Raised when conversion cannot be done. |
|
This class is an attempt to run through the tree and convert it into a string. |
Methods¶
method |
truncated documentation |
---|---|
constructor |
|
usual |
|
Converts one node into :epkg:`python`. |
|
Adds extra characters if needed. |
|
Empties the stack. |
|
event |
|
event |
|
event |
|
event |
|
event |
|
event |
|
logging |
|
Get the Python code for the R code. |
|
Tells if parent is one of the parents of current. |
|
Searches for a substring in parents’ node name. |
|
Converts a terminal node into a rule name. |
|
Converts a couple (name, node) into :epkg:`Python`. |
|
event |
|
event |
Documentation¶
Convert R into Python
- exception pyensae.languages.rconverterListener.R2PyConversionError(node, message, sofar, sostack)¶
Bases:
Exception
Raised when conversion cannot be done.
- __init__(node, message, sofar, sostack)¶
- class pyensae.languages.rconverterListener.TreeStringListener(parser, fLOG=None)¶
Bases:
ParseTreeListener
This class is an attempt to run through the tree and convert it into a string.
constructor
- Parameters:
parser – parser used to parse the code
fLOG – logging function
- __init__(parser, fLOG=None)¶
constructor
- Parameters:
parser – parser used to parse the code
fLOG – logging function
- __str__()¶
usual
- add_code(node)¶
Converts one node into :epkg:`python`.
- add_code_final()¶
Adds extra characters if needed.
- empty_stack()¶
Empties the stack.
- enterEveryRule(ctx)¶
event
- enterIntersections(ctx)¶
event
- enterRanges(ctx)¶
event
- exitEveryRule(ctx)¶
event
- exitIntersections(ctx)¶
event
- exitRanges(ctx)¶
event
- fLOG(*l, **p)¶
logging
- get_python()¶
Get the Python code for the R code.
- Returns:
Python code
- has_parent(current, parent, depth=None)¶
Tells if parent is one of the parents of current.
- Parameters:
current – current node
parent – parent to look for
- Returns:
boolean
- search_parents(node, substring, max_depth=None)¶
Searches for a substring in parents’ node name.
- Parameters:
node – current node
substring – substring to search
max_depth – number of parents to look at
- Returns:
boolean
- terminal_node_name(node)¶
Converts a terminal node into a rule name.
- to_python(name, node)¶
Converts a couple (name, node) into :epkg:`Python`.
- visitErrorNode(node)¶
event
- visitTerminal(node)¶
event