Mercurial > python-cmd2
comparison cmd2.py @ 250:ff541573fb5b
unit tests pass
author | catherine@Elli.myhome.westell.com |
---|---|
date | Mon, 30 Mar 2009 13:20:05 -0400 |
parents | 55a12d77a4fa |
children | bc6dec08275f |
comparison
equal
deleted
inserted
replaced
249:55a12d77a4fa | 250:ff541573fb5b |
---|---|
500 self.blankLineTerminator = (pyparsing.lineEnd + pyparsing.lineEnd)('terminator') | 500 self.blankLineTerminator = (pyparsing.lineEnd + pyparsing.lineEnd)('terminator') |
501 self.blankLineTerminator.setResultsName('terminator') | 501 self.blankLineTerminator.setResultsName('terminator') |
502 self.blankLineTerminationParser = ((self.multilineCommand ^ oneLineCommand) + pyparsing.SkipTo(self.blankLineTerminator).setParseAction(lambda x: x[0].strip())('args') + self.blankLineTerminator)('statement') | 502 self.blankLineTerminationParser = ((self.multilineCommand ^ oneLineCommand) + pyparsing.SkipTo(self.blankLineTerminator).setParseAction(lambda x: x[0].strip())('args') + self.blankLineTerminator)('statement') |
503 self.multilineParser = (((self.multilineCommand ^ oneLineCommand) + SkipToLast(terminatorParser).setParseAction(lambda x: x[0].strip())('args') + terminatorParser)('statement') + | 503 self.multilineParser = (((self.multilineCommand ^ oneLineCommand) + SkipToLast(terminatorParser).setParseAction(lambda x: x[0].strip())('args') + terminatorParser)('statement') + |
504 pyparsing.SkipTo(outputParser ^ pipe ^ stringEnd).setParseAction(lambda x: x[0].strip())('suffix') + afterElements) | 504 pyparsing.SkipTo(outputParser ^ pipe ^ stringEnd).setParseAction(lambda x: x[0].strip())('suffix') + afterElements) |
505 self.multilineParser.ignore(self.commentInProgress) | |
505 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') + |
506 pyparsing.Optional(terminatorParser) + afterElements) | 507 pyparsing.Optional(terminatorParser) + afterElements) |
507 self.multilineParser = self.multilineParser.setResultsName('multilineParser') | 508 #self.multilineParser = self.multilineParser.setResultsName('multilineParser') |
508 self.multilineParser.ignore(self.commentInProgress) | 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 = ( |
512 stringEnd | | 512 stringEnd | |
513 self.prefixParser + self.multilineParser | | 513 self.prefixParser + self.multilineParser | |
514 self.prefixParser + self.singleLineParser | | 514 self.prefixParser + self.singleLineParser | |
515 self.prefixParser + self.blankLineTerminationParser | | 515 self.prefixParser + self.blankLineTerminationParser | |