Mercurial > python-cmd2
comparison cmd2.py @ 94:414a78c16ce9
fixed paren bug in terminatorPattern resultsName
author | catherine@dellzilla |
---|---|
date | Wed, 24 Sep 2008 18:00:22 -0400 |
parents | 88f2aa240af1 |
children | 199a08e3ae72 |
comparison
equal
deleted
inserted
replaced
93:f54e3e842f21 | 94:414a78c16ce9 |
---|---|
191 def do_shortcuts(self, args): | 191 def do_shortcuts(self, args): |
192 """Lists single-key shortcuts available.""" | 192 """Lists single-key shortcuts available.""" |
193 result = "\n".join('%s: %s' % (sc[0], sc[1]) for sc in self.shortcuts.items()) | 193 result = "\n".join('%s: %s' % (sc[0], sc[1]) for sc in self.shortcuts.items()) |
194 self.stdout.write("Single-key shortcuts for other commands:\n%s\n" % (result)) | 194 self.stdout.write("Single-key shortcuts for other commands:\n%s\n" % (result)) |
195 | 195 |
196 terminatorPattern = (pyparsing.Literal(';') ^ pyparsing.Literal('\n\n')) \ | 196 terminatorPattern = ((pyparsing.Literal(';') ^ pyparsing.Literal('\n\n')) |
197 ^ (pyparsing.Literal('\nEOF') + pyparsing.lineEnd) ('terminator') | 197 ^ (pyparsing.Literal('\nEOF') + pyparsing.lineEnd))('terminator') |
198 argSeparatorPattern = pyparsing.Word(pyparsing.printables)('command') \ | 198 argSeparatorPattern = pyparsing.Word(pyparsing.printables)('command') \ |
199 + pyparsing.SkipTo(pyparsing.StringEnd())('args') | 199 + pyparsing.SkipTo(pyparsing.StringEnd())('args') |
200 filenamePattern = pyparsing.Word(pyparsing.alphanums + '#$-_~{},.!:\\/') | 200 filenamePattern = pyparsing.Word(pyparsing.alphanums + '#$-_~{},.!:\\/') |
201 integerPattern = pyparsing.Word(pyparsing.nums).setParseAction( lambda s,l,t: [ int(t[0]) ] ) | 201 integerPattern = pyparsing.Word(pyparsing.nums).setParseAction( lambda s,l,t: [ int(t[0]) ] ) |
202 pipePattern = pyparsing.Literal('|')('pipe') + pyparsing.restOfLine('pipeTo') | 202 pipePattern = pyparsing.Literal('|')('pipe') + pyparsing.restOfLine('pipeTo') |