Mercurial > python-cmd2
diff cmd2.py @ 204:5d22be6d2f88 0.4.7
v1.6.0
author | catherine@dellzilla |
---|---|
date | Mon, 02 Mar 2009 16:22:38 -0500 |
parents | 68a609fc516b |
children | 00eaec841567 |
line wrap: on
line diff
--- a/cmd2.py Mon Mar 02 14:53:27 2009 -0500 +++ b/cmd2.py Mon Mar 02 16:22:38 2009 -0500 @@ -27,7 +27,7 @@ import cmd, re, os, sys, optparse, subprocess, tempfile, pyparsing, doctest import unittest, string, datetime from optparse import make_option -__version__ = '0.4.6' +__version__ = '0.4.7' class OptionParser(optparse.OptionParser): def exit(self, status=0, msg=None): @@ -199,6 +199,7 @@ raise exc def replace_with_file_contents(fname): + import pdb; pdb.set_trace() if fname: try: result = open(os.path.expanduser(fname[0])).read() @@ -468,9 +469,13 @@ inputMark = pyparsing.Literal('<') inputMark.setParseAction(lambda x: '') - inputFrom = pyparsing.Word(self.legalChars + '/\\')('inputFrom') + fileName = pyparsing.Word(self.legalChars + '/\\') + inputFrom = fileName('inputFrom') inputFrom.setParseAction(replace_with_file_contents) - self.inputParser = inputMark + pyparsing.Optional(inputFrom) + # a not-entirely-satisfactory way of distinguishing < as in "import from" from < + # as in "lesser than" + self.inputParser = inputMark + pyparsing.Optional(inputFrom) + pyparsing.Optional('>') + \ + pyparsing.Optional(fileName) + (pyparsing.stringEnd | '|') self.inputParser.ignore(pyparsing.quotedString).ignore(self.commentGrammars).ignore(self.commentInProgress) def parsed(self, raw, **kwargs):