comparison cmd2.py @ 151:2377461a35f3

bug is in Combine() - removed it
author catherine@Elli.myhome.westell.com
date Fri, 21 Nov 2008 06:14:25 -0500
parents 01ad9cd681a7
children 693d11072e8e
comparison
equal deleted inserted replaced
150:cc569f68a478 151:2377461a35f3
233 >>> print c.p2('ignore the /* commented | > */ stuff;').dump() 233 >>> print c.p2('ignore the /* commented | > */ stuff;').dump()
234 ''' 234 '''
235 outputParser = pyparsing.oneOf(['>>','>'])('output') 235 outputParser = pyparsing.oneOf(['>>','>'])('output')
236 terminatorParser = pyparsing.oneOf(self.terminators)('terminator') 236 terminatorParser = pyparsing.oneOf(self.terminators)('terminator')
237 (pyparsing.stringEnd ^ pyparsing.oneOf(self.terminators) ^ '\nEOF' ^ '|' ^ outputParser)('terminator') 237 (pyparsing.stringEnd ^ pyparsing.oneOf(self.terminators) ^ '\nEOF' ^ '|' ^ outputParser)('terminator')
238 statementParser = pyparsing.Combine(pyparsing.Word(pyparsing.printables)('command') + 238 statementParser = (pyparsing.Word(pyparsing.printables)('command') +
239 pyparsing.SkipTo(terminatorParser ^ '\nEOF' ^ '|' ^ outputParser ^ pyparsing.stringEnd)('args') + 239 pyparsing.SkipTo(terminatorParser ^ '\nEOF' ^ '|' ^ outputParser ^ pyparsing.stringEnd)('args') +
240 pyparsing.Optional(terminatorParser) 240 pyparsing.Optional(terminatorParser)
241 )('statement') 241 )('statement')
242 self.commentGrammars.ignore(pyparsing.sglQuotedString).ignore(pyparsing.dblQuotedString).setParseAction(lambda x: '') 242 self.commentGrammars.ignore(pyparsing.sglQuotedString).ignore(pyparsing.dblQuotedString).setParseAction(lambda x: '')
243 self.commentInProgress.ignore(pyparsing.sglQuotedString).ignore(pyparsing.dblQuotedString).ignore(pyparsing.cStyleComment) 243 self.commentInProgress.ignore(pyparsing.sglQuotedString).ignore(pyparsing.dblQuotedString).ignore(pyparsing.cStyleComment)
244 parser = statementParser + \ 244 parser = statementParser + \
245 pyparsing.SkipTo(outputParser ^ '|' ^ pyparsing.stringEnd)('suffix') + \ 245 pyparsing.SkipTo(outputParser ^ '|' ^ pyparsing.stringEnd)('suffix') + \
246 pyparsing.Optional('|' + pyparsing.SkipTo(outputParser ^ pyparsing.stringEnd)('pipeDest')) + \ 246 pyparsing.Optional('|' + pyparsing.SkipTo(outputParser ^ pyparsing.stringEnd)('pipeDest')) + \