Mercurial > python-cmd2
comparison cmd2/cmd2.py @ 108:f7b0152c57f9
cmd2 test working
author | catherine@dellzilla |
---|---|
date | Fri, 24 Oct 2008 16:38:25 -0400 |
parents | 3e2651cbe376 |
children | 78c4db4c2045 |
comparison
equal
deleted
inserted
replaced
107:3e2651cbe376 | 108:f7b0152c57f9 |
---|---|
725 self.bookmark = 0 | 725 self.bookmark = 0 |
726 def refreshCommandFinder(self): | 726 def refreshCommandFinder(self): |
727 prompt = pyparsing.Suppress(pyparsing.lineStart + self.cmdapp.prompt) | 727 prompt = pyparsing.Suppress(pyparsing.lineStart + self.cmdapp.prompt) |
728 continuationPrompt = pyparsing.Suppress(pyparsing.lineStart + self.cmdapp.continuationPrompt) | 728 continuationPrompt = pyparsing.Suppress(pyparsing.lineStart + self.cmdapp.continuationPrompt) |
729 self.cmdtxtPattern = (prompt + pyparsing.restOfLine + pyparsing.ZeroOrMore( | 729 self.cmdtxtPattern = (prompt + pyparsing.restOfLine + pyparsing.ZeroOrMore( |
730 pyparsing.lineEnd + continuationPrompt + pyparsing.restOfLine))("command") | 730 pyparsing.lineEnd + continuationPrompt + pyparsing.restOfLine))("command") |
731 | |
732 pass | |
731 def inputGenerator(self): | 733 def inputGenerator(self): |
732 while True: | 734 while True: |
733 self.refreshCommandFinder() | 735 self.refreshCommandFinder() |
734 (thiscmd, startpos, endpos) = self.cmdtxtPattern.scanString(self.transcript[self.bookmark:], maxMatches=1).next() | 736 (thiscmd, startpos, endpos) = self.cmdtxtPattern.scanString(self.transcript[self.bookmark:], maxMatches=1).next() |
735 lineNum = self.transcript.count('\n', 0, self.bookmark+startpos) + 2 | 737 lineNum = self.transcript.count('\n', 0, self.bookmark+startpos) + 2 |