# HG changeset patch # User catherine@dellzilla # Date 1227216851 18000 # Node ID 01ad9cd681a7c825762495599ee4c2430754ee3c # Parent cda32481187cbe3eaa86638eb8bd80521fe0ea52 all but ignore seems to work diff -r cda32481187c -r 01ad9cd681a7 cmd2.py --- 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):