summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgbrandl <devnull@localhost>2006-10-30 10:21:18 +0100
committergbrandl <devnull@localhost>2006-10-30 10:21:18 +0100
commita8fdbfc1e96a22fad673e6170822518a292eaf98 (patch)
tree5ae25bb83f1b062f7096a30f32a81ff8a0f887f7
parent1c4e080bb82d27c914a763ae9ef0667dcc6031c1 (diff)
downloadpygments-a8fdbfc1e96a22fad673e6170822518a292eaf98.tar.gz
[svn] Implement goto label support for C, C++, Delphi.
-rw-r--r--TODO10
-rw-r--r--pygments/lexers/compiled.py6
-rw-r--r--pygments/lexers/special.py2
3 files changed, 10 insertions, 8 deletions
diff --git a/TODO b/TODO
index 6c565025..8ce506c2 100644
--- a/TODO
+++ b/TODO
@@ -1,18 +1,16 @@
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
diff --git a/pygments/lexers/compiled.py b/pygments/lexers/compiled.py
index aa08de90..81da1f04 100644
--- a/pygments/lexers/compiled.py
+++ b/pygments/lexers/compiled.py
@@ -57,6 +57,7 @@ class CLexer(RegexLexer):
(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': [
@@ -154,6 +155,7 @@ class CppLexer(RegexLexer):
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': [
@@ -218,7 +220,8 @@ class DelphiLexer(RegexLexer):
(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),
@@ -305,6 +308,7 @@ class JavaLexer(RegexLexer):
(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),
diff --git a/pygments/lexers/special.py b/pygments/lexers/special.py
index dcf9899c..34e8d88e 100644
--- a/pygments/lexers/special.py
+++ b/pygments/lexers/special.py
@@ -70,7 +70,7 @@ class RawTokenLexer(Lexer):
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: