##// 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 506 line_split = re.compile("""
507 507 ^(\s*) # any leading space
508 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 511 (\s+.*$|$) # rest of line
511 512 """, re.VERBOSE)
512 513
@@ -551,6 +552,8 b' def split_user_input(line):'
551 552 ('', '', 'f.g(x)', '')
552 553 >>> split_user_input('f.g (x)')
553 554 ('', '', 'f.g', '(x)')
555 >>> split_user_input('?%hist')
556 ('', '?', '%hist', '')
554 557 """
555 558 match = line_split.match(line)
556 559 if match:
@@ -443,6 +443,7 b' syntax = \\'
443 443 ('??x2', 'get_ipython().magic("pinfo2 x2")'),
444 444 ('x3?', 'get_ipython().magic("pinfo x3")'),
445 445 ('x4??', 'get_ipython().magic("pinfo2 x4")'),
446 ('%hist?', 'get_ipython().magic("pinfo %hist")'),
446 447 ],
447 448
448 449 # Explicit magic calls
General Comments 0
You need to be logged in to leave comments. Login now