# HG changeset patch # User catherine@dellzilla # Date 1236028958 18000 # Node ID 5d22be6d2f88c48b331ff2aaf1754421f69f9aec # Parent 68a609fc516b1d5df4fd25995f6fea6b1f8ec643 v1.6.0 diff -r 68a609fc516b -r 5d22be6d2f88 cmd2.py --- 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): diff -r 68a609fc516b -r 5d22be6d2f88 setup.py --- a/setup.py Mon Mar 02 14:53:27 2009 -0500 +++ b/setup.py Mon Mar 02 16:22:38 2009 -0500 @@ -3,7 +3,7 @@ setup( name="cmd2", - version="0.4.6", + version="0.4.7", py_modules=["cmd2",], # metadata for upload to PyPI