diff cmd2.py @ 140:e49ded85ba4c

keeping comments in history now
author catherine@Elli.myhome.westell.com
date Thu, 13 Nov 2008 15:40:59 -0500
parents 4b428849783d
children fc31b73cb04d
line wrap: on
line diff
--- a/cmd2.py	Thu Nov 13 12:41:48 2008 -0500
+++ b/cmd2.py	Thu Nov 13 15:40:59 2008 -0500
@@ -26,7 +26,7 @@
 """
 import cmd, re, os, sys, optparse, subprocess, tempfile, pyparsing, doctest, unittest
 from optparse import make_option
-__version__ = '0.4.2'
+__version__ = '0.4.4'
 
 class OptionParser(optparse.OptionParser):
     def exit(self, status=0, msg=None):
@@ -244,14 +244,14 @@
         '''
         if isinstance(s, pyparsing.ParseResults):
             return s
-        s = self.commentGrammars.transformString(s)
         result = (pyparsing.SkipTo(pyparsing.StringEnd()))("fullStatement").parseString(s)
+        s = self.commentGrammars.transformString(s)        
         command = s.split()[0]
         if self.caseInsensitive:
             command = command.lower()
         result['command'] = command
         if command in self.noSpecialParse:
-            result['statement'] = result.fullStatement
+            result['statement'] = s
             return result
         
         if s[0] in self.shortcuts:
@@ -266,10 +266,10 @@
             result['unterminated'] = result.before
             result['parseable'] = result.after
         else:
+            result['statement'] = result['unterminated'] = result.before
             if command in self.multilineCommands:
                 return result # don't bother with the rest, we're still collecting input
             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)