# HG changeset patch # User catherine@dellzilla # Date 1224793245 14400 # Node ID 76737c0535b83bc0713643ad243a1c6efd4500b0 # Parent f5a1d7e7bd592ddfb20331050def5967c6916030 starting to pyparse transcript properly diff -r f5a1d7e7bd59 -r 76737c0535b8 sqlpython/test_sqlpyPlus.py --- a/sqlpython/test_sqlpyPlus.py Thu Oct 23 15:14:46 2008 -0400 +++ b/sqlpython/test_sqlpyPlus.py Thu Oct 23 16:20:45 2008 -0400 @@ -57,4 +57,21 @@ except IndexError: print 'Usage: python %s username/password@oracleSID' % os.path.split(__file__)[-1] sys.exit() -unittest.main() \ No newline at end of file +unittest.main() + + + +transcript = open('test_sqlpyPlus.txt') +transcript = transcript.read() +from pyparsing import * +prompt = lineStart +'testdata@eqdev> ' +continuationPrompt = lineStart + '> ' +command = (Suppress(prompt) + restOfLine + ZeroOrMore(lineEnd + Suppress(continuationPrompt) + restOfLine))("command") +results = command.scanString(transcript) +cmds = [] +laststart = 0 +for result in results: + if len(cmds) > 0: + cmds[-1][1] = transcript[laststart:result[1]] + cmds.append([''.join(result[0].command), transcript[result[2]:]]) + laststart = result[2]