comparison cmd2.py @ 270:194160b7f091

merged with bare prefix allowance
author Catherine Devlin <catherine.devlin@gmail.com>
date Wed, 08 Apr 2009 18:27:46 -0400
parents 8f68e68033d4 584f970ca66a
children fd40eca6939a d68d83f42254
comparison
equal deleted inserted replaced
269:8f68e68033d4 270:194160b7f091
523 self.singleLineParser = ((oneLineCommand + pyparsing.SkipTo(terminatorParser ^ stringEnd ^ pipe ^ outputParser).setParseAction(lambda x:x[0].strip())('args'))('statement') + 523 self.singleLineParser = ((oneLineCommand + pyparsing.SkipTo(terminatorParser ^ stringEnd ^ pipe ^ outputParser).setParseAction(lambda x:x[0].strip())('args'))('statement') +
524 pyparsing.Optional(terminatorParser) + afterElements) 524 pyparsing.Optional(terminatorParser) + afterElements)
525 #self.multilineParser = self.multilineParser.setResultsName('multilineParser') 525 #self.multilineParser = self.multilineParser.setResultsName('multilineParser')
526 #self.singleLineParser = self.singleLineParser.setResultsName('singleLineParser') 526 #self.singleLineParser = self.singleLineParser.setResultsName('singleLineParser')
527 #self.blankLineTerminationParser = self.blankLineTerminationParser.setResultsName('blankLineTerminatorParser') 527 #self.blankLineTerminationParser = self.blankLineTerminationParser.setResultsName('blankLineTerminatorParser')
528 self.parser = ( 528 self.parser = self.prefixParser + (
529 stringEnd | 529 stringEnd |
530 self.prefixParser + self.multilineParser | 530 self.multilineParser |
531 self.prefixParser + self.singleLineParser | 531 self.singleLineParser |
532 self.prefixParser + self.blankLineTerminationParser | 532 self.blankLineTerminationParser |
533 self.prefixParser + self.multilineCommand + pyparsing.SkipTo(stringEnd) 533 self.multilineCommand + pyparsing.SkipTo(stringEnd)
534 ) 534 )
535 self.parser.ignore(pyparsing.quotedString).ignore(self.commentGrammars) 535 self.parser.ignore(pyparsing.quotedString).ignore(self.commentGrammars)
536 536
537 inputMark = pyparsing.Literal('<') 537 inputMark = pyparsing.Literal('<')
538 inputMark.setParseAction(lambda x: '') 538 inputMark.setParseAction(lambda x: '')