# HG changeset patch # User catherine@dellzilla # Date 1227130605 18000 # Node ID 0e0fc729e1a26e6de2d9a5e0205cc4a366f15723 # Parent 2d3477aa79d43d5f09a72571d3cffdd4d375785f accept special terminators on most anything diff -r 2d3477aa79d4 -r 0e0fc729e1a2 cmd2.py --- a/cmd2.py Tue Nov 18 18:06:05 2008 -0500 +++ b/cmd2.py Wed Nov 19 16:36:45 2008 -0500 @@ -221,7 +221,7 @@ + pyparsing.Optional(filenamePattern)('inputFrom') punctuationPattern = pipePattern ^ redirectInPattern ^ redirectOutPattern - def parsed(self, s): + def parsed(self, s, assumeComplete=False): ''' >>> c = Cmd() >>> r = c.parsed('quotes "are > ignored" < inp.txt') @@ -265,10 +265,10 @@ result['parseable'] = result.after else: # does not catch output marks - if command in self.multilineCommands: + if (not assumeComplete) and (command in self.multilineCommands): return result # don't bother with the rest, we're still collecting input + result['statement'] = result['unterminated'] = result.before result += parseSearchResults(self.punctuationPattern, s) - result['statement'] = result['unterminated'] = result.before result += parseSearchResults(self.pipePattern, result.parseable) result += parseSearchResults(self.redirectInPattern, result.parseable) result += parseSearchResults(self.redirectOutPattern, result.parseable)