diff options
Diffstat (limited to 'libraries/base/tests/enum_processor.py')
-rwxr-xr-x | libraries/base/tests/enum_processor.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/libraries/base/tests/enum_processor.py b/libraries/base/tests/enum_processor.py new file mode 100755 index 0000000000..86c3d6c94a --- /dev/null +++ b/libraries/base/tests/enum_processor.py @@ -0,0 +1,24 @@ +#!/usr/bin/env python + +import sys + +def process(s): + while True: + start = s.find('printTest') + if start == -1: + return s + j0 = j = s.index('(', start) + 1 + depth = 1 + while depth > 0: + if s[j] == '(': + depth += 1 + if s[j] == ')': + depth -= 1 + j += 1 + argument = s[j0:j-1] + expansion = '(do{ putStr ( " " ++ "%s" ++ " = " ) ; print (%s) })' \ + % (argument, argument) + s = s[:start] + expansion + s[j:] + +_, _, inputFile, outputFile = sys.argv +open(outputFile, 'w').write(process(open(inputFile, 'r').read())) |