Functions | |
def | string_to_tuple (string) |
Converts a string to a tuple of the Unicode values of the string characters. More... | |
def | tuple_to_string (input) |
Converts a tuple of Unicode values to the equivalent string. More... | |
def | tuple_to_ascii (input, map=None) |
Converts a tuple of Unicode values to an ASCII string. More... | |
def | tuple_to_ascii_underline (map, index) |
Uses the (optional) map generated by tuple_to_ascii() to generate a mapping of the display characters to the actual tuple (integer) characters. More... | |
def | pprint_to_string (obj, temp) |
Pretty prints an object to a temporary file, then reads the string back and returns it. More... | |
def apg_py.lib.utilities.pprint_to_string | ( | obj, | |
temp | |||
) |
Pretty prints an object to a temporary file, then reads the string back and returns it.
obj | The object to pretty print. |
temp | The file name to use to save the printed string. It is deleted after use. |
Definition at line 112 of file utilities.py.
def apg_py.lib.utilities.string_to_tuple | ( | string | ) |
Converts a string to a tuple of the Unicode values of the string characters.
The APG parser requires a tuple of integers as input. However, many problems are defined in terms of ASCII or Unicode strings. This utility is a handy assist to get a string into the proper format for parser input.
string | The string to convert. |
Definition at line 8 of file utilities.py.
def apg_py.lib.utilities.tuple_to_ascii | ( | input, | |
map = None |
|||
) |
Converts a tuple of Unicode values to an ASCII string.
Non-ASCII characters are displayed by hexadecimal value. Used mainly for error reporting in the syntax phase.
input | The tuple of Unicode values to convert. |
map | If map = [] a list of character display mappings is generated. map[index] = [offset, length] where
|
Definition at line 36 of file utilities.py.
def apg_py.lib.utilities.tuple_to_ascii_underline | ( | map, | |
index | |||
) |
Uses the (optional) map generated by tuple_to_ascii() to generate a mapping of the display characters to the actual tuple (integer) characters.
Used mainly for error reporting in the syntax phase.
map | A list of [offset, length] lists, one for each tuple character that indicates the offset into the ASCII display. and the length of the display of that specific character. |
index | The index of the underlying tuple character to accent. |
Definition at line 85 of file utilities.py.
def apg_py.lib.utilities.tuple_to_string | ( | input | ) |
Converts a tuple of Unicode values to the equivalent string.
input | The tuple of Unicode values to convert. |
Definition at line 25 of file utilities.py.