Mercurial > python-cmd2
comparison cmd2.py @ 266:584f970ca66a
permit bare prefix
author | Catherine Devlin <catherine.devlin@gmail.com> |
---|---|
date | Wed, 08 Apr 2009 17:02:13 -0400 |
parents | ba45c2df855b |
children | 194160b7f091 |
comparison
equal
deleted
inserted
replaced
265:ba45c2df855b | 266:584f970ca66a |
---|---|
506 self.singleLineParser = ((oneLineCommand + pyparsing.SkipTo(terminatorParser ^ stringEnd ^ pipe ^ outputParser).setParseAction(lambda x:x[0].strip())('args'))('statement') + | 506 self.singleLineParser = ((oneLineCommand + pyparsing.SkipTo(terminatorParser ^ stringEnd ^ pipe ^ outputParser).setParseAction(lambda x:x[0].strip())('args'))('statement') + |
507 pyparsing.Optional(terminatorParser) + afterElements) | 507 pyparsing.Optional(terminatorParser) + afterElements) |
508 #self.multilineParser = self.multilineParser.setResultsName('multilineParser') | 508 #self.multilineParser = self.multilineParser.setResultsName('multilineParser') |
509 #self.singleLineParser = self.singleLineParser.setResultsName('singleLineParser') | 509 #self.singleLineParser = self.singleLineParser.setResultsName('singleLineParser') |
510 #self.blankLineTerminationParser = self.blankLineTerminationParser.setResultsName('blankLineTerminatorParser') | 510 #self.blankLineTerminationParser = self.blankLineTerminationParser.setResultsName('blankLineTerminatorParser') |
511 self.parser = ( | 511 self.parser = self.prefixParser + ( |
512 stringEnd | | 512 stringEnd | |
513 self.prefixParser + self.multilineParser | | 513 self.multilineParser | |
514 self.prefixParser + self.singleLineParser | | 514 self.singleLineParser | |
515 self.prefixParser + self.blankLineTerminationParser | | 515 self.blankLineTerminationParser | |
516 self.prefixParser + self.multilineCommand + pyparsing.SkipTo(stringEnd) | 516 self.multilineCommand + pyparsing.SkipTo(stringEnd) |
517 ) | 517 ) |
518 self.parser.ignore(pyparsing.quotedString).ignore(self.commentGrammars) | 518 self.parser.ignore(pyparsing.quotedString).ignore(self.commentGrammars) |
519 | 519 |
520 inputMark = pyparsing.Literal('<') | 520 inputMark = pyparsing.Literal('<') |
521 inputMark.setParseAction(lambda x: '') | 521 inputMark.setParseAction(lambda x: '') |