##// END OF EJS Templates
Fix subtle regular expression bug to treat '%foo?' correctly.
Fernando Perez -
Show More
@@ -506,7 +506,8 b' class InputSplitter(object):'
506 line_split = re.compile("""
506 line_split = re.compile("""
507 ^(\s*) # any leading space
507 ^(\s*) # any leading space
508 ([,;/%]|!!?|\?\??) # escape character or characters
508 ([,;/%]|!!?|\?\??) # escape character or characters
509 \s*([\w\.]*) # function/method part (mix of \w and '.')
509 \s*(%?[\w\.]*) # function/method, possibly with leading %
510 # to correctly treat things like '?%magic'
510 (\s+.*$|$) # rest of line
511 (\s+.*$|$) # rest of line
511 """, re.VERBOSE)
512 """, re.VERBOSE)
512
513
@@ -551,6 +552,8 b' def split_user_input(line):'
551 ('', '', 'f.g(x)', '')
552 ('', '', 'f.g(x)', '')
552 >>> split_user_input('f.g (x)')
553 >>> split_user_input('f.g (x)')
553 ('', '', 'f.g', '(x)')
554 ('', '', 'f.g', '(x)')
555 >>> split_user_input('?%hist')
556 ('', '?', '%hist', '')
554 """
557 """
555 match = line_split.match(line)
558 match = line_split.match(line)
556 if match:
559 if match:
@@ -443,6 +443,7 b' syntax = \\'
443 ('??x2', 'get_ipython().magic("pinfo2 x2")'),
443 ('??x2', 'get_ipython().magic("pinfo2 x2")'),
444 ('x3?', 'get_ipython().magic("pinfo x3")'),
444 ('x3?', 'get_ipython().magic("pinfo x3")'),
445 ('x4??', 'get_ipython().magic("pinfo2 x4")'),
445 ('x4??', 'get_ipython().magic("pinfo2 x4")'),
446 ('%hist?', 'get_ipython().magic("pinfo %hist")'),
446 ],
447 ],
447
448
448 # Explicit magic calls
449 # Explicit magic calls
General Comments 0
You need to be logged in to leave comments. Login now