diff cmd2.py @ 172:c01f8e612a0a

\n\n finally works
author catherine@dellzilla
date Fri, 12 Dec 2008 10:14:01 -0500
parents 0b93f1a4076c
children 10a45c030364
line wrap: on
line diff
--- a/cmd2.py	Fri Dec 12 09:54:08 2008 -0500
+++ b/cmd2.py	Fri Dec 12 10:14:01 2008 -0500
@@ -387,11 +387,11 @@
         if self.caseInsensitive:
             multilineCommand.setParseAction(lambda x: x[0].lower())
             oneLineCommand.setParseAction(lambda x: x[0].lower())
-        blankLineTerminator = (pyparsing.Literal('\n') + pyparsing.stringEnd)('terminator')
         if self.blankLinesAllowed:
             subparser0 = pyparsing.NoMatch
         else:
-            subparser0 = ((multilineCommand ^ oneLineCommand) + pyparsing.SkipTo(blankLineTerminator).setParseAction(lambda x: x[0].strip())('args') + terminatorParser)('statement')
+            blankLineTerminator = (pyparsing.Literal('\n') + pyparsing.stringEnd)('terminator')        
+            subparser0 = ((multilineCommand ^ oneLineCommand) + pyparsing.SkipTo(blankLineTerminator).setParseAction(lambda x: x[0].strip())('args') + blankLineTerminator)('statement')
         subparser1 = (((multilineCommand ^ oneLineCommand) + pyparsing.SkipTo(terminatorParser).setParseAction(lambda x: x[0].strip())('args') + terminatorParser)('statement') +
              pyparsing.SkipTo(outputParser ^ pipe ^ stringEnd).setParseAction(lambda x: x[0].strip())('suffix') + afterElements)
         #subparser1 = (((multilineCommand ^ oneLineCommand) + pyparsing.SkipTo(terminatorParser).setParseAction(lambda x: x[0].strip())('args') + terminatorParser)('statement') +