##// END OF EJS Templates
Merge pull request #7585 from abalkin/issue-7548-3...
Thomas Kluyver -
r20150:35a25f19 merge
parent child Browse files
Show More
@@ -57,7 +57,8 b' ipython_tokens = ['
57 57 using(BashLexer), Text)),
58 58 (r'(%)(\w+)(.*\n)', bygroups(Operator, Keyword, Text)),
59 59 (r'^(!!)(.+)(\n)', bygroups(Operator, using(BashLexer), Text)),
60 (r'(!)(.+)(\n)', bygroups(Operator, using(BashLexer), Text)),
60 (r'(!)(?!=)(.+)(\n)', bygroups(Operator, using(BashLexer), Text)),
61 (r'^(\s*)(\?\??)(\s*%{0,2}[\w\.\*]*)', bygroups(Text, Operator, Text)),
61 62 ]
62 63
63 64 def build_ipy_lexer(python3):
@@ -109,3 +109,23 b' class TestLexers(TestsBase):'
109 109 (Token.Text, '\n'),
110 110 ]
111 111 self.assertEqual(tokens_2, list(self.lexer.get_tokens(fragment_2)))
112
113 fragment_2 = 'x != y\n'
114 tokens_2 = [
115 (Token.Name, 'x'),
116 (Token.Text, ' '),
117 (Token.Operator, '!='),
118 (Token.Text, ' '),
119 (Token.Name, 'y'),
120 (Token.Text, '\n'),
121 ]
122 self.assertEqual(tokens_2, list(self.lexer.get_tokens(fragment_2)))
123
124 fragment_2 = ' ?math.sin\n'
125 tokens_2 = [
126 (Token.Text, ' '),
127 (Token.Operator, '?'),
128 (Token.Text, 'math.sin'),
129 (Token.Text, '\n'),
130 ]
131 self.assertEqual(tokens_2, list(self.lexer.get_tokens(fragment_2)))
General Comments 0
You need to be logged in to leave comments. Login now