Commits

Anonymous committed cf85ae0

[svn] Implement goto label support for C, C++, Delphi.

Comments (0)

Files changed (3)

 Todo
 ====
 
-before 0.5
-----------
+for 0.5
+-------
 
 - improve guess_lexer heuristics (esp. for template langs)
 
-- more unit tests
-
-- goto label HL support for languages that use it
-
 for 0.6
 -------
 
+- more unit tests
+
 - allow "overlay" token types (e.g. Diff + X) 
   - highlight specials: nth line, a word etc.
   - dhtml: overlays toggleable by javascript

pygments/lexers/compiled.py

             (r'__(asm|int8|based|except|int16|stdcall|cdecl|fastcall|int32|'
              r'declspec|finally|int64|try|leave)\b', Keyword.Reserved),
             (r'(true|false|NULL)\b', Keyword.Constant),
+            ('[a-zA-Z_][a-zA-Z0-9_]*:', Name.Label),
             ('[a-zA-Z_][a-zA-Z0-9_]*', Name),
         ],
         'root': [
              r'multiple_inheritance|m128i|m128d|m128|m64|interface|'
              r'identifier|forceinline|event|assume)\b', Keyword.Reserved),
             (r'(true|false|NULL)\b', Keyword.Constant),
+            ('[a-zA-Z_][a-zA-Z0-9_]*:', Name.Label),
             ('[a-zA-Z_][a-zA-Z0-9_]*', Name),
         ],
         'classname': [
             (r'\#\$?[0-9]{1,3}', Number),
             (r'[0-9]', Number),
             (r'[@~!%^&*()+=|\[\]:;,.<>/?-]', Text),
-            (r'[a-zA-Z_][a-zA-Z0-9_]*', Name)
+            (r'[a-zA-Z_][a-zA-Z0-9_]*:', Name.Label),
+            (r'[a-zA-Z_][a-zA-Z0-9_]*', Name),
         ],
         'uses': [
             (r'[a-zA-Z_][a-zA-Z0-9_.]*', Name.Namespace),
             (r'(class)(\s+)', bygroups(Keyword, Text), 'class'),
             (r'"(\\\\|\\"|[^"])*"', String),
             (r"'\\.'|'[^\\]'|'\\u[0-9a-f]{4}'", String.Char),
+            (r'[a-zA-Z_][a-zA-Z0-9_]*:', Name.Label),
             (r'[a-zA-Z_\$][a-zA-Z0-9_]*', Name),
             (r'[~\^\*!%&\[\]\(\)\{\}<>\|+=:;,./?-]', Operator),
             (r'[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?', Number),

pygments/lexers/special.py

                 ttypestr, val = match.group().split('\t', 1)
             except ValueError:
                 val = match.group()
-                ttype = Error 
+                ttype = Error
             else:
                 ttype = _ttype_cache.get(ttypestr)
                 if not ttype: