##// END OF EJS Templates
#7558: Simplified handling of the ! escape.
Lev Abalkin -
Show More
@@ -53,11 +53,8 ipython_tokens = [
53 (r'(%)(sx|sc|system)(.*)(\n)', bygroups(Operator, Keyword,
53 (r'(%)(sx|sc|system)(.*)(\n)', bygroups(Operator, Keyword,
54 using(BashLexer), Text)),
54 using(BashLexer), Text)),
55 (r'(%)(\w+)(.*\n)', bygroups(Operator, Keyword, Text)),
55 (r'(%)(\w+)(.*\n)', bygroups(Operator, Keyword, Text)),
56 (r'^(!)(.+)(\n)', bygroups(Operator, using(BashLexer), Text)),
56 (r'^(!!)(.+)(\n)', bygroups(Operator, using(BashLexer), Text)),
57 (r'^(.+)(=)(\s*)(!)(.+)(\n)', bygroups(
57 (r'(!)(.+)(\n)', bygroups(Operator, using(BashLexer), Text)),
58 # With the limited syntax allowed on the l.h.s. of a shell capture,
59 # we don't need to differentiate between Python 2 and 3.
60 using(Python3Lexer), Operator, Text, Operator, using(BashLexer), Text)),
61 ]
58 ]
62
59
63 def build_ipy_lexer(python3):
60 def build_ipy_lexer(python3):
@@ -34,6 +34,12 class TestLexers(TestsBase):
34 ]
34 ]
35 self.assertEqual(tokens, list(self.lexer.get_tokens(fragment)))
35 self.assertEqual(tokens, list(self.lexer.get_tokens(fragment)))
36
36
37 fragment_2 = '!' + fragment
38 tokens_2 = [
39 (Token.Operator, '!!'),
40 ] + tokens[1:]
41 self.assertEqual(tokens_2, list(self.lexer.get_tokens(fragment_2)))
42
37 fragment_2 = 'x = ' + fragment
43 fragment_2 = 'x = ' + fragment
38 tokens_2 = [
44 tokens_2 = [
39 (Token.Name, 'x'),
45 (Token.Name, 'x'),
General Comments 0
You need to be logged in to leave comments. Login now