comparison cmd2.py @ 161:1d1439be0a55

default fix
author catherine@dellzilla
date Mon, 01 Dec 2008 16:26:28 -0500
parents 59b7847ec3ca
children c50615cf814f
comparison
equal deleted inserted replaced
160:59b7847ec3ca 161:1d1439be0a55
404 inputFrom.setParseAction(lambda x: (x and open(x[0]).read()) or getPasteBuffer()) 404 inputFrom.setParseAction(lambda x: (x and open(x[0]).read()) or getPasteBuffer())
405 self.inputParser = inputMark + pyparsing.Optional(inputFrom) 405 self.inputParser = inputMark + pyparsing.Optional(inputFrom)
406 self.inputParser.ignore(pyparsing.sglQuotedString).ignore(pyparsing.dblQuotedString).ignore(self.commentGrammars).ignore(self.commentInProgress) 406 self.inputParser.ignore(pyparsing.sglQuotedString).ignore(pyparsing.dblQuotedString).ignore(self.commentGrammars).ignore(self.commentInProgress)
407 407
408 def parsed(self, raw, useTerminatorFrom=None): 408 def parsed(self, raw, useTerminatorFrom=None):
409 s = self.inputParser.transformString(raw) 409 s = self.inputParser.transformString(raw.strip())
410 for (shortcut, expansion) in self.shortcuts.items(): 410 for (shortcut, expansion) in self.shortcuts.items():
411 if s.startswith(shortcut): 411 if s.startswith(shortcut):
412 s = s.replace(shortcut, expansion + ' ', 1) 412 s = s.replace(shortcut, expansion + ' ', 1)
413 break 413 break
414 result = self.parser.parseString(s) 414 result = self.parser.parseString(s)