comparison cmd2.py @ 195:455ebe415d5e 0.4.6

do not interpret => as having the redirector >
author catherine@dellzilla
date Wed, 25 Feb 2009 14:00:43 -0500
parents 5bf878c5c0e8
children 770c77152051
comparison
equal deleted inserted replaced
194:5bf878c5c0e8 195:455ebe415d5e
368 - args: command ends 368 - args: command ends
369 - multilineCommand: multiline 369 - multilineCommand: multiline
370 - terminator: ['\n', '\n'] 370 - terminator: ['\n', '\n']
371 - terminator: ['\n', '\n'] 371 - terminator: ['\n', '\n']
372 ''' 372 '''
373 outputParser = pyparsing.oneOf(['>>','>'])('output') 373 #outputParser = pyparsing.oneOf(['>>','>'])('output')
374 outputParser = (pyparsing.Literal('>>') | (pyparsing.WordStart() + '>') | pyparsing.Regex('[^=]>'))('output')
375
374 terminatorParser = pyparsing.Or([(hasattr(t, 'parseString') and t) or pyparsing.Literal(t) for t in self.terminators])('terminator') 376 terminatorParser = pyparsing.Or([(hasattr(t, 'parseString') and t) or pyparsing.Literal(t) for t in self.terminators])('terminator')
375 stringEnd = pyparsing.stringEnd ^ '\nEOF' 377 stringEnd = pyparsing.stringEnd ^ '\nEOF'
376 self.multilineCommand = pyparsing.Or([pyparsing.Keyword(c, caseless=self.caseInsensitive) for c in self.multilineCommands])('multilineCommand') 378 self.multilineCommand = pyparsing.Or([pyparsing.Keyword(c, caseless=self.caseInsensitive) for c in self.multilineCommands])('multilineCommand')
377 oneLineCommand = (~self.multilineCommand + pyparsing.Word(self.legalChars))('command') 379 oneLineCommand = (~self.multilineCommand + pyparsing.Word(self.legalChars))('command')
378 pipe = pyparsing.Keyword('|', identChars='|') 380 pipe = pyparsing.Keyword('|', identChars='|')