changeset 148:01ad9cd681a7

all but ignore seems to work
author catherine@dellzilla
date Thu, 20 Nov 2008 16:34:11 -0500
parents cda32481187c
children 17fa16ca8329
files cmd2.py
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/cmd2.py	Thu Nov 20 14:49:15 2008 -0500
+++ b/cmd2.py	Thu Nov 20 16:34:11 2008 -0500
@@ -230,7 +230,7 @@
         >>> print c.p2('output into > afile.txt').dump()
         >>> print c.p2('output into;sufx | pipethrume plz > afile.txt').dump()
         >>> print c.p2('output to paste buffer >> ').dump()
-        >>> print c.p2('ignore the /* commented | > */ stuff;')
+        >>> print c.p2('ignore the /* commented | > */ stuff;').dump()
         '''        
         outputParser = pyparsing.oneOf(['>>','>'])('output')
         terminatorParser = pyparsing.oneOf(self.terminators)('terminator')
@@ -239,13 +239,13 @@
                                             pyparsing.SkipTo(terminatorParser ^ '\nEOF' ^ '|' ^ outputParser ^ pyparsing.stringEnd)('args') +
                                             pyparsing.Optional(terminatorParser)
                                            )('statement')
+        self.commentGrammars.ignore(pyparsing.sglQuotedString).ignore(pyparsing.dblQuotedString).setParseAction(lambda x: '')
+        self.commentInProgress.ignore(pyparsing.sglQuotedString).ignore(pyparsing.dblQuotedString).ignore(pyparsing.cStyleComment)       
         parser = statementParser + \
                  pyparsing.SkipTo(outputParser ^ '|' ^ pyparsing.stringEnd)('suffix') + \
                  pyparsing.Optional('|' + pyparsing.SkipTo(outputParser ^ pyparsing.stringEnd)('pipeDest')) + \
                  pyparsing.Optional(outputParser + pyparsing.SkipTo(pyparsing.stringEnd)('outputDest'))
-        self.commentGrammars.ignore(pyparsing.sglQuotedString).ignore(pyparsing.dblQuotedString).setParseAction(lambda x: '')
-        self.commentInProgress.ignore(pyparsing.sglQuotedString).ignore(pyparsing.dblQuotedString).ignore(pyparsing.cStyleComment)       
-        parser.ignore(pyparsing.sglQuotedString).ignore(pyparsing.dblQuotedString).ignore(self.commentGrammars).ignore(self.commentInProgress)
+        parser.ignore(pyparsing.sglQuotedString).ignore(pyparsing.dblQuotedString).ignore(self.commentGrammars).ignore(self.commentInProgress)        
         return parser.parseString(s)
         
     def parsed(self, s, assumeComplete=False):