"""This parses the tcl script and calls virtual methods to translate the code to target language.""" import re # Some module variables used internally. token = "[+\-]?[\$0-9A-Za-z_\.{}]+" hexnumber = "0x[0-9abcdefABCDEF]+" number = "[+-]?[0-9]+(?:(?:\.[0-9]+)?(?:e[+-][0-9]+)?)?" number2 = "[+-]?\.[0-9]+(?:e[+-][0-9]+)?" word_separator = "[ \t]" command_separator = "[\n;]" word = "%s*(%s|%s|%s|%s)"% (word_separator, hexnumber, number2, number, token) reWord = re.compile("^%s" % word ) reNewWord = re.compile("^(?:%s|%s)*%s" % (command_separator, word_separator, word)) reCondition = re.compile("%s*([!<>=]+)" % word_separator) reOperation = re.compile("%s*([|&<>=!+\-/%%*()]+)" % word_separator) reStackBegin = re.compile("%s*(?