ThirdParty/Pygments/pygments/lexers/julia.py

changeset 5072
aab59042fefb
parent 4697
c2e9bf425554
child 5713
6762afd9f963
diff -r 4e4651e88674 -r aab59042fefb ThirdParty/Pygments/pygments/lexers/julia.py
--- a/ThirdParty/Pygments/pygments/lexers/julia.py	Wed Jul 27 18:10:08 2016 +0200
+++ b/ThirdParty/Pygments/pygments/lexers/julia.py	Fri Jul 29 19:50:40 2016 +0200
@@ -65,7 +65,7 @@
                 bygroups(Keyword, Name.Function), 'funcname'),
 
             # types
-            (r'(type|typealias|abstract)((?:\s|\\\s)+)',
+            (r'(type|typealias|abstract|immutable)((?:\s|\\\s)+)',
                 bygroups(Keyword, Name.Class), 'typename'),
 
             # operators
@@ -132,14 +132,23 @@
         'string': [
             (r'"', String, '#pop'),
             (r'\\\\|\\"|\\\n', String.Escape),  # included here for raw strings
-            (r'\$(\(\w+\))?[-#0 +]*([0-9]+|[*])?(\.([0-9]+|[*]))?',
-                String.Interpol),
-            (r'[^\\"$]+', String),
-            # quotes, dollar signs, and backslashes must be parsed one at a time
-            (r'["\\]', String),
-            # unhandled string formatting sign
-            (r'\$', String)
+            # Interpolation is defined as "$" followed by the shortest full
+            # expression, which is something we can't parse.
+            # Include the most common cases here: $word, and $(paren'd expr).
+            (r'\$[a-zA-Z_]+', String.Interpol),
+            (r'\$\(', String.Interpol, 'in-intp'),
+            # @printf and @sprintf formats
+            (r'%[-#0 +]*([0-9]+|[*])?(\.([0-9]+|[*]))?[hlL]?[diouxXeEfFgGcrs%]',
+             String.Interpol),
+            (r'[^$%"\\]+', String),
+            # unhandled special signs
+            (r'[$%"\\]', String),
         ],
+        'in-intp': [
+            (r'[^()]+', String.Interpol),
+            (r'\(', String.Interpol, '#push'),
+            (r'\)', String.Interpol, '#pop'),
+        ]
     }
 
     def analyse_text(text):

eric ide

mercurial