##// END OF EJS Templates
split_user_input users different pattern for splitting in alias expansion
vivainio -
Show More
@@ -6,7 +6,7 b' Requires Python 2.3 or newer.'
6
6
7 This file contains all the classes and helper functions specific to IPython.
7 This file contains all the classes and helper functions specific to IPython.
8
8
9 $Id: iplib.py 2168 2007-03-23 00:57:04Z fperez $
9 $Id: iplib.py 2172 2007-03-23 14:04:07Z vivainio $
10 """
10 """
11
11
12 #*****************************************************************************
12 #*****************************************************************************
@@ -491,6 +491,11 b' class InteractiveShell(object,Magic):'
491 r'([\?\w\.]+\w*\s*)'
491 r'([\?\w\.]+\w*\s*)'
492 r'(\(?.*$)')
492 r'(\(?.*$)')
493
493
494 self.shell_line_split = re.compile(r'^(\s*)'
495 r'(\S*\s*)'
496 r'(\(?.*$)')
497
498
494 # A simpler regexp used as a fallback if the above doesn't work. This
499 # A simpler regexp used as a fallback if the above doesn't work. This
495 # one is more conservative in how it partitions the input. This code
500 # one is more conservative in how it partitions the input. This code
496 # can probably be cleaned up to do everything with just one regexp, but
501 # can probably be cleaned up to do everything with just one regexp, but
@@ -1701,7 +1706,8 b' want to merge them back into the new files.""" % locals()'
1701
1706
1702 done = Set()
1707 done = Set()
1703 while 1:
1708 while 1:
1704 pre,fn,rest = self.split_user_input(line)
1709 pre,fn,rest = self.split_user_input(line, pattern = self.shell_line_split)
1710 # print "!",fn,"!",rest # dbg
1705 if fn in self.alias_table:
1711 if fn in self.alias_table:
1706 if fn in done:
1712 if fn in done:
1707 warn("Cyclic alias definition, repeated '%s'" % fn)
1713 warn("Cyclic alias definition, repeated '%s'" % fn)
@@ -2020,10 +2026,13 b' want to merge them back into the new files.""" % locals()'
2020 else:
2026 else:
2021 return lineout
2027 return lineout
2022
2028
2023 def split_user_input(self,line):
2029 def split_user_input(self,line, pattern = None):
2024 """Split user input into pre-char, function part and rest."""
2030 """Split user input into pre-char, function part and rest."""
2025
2031
2026 lsplit = self.line_split.match(line)
2032 if pattern is None:
2033 pattern = self.line_split
2034
2035 lsplit = pattern.match(line)
2027 if lsplit is None: # no regexp match returns None
2036 if lsplit is None: # no regexp match returns None
2028 #print "match failed for line '%s'" % line # dbg
2037 #print "match failed for line '%s'" % line # dbg
2029 try:
2038 try:
@@ -1,3 +1,12 b''
1 2007-03-23 Ville Vainio <vivainio@gmail.com>
2
3 * iplib.py: recursive alias expansion now works better, so that
4 cases like 'top' -> 'd:/cygwin/top' -> 'ls :/cygwin/top'
5 doesn't trip up the process, if 'd' has been aliased to 'ls'.
6
7 * Extensions/ipy_gnuglobal.py added, provides %global magic
8 for users of http://www.gnu.org/software/global
9
1 2007-03-23 Fernando Perez <Fernando.Perez@colorado.edu>
10 2007-03-23 Fernando Perez <Fernando.Perez@colorado.edu>
2
11
3 * IPython/FakeModule.py (FakeModule.__init__): Small fix to
12 * IPython/FakeModule.py (FakeModule.__init__): Small fix to
General Comments 0
You need to be logged in to leave comments. Login now