ThirdParty/Pygments/pygments/lexers/jvm.py

Sat, 14 Dec 2013 23:44:25 +0100

author
T.Rzepka <Tobias.Rzepka@gmail.com>
date
Sat, 14 Dec 2013 23:44:25 +0100
branch
Py2 comp.
changeset 3145
a9de05d4a22f
parent 2525
8b507a9a2d40
child 4172
4f20dba37ab6
permissions
-rw-r--r--

# __IGNORE_WARNING__ added/ removed.

1705
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1 # -*- coding: utf-8 -*-
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2 """
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
3 pygments.lexers.jvm
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
4 ~~~~~~~~~~~~~~~~~~~
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
5
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
6 Pygments lexers for JVM languages.
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
7
2426
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
8 :copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
1705
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
9 :license: BSD, see LICENSE for details.
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
10 """
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
11
3145
a9de05d4a22f # __IGNORE_WARNING__ added/ removed.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2525
diff changeset
12 from __future__ import unicode_literals
2525
8b507a9a2d40 Script changes: Future import added, super calls modified and unicode behavior for str.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2426
diff changeset
13
1705
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
14 import re
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
15
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
16 from pygments.lexer import Lexer, RegexLexer, include, bygroups, using, \
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
17 this
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
18 from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
19 Number, Punctuation
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
20 from pygments.util import get_choice_opt
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
21 from pygments import unistring as uni
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
22
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
23
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
24 __all__ = ['JavaLexer', 'ScalaLexer', 'GosuLexer', 'GosuTemplateLexer',
2426
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
25 'GroovyLexer', 'IokeLexer', 'ClojureLexer', 'KotlinLexer',
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
26 'XtendLexer', 'AspectJLexer', 'CeylonLexer']
1705
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
27
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
28
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
29 class JavaLexer(RegexLexer):
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
30 """
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
31 For `Java <http://www.sun.com/java/>`_ source code.
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
32 """
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
33
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
34 name = 'Java'
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
35 aliases = ['java']
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
36 filenames = ['*.java']
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
37 mimetypes = ['text/x-java']
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
38
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
39 flags = re.MULTILINE | re.DOTALL
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
40
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
41 tokens = {
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
42 'root': [
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
43 # method names
2426
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
44 (r'^(\s*(?:[a-zA-Z_][a-zA-Z0-9_\.\[\]<>]*\s+)+?)' # return arguments
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
45 r'([a-zA-Z_][a-zA-Z0-9_]*)' # method name
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
46 r'(\s*)(\()', # signature start
1705
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
47 bygroups(using(this), Name.Function, Text, Operator)),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
48 (r'[^\S\n]+', Text),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
49 (r'//.*?\n', Comment.Single),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
50 (r'/\*.*?\*/', Comment.Multiline),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
51 (r'@[a-zA-Z_][a-zA-Z0-9_\.]*', Name.Decorator),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
52 (r'(assert|break|case|catch|continue|default|do|else|finally|for|'
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
53 r'if|goto|instanceof|new|return|switch|this|throw|try|while)\b',
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
54 Keyword),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
55 (r'(abstract|const|enum|extends|final|implements|native|private|'
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
56 r'protected|public|static|strictfp|super|synchronized|throws|'
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
57 r'transient|volatile)\b', Keyword.Declaration),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
58 (r'(boolean|byte|char|double|float|int|long|short|void)\b',
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
59 Keyword.Type),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
60 (r'(package)(\s+)', bygroups(Keyword.Namespace, Text)),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
61 (r'(true|false|null)\b', Keyword.Constant),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
62 (r'(class|interface)(\s+)', bygroups(Keyword.Declaration, Text), 'class'),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
63 (r'(import)(\s+)', bygroups(Keyword.Namespace, Text), 'import'),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
64 (r'"(\\\\|\\"|[^"])*"', String),
2426
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
65 (r"'\\.'|'[^\\]'|'\\u[0-9a-fA-F]{4}'", String.Char),
1705
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
66 (r'(\.)([a-zA-Z_][a-zA-Z0-9_]*)', bygroups(Operator, Name.Attribute)),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
67 (r'[a-zA-Z_][a-zA-Z0-9_]*:', Name.Label),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
68 (r'[a-zA-Z_\$][a-zA-Z0-9_]*', Name),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
69 (r'[~\^\*!%&\[\]\(\)\{\}<>\|+=:;,./?-]', Operator),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
70 (r'[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float),
2426
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
71 (r'0x[0-9a-fA-F]+', Number.Hex),
1705
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
72 (r'[0-9]+L?', Number.Integer),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
73 (r'\n', Text)
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
74 ],
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
75 'class': [
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
76 (r'[a-zA-Z_][a-zA-Z0-9_]*', Name.Class, '#pop')
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
77 ],
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
78 'import': [
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
79 (r'[a-zA-Z0-9_.]+\*?', Name.Namespace, '#pop')
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
80 ],
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
81 }
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
82
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
83
2426
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
84 class AspectJLexer(JavaLexer):
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
85 """
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
86 For `AspectJ <http://www.eclipse.org/aspectj/>`_ source code.
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
87
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
88 *New in Pygments 1.6.*
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
89 """
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
90
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
91 name = 'AspectJ'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
92 aliases = ['aspectj']
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
93 filenames = ['*.aj']
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
94 mimetypes = ['text/x-aspectj']
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
95
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
96 aj_keywords = [
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
97 'aspect', 'pointcut', 'privileged', 'call', 'execution',
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
98 'initialization', 'preinitialization', 'handler', 'get', 'set',
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
99 'staticinitialization', 'target', 'args', 'within', 'withincode',
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
100 'cflow', 'cflowbelow', 'annotation', 'before', 'after', 'around',
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
101 'proceed', 'throwing', 'returning', 'adviceexecution', 'declare',
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
102 'parents', 'warning', 'error', 'soft', 'precedence', 'thisJoinPoint',
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
103 'thisJoinPointStaticPart', 'thisEnclosingJoinPointStaticPart',
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
104 'issingleton', 'perthis', 'pertarget', 'percflow', 'percflowbelow',
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
105 'pertypewithin', 'lock', 'unlock', 'thisAspectInstance'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
106 ]
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
107 aj_inter_type = ['parents:', 'warning:', 'error:', 'soft:', 'precedence:']
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
108 aj_inter_type_annotation = ['@type', '@method', '@constructor', '@field']
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
109
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
110 def get_tokens_unprocessed(self, text):
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
111 for index, token, value in JavaLexer.get_tokens_unprocessed(self, text):
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
112 if token is Name and value in self.aj_keywords:
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
113 yield index, Keyword, value
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
114 elif token is Name.Label and value in self.aj_inter_type:
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
115 yield index, Keyword, value[:-1]
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
116 yield index, Operator, value[-1]
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
117 elif token is Name.Decorator and value in self.aj_inter_type_annotation:
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
118 yield index, Keyword, value
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
119 else:
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
120 yield index, token, value
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
121
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
122
1705
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
123 class ScalaLexer(RegexLexer):
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
124 """
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
125 For `Scala <http://www.scala-lang.org>`_ source code.
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
126 """
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
127
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
128 name = 'Scala'
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
129 aliases = ['scala']
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
130 filenames = ['*.scala']
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
131 mimetypes = ['text/x-scala']
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
132
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
133 flags = re.MULTILINE | re.DOTALL
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
134
2426
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
135 # don't use raw unicode strings!
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
136 op = ('[-~\\^\\*!%&\\\\<>\\|+=:/?@\u00a6-\u00a7\u00a9\u00ac\u00ae\u00b0-\u00b1'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
137 '\u00b6\u00d7\u00f7\u03f6\u0482\u0606-\u0608\u060e-\u060f\u06e9'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
138 '\u06fd-\u06fe\u07f6\u09fa\u0b70\u0bf3-\u0bf8\u0bfa\u0c7f\u0cf1-\u0cf2'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
139 '\u0d79\u0f01-\u0f03\u0f13-\u0f17\u0f1a-\u0f1f\u0f34\u0f36\u0f38'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
140 '\u0fbe-\u0fc5\u0fc7-\u0fcf\u109e-\u109f\u1360\u1390-\u1399\u1940'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
141 '\u19e0-\u19ff\u1b61-\u1b6a\u1b74-\u1b7c\u2044\u2052\u207a-\u207c'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
142 '\u208a-\u208c\u2100-\u2101\u2103-\u2106\u2108-\u2109\u2114\u2116-\u2118'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
143 '\u211e-\u2123\u2125\u2127\u2129\u212e\u213a-\u213b\u2140-\u2144'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
144 '\u214a-\u214d\u214f\u2190-\u2328\u232b-\u244a\u249c-\u24e9\u2500-\u2767'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
145 '\u2794-\u27c4\u27c7-\u27e5\u27f0-\u2982\u2999-\u29d7\u29dc-\u29fb'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
146 '\u29fe-\u2b54\u2ce5-\u2cea\u2e80-\u2ffb\u3004\u3012-\u3013\u3020'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
147 '\u3036-\u3037\u303e-\u303f\u3190-\u3191\u3196-\u319f\u31c0-\u31e3'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
148 '\u3200-\u321e\u322a-\u3250\u3260-\u327f\u328a-\u32b0\u32c0-\u33ff'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
149 '\u4dc0-\u4dff\ua490-\ua4c6\ua828-\ua82b\ufb29\ufdfd\ufe62\ufe64-\ufe66'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
150 '\uff0b\uff1c-\uff1e\uff5c\uff5e\uffe2\uffe4\uffe8-\uffee\ufffc-\ufffd]+')
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
151
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
152 letter = ('[a-zA-Z\\$_\u00aa\u00b5\u00ba\u00c0-\u00d6\u00d8-\u00f6'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
153 '\u00f8-\u02af\u0370-\u0373\u0376-\u0377\u037b-\u037d\u0386'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
154 '\u0388-\u03f5\u03f7-\u0481\u048a-\u0556\u0561-\u0587\u05d0-\u05f2'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
155 '\u0621-\u063f\u0641-\u064a\u066e-\u066f\u0671-\u06d3\u06d5'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
156 '\u06ee-\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
157 '\u07b1\u07ca-\u07ea\u0904-\u0939\u093d\u0950\u0958-\u0961'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
158 '\u0972-\u097f\u0985-\u09b9\u09bd\u09ce\u09dc-\u09e1\u09f0-\u09f1'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
159 '\u0a05-\u0a39\u0a59-\u0a5e\u0a72-\u0a74\u0a85-\u0ab9\u0abd'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
160 '\u0ad0-\u0ae1\u0b05-\u0b39\u0b3d\u0b5c-\u0b61\u0b71\u0b83-\u0bb9'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
161 '\u0bd0\u0c05-\u0c3d\u0c58-\u0c61\u0c85-\u0cb9\u0cbd\u0cde-\u0ce1'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
162 '\u0d05-\u0d3d\u0d60-\u0d61\u0d7a-\u0d7f\u0d85-\u0dc6\u0e01-\u0e30'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
163 '\u0e32-\u0e33\u0e40-\u0e45\u0e81-\u0eb0\u0eb2-\u0eb3\u0ebd-\u0ec4'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
164 '\u0edc-\u0f00\u0f40-\u0f6c\u0f88-\u0f8b\u1000-\u102a\u103f'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
165 '\u1050-\u1055\u105a-\u105d\u1061\u1065-\u1066\u106e-\u1070'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
166 '\u1075-\u1081\u108e\u10a0-\u10fa\u1100-\u135a\u1380-\u138f'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
167 '\u13a0-\u166c\u166f-\u1676\u1681-\u169a\u16a0-\u16ea\u16ee-\u1711'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
168 '\u1720-\u1731\u1740-\u1751\u1760-\u1770\u1780-\u17b3\u17dc'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
169 '\u1820-\u1842\u1844-\u18a8\u18aa-\u191c\u1950-\u19a9\u19c1-\u19c7'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
170 '\u1a00-\u1a16\u1b05-\u1b33\u1b45-\u1b4b\u1b83-\u1ba0\u1bae-\u1baf'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
171 '\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c77\u1d00-\u1d2b\u1d62-\u1d77'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
172 '\u1d79-\u1d9a\u1e00-\u1fbc\u1fbe\u1fc2-\u1fcc\u1fd0-\u1fdb'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
173 '\u1fe0-\u1fec\u1ff2-\u1ffc\u2071\u207f\u2102\u2107\u210a-\u2113'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
174 '\u2115\u2119-\u211d\u2124\u2126\u2128\u212a-\u212d\u212f-\u2139'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
175 '\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2c7c'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
176 '\u2c80-\u2ce4\u2d00-\u2d65\u2d80-\u2dde\u3006-\u3007\u3021-\u3029'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
177 '\u3038-\u303a\u303c\u3041-\u3096\u309f\u30a1-\u30fa\u30ff-\u318e'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
178 '\u31a0-\u31b7\u31f0-\u31ff\u3400-\u4db5\u4e00-\ua014\ua016-\ua48c'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
179 '\ua500-\ua60b\ua610-\ua61f\ua62a-\ua66e\ua680-\ua697\ua722-\ua76f'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
180 '\ua771-\ua787\ua78b-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
181 '\ua840-\ua873\ua882-\ua8b3\ua90a-\ua925\ua930-\ua946\uaa00-\uaa28'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
182 '\uaa40-\uaa42\uaa44-\uaa4b\uac00-\ud7a3\uf900-\ufb1d\ufb1f-\ufb28'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
183 '\ufb2a-\ufd3d\ufd50-\ufdfb\ufe70-\ufefc\uff21-\uff3a\uff41-\uff5a'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
184 '\uff66-\uff6f\uff71-\uff9d\uffa0-\uffdc]')
1705
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
185
2426
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
186 upper = ('[A-Z\\$_\u00c0-\u00d6\u00d8-\u00de\u0100\u0102\u0104\u0106\u0108'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
187 '\u010a\u010c\u010e\u0110\u0112\u0114\u0116\u0118\u011a\u011c'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
188 '\u011e\u0120\u0122\u0124\u0126\u0128\u012a\u012c\u012e\u0130'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
189 '\u0132\u0134\u0136\u0139\u013b\u013d\u013f\u0141\u0143\u0145'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
190 '\u0147\u014a\u014c\u014e\u0150\u0152\u0154\u0156\u0158\u015a'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
191 '\u015c\u015e\u0160\u0162\u0164\u0166\u0168\u016a\u016c\u016e'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
192 '\u0170\u0172\u0174\u0176\u0178-\u0179\u017b\u017d\u0181-\u0182'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
193 '\u0184\u0186-\u0187\u0189-\u018b\u018e-\u0191\u0193-\u0194'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
194 '\u0196-\u0198\u019c-\u019d\u019f-\u01a0\u01a2\u01a4\u01a6-\u01a7'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
195 '\u01a9\u01ac\u01ae-\u01af\u01b1-\u01b3\u01b5\u01b7-\u01b8\u01bc'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
196 '\u01c4\u01c7\u01ca\u01cd\u01cf\u01d1\u01d3\u01d5\u01d7\u01d9'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
197 '\u01db\u01de\u01e0\u01e2\u01e4\u01e6\u01e8\u01ea\u01ec\u01ee'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
198 '\u01f1\u01f4\u01f6-\u01f8\u01fa\u01fc\u01fe\u0200\u0202\u0204'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
199 '\u0206\u0208\u020a\u020c\u020e\u0210\u0212\u0214\u0216\u0218'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
200 '\u021a\u021c\u021e\u0220\u0222\u0224\u0226\u0228\u022a\u022c'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
201 '\u022e\u0230\u0232\u023a-\u023b\u023d-\u023e\u0241\u0243-\u0246'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
202 '\u0248\u024a\u024c\u024e\u0370\u0372\u0376\u0386\u0388-\u038f'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
203 '\u0391-\u03ab\u03cf\u03d2-\u03d4\u03d8\u03da\u03dc\u03de\u03e0'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
204 '\u03e2\u03e4\u03e6\u03e8\u03ea\u03ec\u03ee\u03f4\u03f7'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
205 '\u03f9-\u03fa\u03fd-\u042f\u0460\u0462\u0464\u0466\u0468\u046a'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
206 '\u046c\u046e\u0470\u0472\u0474\u0476\u0478\u047a\u047c\u047e'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
207 '\u0480\u048a\u048c\u048e\u0490\u0492\u0494\u0496\u0498\u049a'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
208 '\u049c\u049e\u04a0\u04a2\u04a4\u04a6\u04a8\u04aa\u04ac\u04ae'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
209 '\u04b0\u04b2\u04b4\u04b6\u04b8\u04ba\u04bc\u04be\u04c0-\u04c1'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
210 '\u04c3\u04c5\u04c7\u04c9\u04cb\u04cd\u04d0\u04d2\u04d4\u04d6'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
211 '\u04d8\u04da\u04dc\u04de\u04e0\u04e2\u04e4\u04e6\u04e8\u04ea'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
212 '\u04ec\u04ee\u04f0\u04f2\u04f4\u04f6\u04f8\u04fa\u04fc\u04fe'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
213 '\u0500\u0502\u0504\u0506\u0508\u050a\u050c\u050e\u0510\u0512'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
214 '\u0514\u0516\u0518\u051a\u051c\u051e\u0520\u0522\u0531-\u0556'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
215 '\u10a0-\u10c5\u1e00\u1e02\u1e04\u1e06\u1e08\u1e0a\u1e0c\u1e0e'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
216 '\u1e10\u1e12\u1e14\u1e16\u1e18\u1e1a\u1e1c\u1e1e\u1e20\u1e22'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
217 '\u1e24\u1e26\u1e28\u1e2a\u1e2c\u1e2e\u1e30\u1e32\u1e34\u1e36'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
218 '\u1e38\u1e3a\u1e3c\u1e3e\u1e40\u1e42\u1e44\u1e46\u1e48\u1e4a'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
219 '\u1e4c\u1e4e\u1e50\u1e52\u1e54\u1e56\u1e58\u1e5a\u1e5c\u1e5e'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
220 '\u1e60\u1e62\u1e64\u1e66\u1e68\u1e6a\u1e6c\u1e6e\u1e70\u1e72'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
221 '\u1e74\u1e76\u1e78\u1e7a\u1e7c\u1e7e\u1e80\u1e82\u1e84\u1e86'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
222 '\u1e88\u1e8a\u1e8c\u1e8e\u1e90\u1e92\u1e94\u1e9e\u1ea0\u1ea2'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
223 '\u1ea4\u1ea6\u1ea8\u1eaa\u1eac\u1eae\u1eb0\u1eb2\u1eb4\u1eb6'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
224 '\u1eb8\u1eba\u1ebc\u1ebe\u1ec0\u1ec2\u1ec4\u1ec6\u1ec8\u1eca'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
225 '\u1ecc\u1ece\u1ed0\u1ed2\u1ed4\u1ed6\u1ed8\u1eda\u1edc\u1ede'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
226 '\u1ee0\u1ee2\u1ee4\u1ee6\u1ee8\u1eea\u1eec\u1eee\u1ef0\u1ef2'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
227 '\u1ef4\u1ef6\u1ef8\u1efa\u1efc\u1efe\u1f08-\u1f0f\u1f18-\u1f1d'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
228 '\u1f28-\u1f2f\u1f38-\u1f3f\u1f48-\u1f4d\u1f59-\u1f5f'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
229 '\u1f68-\u1f6f\u1fb8-\u1fbb\u1fc8-\u1fcb\u1fd8-\u1fdb'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
230 '\u1fe8-\u1fec\u1ff8-\u1ffb\u2102\u2107\u210b-\u210d\u2110-\u2112'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
231 '\u2115\u2119-\u211d\u2124\u2126\u2128\u212a-\u212d\u2130-\u2133'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
232 '\u213e-\u213f\u2145\u2183\u2c00-\u2c2e\u2c60\u2c62-\u2c64\u2c67'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
233 '\u2c69\u2c6b\u2c6d-\u2c6f\u2c72\u2c75\u2c80\u2c82\u2c84\u2c86'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
234 '\u2c88\u2c8a\u2c8c\u2c8e\u2c90\u2c92\u2c94\u2c96\u2c98\u2c9a'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
235 '\u2c9c\u2c9e\u2ca0\u2ca2\u2ca4\u2ca6\u2ca8\u2caa\u2cac\u2cae'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
236 '\u2cb0\u2cb2\u2cb4\u2cb6\u2cb8\u2cba\u2cbc\u2cbe\u2cc0\u2cc2'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
237 '\u2cc4\u2cc6\u2cc8\u2cca\u2ccc\u2cce\u2cd0\u2cd2\u2cd4\u2cd6'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
238 '\u2cd8\u2cda\u2cdc\u2cde\u2ce0\u2ce2\ua640\ua642\ua644\ua646'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
239 '\ua648\ua64a\ua64c\ua64e\ua650\ua652\ua654\ua656\ua658\ua65a'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
240 '\ua65c\ua65e\ua662\ua664\ua666\ua668\ua66a\ua66c\ua680\ua682'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
241 '\ua684\ua686\ua688\ua68a\ua68c\ua68e\ua690\ua692\ua694\ua696'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
242 '\ua722\ua724\ua726\ua728\ua72a\ua72c\ua72e\ua732\ua734\ua736'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
243 '\ua738\ua73a\ua73c\ua73e\ua740\ua742\ua744\ua746\ua748\ua74a'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
244 '\ua74c\ua74e\ua750\ua752\ua754\ua756\ua758\ua75a\ua75c\ua75e'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
245 '\ua760\ua762\ua764\ua766\ua768\ua76a\ua76c\ua76e\ua779\ua77b'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
246 '\ua77d-\ua77e\ua780\ua782\ua784\ua786\ua78b\uff21-\uff3a]')
1705
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
247
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
248 idrest = r'%s(?:%s|[0-9])*(?:(?<=_)%s)?' % (letter, letter, op)
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
249
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
250 tokens = {
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
251 'root': [
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
252 # method names
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
253 (r'(class|trait|object)(\s+)', bygroups(Keyword, Text), 'class'),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
254 (r"'%s" % idrest, Text.Symbol),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
255 (r'[^\S\n]+', Text),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
256 (r'//.*?\n', Comment.Single),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
257 (r'/\*', Comment.Multiline, 'comment'),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
258 (r'@%s' % idrest, Name.Decorator),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
259 (r'(abstract|ca(?:se|tch)|d(?:ef|o)|e(?:lse|xtends)|'
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
260 r'f(?:inal(?:ly)?|or(?:Some)?)|i(?:f|mplicit)|'
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
261 r'lazy|match|new|override|pr(?:ivate|otected)'
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
262 r'|re(?:quires|turn)|s(?:ealed|uper)|'
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
263 r't(?:h(?:is|row)|ry)|va[lr]|w(?:hile|ith)|yield)\b|'
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
264 '(<[%:-]|=>|>:|[#=@_\u21D2\u2190])(\\b|(?=\\s)|$)', Keyword),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
265 (r':(?!%s)' % op, Keyword, 'type'),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
266 (r'%s%s\b' % (upper, idrest), Name.Class),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
267 (r'(true|false|null)\b', Keyword.Constant),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
268 (r'(import|package)(\s+)', bygroups(Keyword, Text), 'import'),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
269 (r'(type)(\s+)', bygroups(Keyword, Text), 'type'),
2426
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
270 (r'""".*?"""(?!")', String),
1705
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
271 (r'"(\\\\|\\"|[^"])*"', String),
2426
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
272 (r"'\\.'|'[^\\]'|'\\u[0-9a-fA-F]{4}'", String.Char),
1705
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
273 # (ur'(\.)(%s|%s|`[^`]+`)' % (idrest, op), bygroups(Operator,
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
274 # Name.Attribute)),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
275 (idrest, Name),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
276 (r'`[^`]+`', Name),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
277 (r'\[', Operator, 'typeparam'),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
278 (r'[\(\)\{\};,.#]', Operator),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
279 (op, Operator),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
280 (r'([0-9][0-9]*\.[0-9]*|\.[0-9]+)([eE][+-]?[0-9]+)?[fFdD]?',
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
281 Number.Float),
2426
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
282 (r'0x[0-9a-fA-F]+', Number.Hex),
1705
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
283 (r'[0-9]+L?', Number.Integer),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
284 (r'\n', Text)
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
285 ],
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
286 'class': [
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
287 (r'(%s|%s|`[^`]+`)(\s*)(\[)' % (idrest, op),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
288 bygroups(Name.Class, Text, Operator), 'typeparam'),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
289 (r'\s+', Text),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
290 (r'{', Operator, '#pop'),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
291 (r'\(', Operator, '#pop'),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
292 (r'//.*?\n', Comment.Single, '#pop'),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
293 (r'%s|%s|`[^`]+`' % (idrest, op), Name.Class, '#pop'),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
294 ],
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
295 'type': [
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
296 (r'\s+', Text),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
297 ('<[%:]|>:|[#_\u21D2]|forSome|type', Keyword),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
298 (r'([,\);}]|=>|=)(\s*)', bygroups(Operator, Text), '#pop'),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
299 (r'[\(\{]', Operator, '#push'),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
300 (r'((?:%s|%s|`[^`]+`)(?:\.(?:%s|%s|`[^`]+`))*)(\s*)(\[)' %
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
301 (idrest, op, idrest, op),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
302 bygroups(Keyword.Type, Text, Operator), ('#pop', 'typeparam')),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
303 (r'((?:%s|%s|`[^`]+`)(?:\.(?:%s|%s|`[^`]+`))*)(\s*)$' %
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
304 (idrest, op, idrest, op),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
305 bygroups(Keyword.Type, Text), '#pop'),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
306 (r'//.*?\n', Comment.Single, '#pop'),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
307 (r'\.|%s|%s|`[^`]+`' % (idrest, op), Keyword.Type)
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
308 ],
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
309 'typeparam': [
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
310 (r'[\s,]+', Text),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
311 ('<[%:]|=>|>:|[#_\u21D2]|forSome|type', Keyword),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
312 (r'([\]\)\}])', Operator, '#pop'),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
313 (r'[\(\[\{]', Operator, '#push'),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
314 (r'\.|%s|%s|`[^`]+`' % (idrest, op), Keyword.Type)
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
315 ],
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
316 'comment': [
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
317 (r'[^/\*]+', Comment.Multiline),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
318 (r'/\*', Comment.Multiline, '#push'),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
319 (r'\*/', Comment.Multiline, '#pop'),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
320 (r'[*/]', Comment.Multiline)
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
321 ],
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
322 'import': [
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
323 (r'(%s|\.)+' % idrest, Name.Namespace, '#pop')
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
324 ],
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
325 }
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
326
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
327
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
328 class GosuLexer(RegexLexer):
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
329 """
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
330 For Gosu source code.
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
331
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
332 *New in Pygments 1.5.*
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
333 """
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
334
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
335 name = 'Gosu'
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
336 aliases = ['gosu']
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
337 filenames = ['*.gs', '*.gsx', '*.gsp', '*.vark']
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
338 mimetypes = ['text/x-gosu']
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
339
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
340 flags = re.MULTILINE | re.DOTALL
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
341
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
342 tokens = {
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
343 'root': [
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
344 # method names
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
345 (r'^(\s*(?:[a-zA-Z_][a-zA-Z0-9_\.\[\]]*\s+)+?)' # modifiers etc.
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
346 r'([a-zA-Z_][a-zA-Z0-9_]*)' # method name
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
347 r'(\s*)(\()', # signature start
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
348 bygroups(using(this), Name.Function, Text, Operator)),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
349 (r'[^\S\n]+', Text),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
350 (r'//.*?\n', Comment.Single),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
351 (r'/\*.*?\*/', Comment.Multiline),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
352 (r'@[a-zA-Z_][a-zA-Z0-9_\.]*', Name.Decorator),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
353 (r'(in|as|typeof|statictypeof|typeis|typeas|if|else|foreach|for|'
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
354 r'index|while|do|continue|break|return|try|catch|finally|this|'
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
355 r'throw|new|switch|case|default|eval|super|outer|classpath|'
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
356 r'using)\b', Keyword),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
357 (r'(var|delegate|construct|function|private|internal|protected|'
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
358 r'public|abstract|override|final|static|extends|transient|'
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
359 r'implements|represents|readonly)\b', Keyword.Declaration),
2426
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
360 (r'(property\s+)(get|set)?', Keyword.Declaration),
1705
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
361 (r'(boolean|byte|char|double|float|int|long|short|void|block)\b',
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
362 Keyword.Type),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
363 (r'(package)(\s+)', bygroups(Keyword.Namespace, Text)),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
364 (r'(true|false|null|NaN|Infinity)\b', Keyword.Constant),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
365 (r'(class|interface|enhancement|enum)(\s+)([a-zA-Z_][a-zA-Z0-9_]*)',
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
366 bygroups(Keyword.Declaration, Text, Name.Class)),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
367 (r'(uses)(\s+)([a-zA-Z0-9_.]+\*?)',
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
368 bygroups(Keyword.Namespace, Text, Name.Namespace)),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
369 (r'"', String, 'string'),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
370 (r'(\??[\.#])([a-zA-Z_][a-zA-Z0-9_]*)',
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
371 bygroups(Operator, Name.Attribute)),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
372 (r'(:)([a-zA-Z_][a-zA-Z0-9_]*)',
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
373 bygroups(Operator, Name.Attribute)),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
374 (r'[a-zA-Z_\$][a-zA-Z0-9_]*', Name),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
375 (r'and|or|not|[\\~\^\*!%&\[\]\(\)\{\}<>\|+=:;,./?-]', Operator),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
376 (r'[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
377 (r'[0-9]+', Number.Integer),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
378 (r'\n', Text)
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
379 ],
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
380 'templateText': [
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
381 (r'(\\<)|(\\\$)', String),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
382 (r'(<%@\s+)(extends|params)',
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
383 bygroups(Operator, Name.Decorator), 'stringTemplate'),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
384 (r'<%!--.*?--%>', Comment.Multiline),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
385 (r'(<%)|(<%=)', Operator, 'stringTemplate'),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
386 (r'\$\{', Operator, 'stringTemplateShorthand'),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
387 (r'.', String)
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
388 ],
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
389 'string': [
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
390 (r'"', String, '#pop'),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
391 include('templateText')
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
392 ],
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
393 'stringTemplate': [
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
394 (r'"', String, 'string'),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
395 (r'%>', Operator, '#pop'),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
396 include('root')
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
397 ],
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
398 'stringTemplateShorthand': [
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
399 (r'"', String, 'string'),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
400 (r'\{', Operator, 'stringTemplateShorthand'),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
401 (r'\}', Operator, '#pop'),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
402 include('root')
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
403 ],
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
404 }
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
405
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
406
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
407 class GosuTemplateLexer(Lexer):
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
408 """
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
409 For Gosu templates.
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
410
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
411 *New in Pygments 1.5.*
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
412 """
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
413
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
414 name = 'Gosu Template'
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
415 aliases = ['gst']
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
416 filenames = ['*.gst']
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
417 mimetypes = ['text/x-gosu-template']
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
418 lexer = GosuLexer()
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
419
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
420 def get_tokens_unprocessed(self, text):
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
421 stack = ['templateText']
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
422 for item in self.lexer.get_tokens_unprocessed(text, stack):
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
423 yield item
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
424
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
425
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
426 class GroovyLexer(RegexLexer):
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
427 """
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
428 For `Groovy <http://groovy.codehaus.org/>`_ source code.
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
429
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
430 *New in Pygments 1.5.*
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
431 """
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
432
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
433 name = 'Groovy'
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
434 aliases = ['groovy']
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
435 filenames = ['*.groovy']
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
436 mimetypes = ['text/x-groovy']
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
437
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
438 flags = re.MULTILINE | re.DOTALL
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
439
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
440 tokens = {
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
441 'root': [
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
442 # method names
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
443 (r'^(\s*(?:[a-zA-Z_][a-zA-Z0-9_\.\[\]]*\s+)+?)' # return arguments
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
444 r'([a-zA-Z_][a-zA-Z0-9_]*)' # method name
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
445 r'(\s*)(\()', # signature start
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
446 bygroups(using(this), Name.Function, Text, Operator)),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
447 (r'[^\S\n]+', Text),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
448 (r'//.*?\n', Comment.Single),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
449 (r'/\*.*?\*/', Comment.Multiline),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
450 (r'@[a-zA-Z_][a-zA-Z0-9_\.]*', Name.Decorator),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
451 (r'(assert|break|case|catch|continue|default|do|else|finally|for|'
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
452 r'if|goto|instanceof|new|return|switch|this|throw|try|while|in|as)\b',
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
453 Keyword),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
454 (r'(abstract|const|enum|extends|final|implements|native|private|'
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
455 r'protected|public|static|strictfp|super|synchronized|throws|'
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
456 r'transient|volatile)\b', Keyword.Declaration),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
457 (r'(def|boolean|byte|char|double|float|int|long|short|void)\b',
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
458 Keyword.Type),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
459 (r'(package)(\s+)', bygroups(Keyword.Namespace, Text)),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
460 (r'(true|false|null)\b', Keyword.Constant),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
461 (r'(class|interface)(\s+)', bygroups(Keyword.Declaration, Text),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
462 'class'),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
463 (r'(import)(\s+)', bygroups(Keyword.Namespace, Text), 'import'),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
464 (r'"(\\\\|\\"|[^"])*"', String.Double),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
465 (r"'(\\\\|\\'|[^'])*'", String.Single),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
466 (r'\$/((?!/\$).)*/\$', String),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
467 (r'/(\\\\|\\"|[^/])*/', String),
2426
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
468 (r"'\\.'|'[^\\]'|'\\u[0-9a-fA-F]{4}'", String.Char),
1705
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
469 (r'(\.)([a-zA-Z_][a-zA-Z0-9_]*)', bygroups(Operator, Name.Attribute)),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
470 (r'[a-zA-Z_][a-zA-Z0-9_]*:', Name.Label),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
471 (r'[a-zA-Z_\$][a-zA-Z0-9_]*', Name),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
472 (r'[~\^\*!%&\[\]\(\)\{\}<>\|+=:;,./?-]', Operator),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
473 (r'[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float),
2426
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
474 (r'0x[0-9a-fA-F]+', Number.Hex),
1705
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
475 (r'[0-9]+L?', Number.Integer),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
476 (r'\n', Text)
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
477 ],
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
478 'class': [
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
479 (r'[a-zA-Z_][a-zA-Z0-9_]*', Name.Class, '#pop')
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
480 ],
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
481 'import': [
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
482 (r'[a-zA-Z0-9_.]+\*?', Name.Namespace, '#pop')
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
483 ],
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
484 }
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
485
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
486
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
487 class IokeLexer(RegexLexer):
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
488 """
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
489 For `Ioke <http://ioke.org/>`_ (a strongly typed, dynamic,
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
490 prototype based programming language) source.
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
491
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
492 *New in Pygments 1.4.*
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
493 """
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
494 name = 'Ioke'
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
495 filenames = ['*.ik']
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
496 aliases = ['ioke', 'ik']
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
497 mimetypes = ['text/x-iokesrc']
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
498 tokens = {
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
499 'interpolatableText': [
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
500 (r'(\\b|\\e|\\t|\\n|\\f|\\r|\\"|\\\\|\\#|\\\Z|\\u[0-9a-fA-F]{1,4}'
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
501 r'|\\[0-3]?[0-7]?[0-7])', String.Escape),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
502 (r'#{', Punctuation, 'textInterpolationRoot')
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
503 ],
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
504
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
505 'text': [
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
506 (r'(?<!\\)"', String, '#pop'),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
507 include('interpolatableText'),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
508 (r'[^"]', String)
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
509 ],
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
510
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
511 'documentation': [
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
512 (r'(?<!\\)"', String.Doc, '#pop'),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
513 include('interpolatableText'),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
514 (r'[^"]', String.Doc)
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
515 ],
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
516
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
517 'textInterpolationRoot': [
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
518 (r'}', Punctuation, '#pop'),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
519 include('root')
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
520 ],
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
521
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
522 'slashRegexp': [
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
523 (r'(?<!\\)/[oxpniums]*', String.Regex, '#pop'),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
524 include('interpolatableText'),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
525 (r'\\/', String.Regex),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
526 (r'[^/]', String.Regex)
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
527 ],
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
528
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
529 'squareRegexp': [
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
530 (r'(?<!\\)][oxpniums]*', String.Regex, '#pop'),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
531 include('interpolatableText'),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
532 (r'\\]', String.Regex),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
533 (r'[^\]]', String.Regex)
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
534 ],
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
535
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
536 'squareText': [
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
537 (r'(?<!\\)]', String, '#pop'),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
538 include('interpolatableText'),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
539 (r'[^\]]', String)
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
540 ],
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
541
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
542 'root': [
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
543 (r'\n', Text),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
544 (r'\s+', Text),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
545
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
546 # Comments
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
547 (r';(.*?)\n', Comment),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
548 (r'\A#!(.*?)\n', Comment),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
549
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
550 #Regexps
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
551 (r'#/', String.Regex, 'slashRegexp'),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
552 (r'#r\[', String.Regex, 'squareRegexp'),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
553
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
554 #Symbols
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
555 (r':[a-zA-Z0-9_!:?]+', String.Symbol),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
556 (r'[a-zA-Z0-9_!:?]+:(?![a-zA-Z0-9_!?])', String.Other),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
557 (r':"(\\\\|\\"|[^"])*"', String.Symbol),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
558
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
559 #Documentation
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
560 (r'((?<=fn\()|(?<=fnx\()|(?<=method\()|(?<=macro\()|(?<=lecro\()'
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
561 r'|(?<=syntax\()|(?<=dmacro\()|(?<=dlecro\()|(?<=dlecrox\()'
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
562 r'|(?<=dsyntax\())\s*"', String.Doc, 'documentation'),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
563
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
564 #Text
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
565 (r'"', String, 'text'),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
566 (r'#\[', String, 'squareText'),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
567
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
568 #Mimic
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
569 (r'[a-zA-Z0-9_][a-zA-Z0-9!?_:]+(?=\s*=.*mimic\s)', Name.Entity),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
570
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
571 #Assignment
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
572 (r'[a-zA-Z_][a-zA-Z0-9_!:?]*(?=[\s]*[+*/-]?=[^=].*($|\.))',
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
573 Name.Variable),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
574
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
575 # keywords
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
576 (r'(break|cond|continue|do|ensure|for|for:dict|for:set|if|let|'
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
577 r'loop|p:for|p:for:dict|p:for:set|return|unless|until|while|'
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
578 r'with)(?![a-zA-Z0-9!:_?])', Keyword.Reserved),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
579
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
580 # Origin
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
581 (r'(eval|mimic|print|println)(?![a-zA-Z0-9!:_?])', Keyword),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
582
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
583 # Base
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
584 (r'(cell\?|cellNames|cellOwner\?|cellOwner|cells|cell|'
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
585 r'documentation|hash|identity|mimic|removeCell\!|undefineCell\!)'
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
586 r'(?![a-zA-Z0-9!:_?])', Keyword),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
587
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
588 # Ground
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
589 (r'(stackTraceAsText)(?![a-zA-Z0-9!:_?])', Keyword),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
590
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
591 #DefaultBehaviour Literals
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
592 (r'(dict|list|message|set)(?![a-zA-Z0-9!:_?])', Keyword.Reserved),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
593
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
594 #DefaultBehaviour Case
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
595 (r'(case|case:and|case:else|case:nand|case:nor|case:not|case:or|'
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
596 r'case:otherwise|case:xor)(?![a-zA-Z0-9!:_?])', Keyword.Reserved),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
597
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
598 #DefaultBehaviour Reflection
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
599 (r'(asText|become\!|derive|freeze\!|frozen\?|in\?|is\?|kind\?|'
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
600 r'mimic\!|mimics|mimics\?|prependMimic\!|removeAllMimics\!|'
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
601 r'removeMimic\!|same\?|send|thaw\!|uniqueHexId)'
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
602 r'(?![a-zA-Z0-9!:_?])', Keyword),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
603
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
604 #DefaultBehaviour Aspects
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
605 (r'(after|around|before)(?![a-zA-Z0-9!:_?])', Keyword.Reserved),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
606
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
607 # DefaultBehaviour
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
608 (r'(kind|cellDescriptionDict|cellSummary|genSym|inspect|notice)'
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
609 r'(?![a-zA-Z0-9!:_?])', Keyword),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
610 (r'(use|destructuring)', Keyword.Reserved),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
611
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
612 #DefaultBehavior BaseBehavior
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
613 (r'(cell\?|cellOwner\?|cellOwner|cellNames|cells|cell|'
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
614 r'documentation|identity|removeCell!|undefineCell)'
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
615 r'(?![a-zA-Z0-9!:_?])', Keyword),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
616
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
617 #DefaultBehavior Internal
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
618 (r'(internal:compositeRegexp|internal:concatenateText|'
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
619 r'internal:createDecimal|internal:createNumber|'
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
620 r'internal:createRegexp|internal:createText)'
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
621 r'(?![a-zA-Z0-9!:_?])', Keyword.Reserved),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
622
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
623 #DefaultBehaviour Conditions
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
624 (r'(availableRestarts|bind|error\!|findRestart|handle|'
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
625 r'invokeRestart|rescue|restart|signal\!|warn\!)'
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
626 r'(?![a-zA-Z0-9!:_?])', Keyword.Reserved),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
627
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
628 # constants
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
629 (r'(nil|false|true)(?![a-zA-Z0-9!:_?])', Name.Constant),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
630
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
631 # names
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
632 (r'(Arity|Base|Call|Condition|DateTime|Aspects|Pointcut|'
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
633 r'Assignment|BaseBehavior|Boolean|Case|AndCombiner|Else|'
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
634 r'NAndCombiner|NOrCombiner|NotCombiner|OrCombiner|XOrCombiner|'
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
635 r'Conditions|Definitions|FlowControl|Internal|Literals|'
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
636 r'Reflection|DefaultMacro|DefaultMethod|DefaultSyntax|Dict|'
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
637 r'FileSystem|Ground|Handler|Hook|IO|IokeGround|Struct|'
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
638 r'LexicalBlock|LexicalMacro|List|Message|Method|Mixins|'
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
639 r'NativeMethod|Number|Origin|Pair|Range|Reflector|Regexp Match|'
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
640 r'Regexp|Rescue|Restart|Runtime|Sequence|Set|Symbol|'
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
641 r'System|Text|Tuple)(?![a-zA-Z0-9!:_?])', Name.Builtin),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
642
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
643 # functions
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
644 (r'(generateMatchMethod|aliasMethod|\u03bb|\u028E|fnx|fn|method|'
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
645 r'dmacro|dlecro|syntax|macro|dlecrox|lecrox|lecro|syntax)'
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
646 r'(?![a-zA-Z0-9!:_?])', Name.Function),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
647
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
648 # Numbers
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
649 (r'-?0[xX][0-9a-fA-F]+', Number.Hex),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
650 (r'-?(\d+\.?\d*|\d*\.\d+)([eE][+-]?[0-9]+)?', Number.Float),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
651 (r'-?\d+', Number.Integer),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
652
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
653 (r'#\(', Punctuation),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
654
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
655 # Operators
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
656 (r'(&&>>|\|\|>>|\*\*>>|:::|::|\.\.\.|===|\*\*>|\*\*=|&&>|&&=|'
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
657 r'\|\|>|\|\|=|\->>|\+>>|!>>|<>>>|<>>|&>>|%>>|#>>|@>>|/>>|\*>>|'
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
658 r'\?>>|\|>>|\^>>|~>>|\$>>|=>>|<<=|>>=|<=>|<\->|=~|!~|=>|\+\+|'
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
659 r'\-\-|<=|>=|==|!=|&&|\.\.|\+=|\-=|\*=|\/=|%=|&=|\^=|\|=|<\-|'
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
660 r'\+>|!>|<>|&>|%>|#>|\@>|\/>|\*>|\?>|\|>|\^>|~>|\$>|<\->|\->|'
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
661 r'<<|>>|\*\*|\?\||\?&|\|\||>|<|\*|\/|%|\+|\-|&|\^|\||=|\$|!|~|'
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
662 r'\?|#|\u2260|\u2218|\u2208|\u2209)', Operator),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
663 (r'(and|nand|or|xor|nor|return|import)(?![a-zA-Z0-9_!?])',
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
664 Operator),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
665
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
666 # Punctuation
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
667 (r'(\`\`|\`|\'\'|\'|\.|\,|@@|@|\[|\]|\(|\)|{|})', Punctuation),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
668
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
669 #kinds
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
670 (r'[A-Z][a-zA-Z0-9_!:?]*', Name.Class),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
671
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
672 #default cellnames
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
673 (r'[a-z_][a-zA-Z0-9_!:?]*', Name)
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
674 ]
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
675 }
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
676
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
677
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
678 class ClojureLexer(RegexLexer):
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
679 """
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
680 Lexer for `Clojure <http://clojure.org/>`_ source code.
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
681
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
682 *New in Pygments 0.11.*
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
683 """
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
684 name = 'Clojure'
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
685 aliases = ['clojure', 'clj']
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
686 filenames = ['*.clj']
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
687 mimetypes = ['text/x-clojure', 'application/x-clojure']
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
688
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
689 special_forms = [
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
690 '.', 'def', 'do', 'fn', 'if', 'let', 'new', 'quote', 'var', 'loop'
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
691 ]
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
692
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
693 # It's safe to consider 'ns' a declaration thing because it defines a new
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
694 # namespace.
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
695 declarations = [
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
696 'def-', 'defn', 'defn-', 'defmacro', 'defmulti', 'defmethod',
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
697 'defstruct', 'defonce', 'declare', 'definline', 'definterface',
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
698 'defprotocol', 'defrecord', 'deftype', 'defproject', 'ns'
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
699 ]
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
700
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
701 builtins = [
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
702 '*', '+', '-', '->', '/', '<', '<=', '=', '==', '>', '>=', '..',
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
703 'accessor', 'agent', 'agent-errors', 'aget', 'alength', 'all-ns',
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
704 'alter', 'and', 'append-child', 'apply', 'array-map', 'aset',
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
705 'aset-boolean', 'aset-byte', 'aset-char', 'aset-double', 'aset-float',
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
706 'aset-int', 'aset-long', 'aset-short', 'assert', 'assoc', 'await',
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
707 'await-for', 'bean', 'binding', 'bit-and', 'bit-not', 'bit-or',
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
708 'bit-shift-left', 'bit-shift-right', 'bit-xor', 'boolean', 'branch?',
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
709 'butlast', 'byte', 'cast', 'char', 'children', 'class',
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
710 'clear-agent-errors', 'comment', 'commute', 'comp', 'comparator',
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
711 'complement', 'concat', 'conj', 'cons', 'constantly', 'cond', 'if-not',
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
712 'construct-proxy', 'contains?', 'count', 'create-ns', 'create-struct',
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
713 'cycle', 'dec', 'deref', 'difference', 'disj', 'dissoc', 'distinct',
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
714 'doall', 'doc', 'dorun', 'doseq', 'dosync', 'dotimes', 'doto',
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
715 'double', 'down', 'drop', 'drop-while', 'edit', 'end?', 'ensure',
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
716 'eval', 'every?', 'false?', 'ffirst', 'file-seq', 'filter', 'find',
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
717 'find-doc', 'find-ns', 'find-var', 'first', 'float', 'flush', 'for',
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
718 'fnseq', 'frest', 'gensym', 'get-proxy-class', 'get',
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
719 'hash-map', 'hash-set', 'identical?', 'identity', 'if-let', 'import',
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
720 'in-ns', 'inc', 'index', 'insert-child', 'insert-left', 'insert-right',
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
721 'inspect-table', 'inspect-tree', 'instance?', 'int', 'interleave',
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
722 'intersection', 'into', 'into-array', 'iterate', 'join', 'key', 'keys',
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
723 'keyword', 'keyword?', 'last', 'lazy-cat', 'lazy-cons', 'left',
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
724 'lefts', 'line-seq', 'list*', 'list', 'load', 'load-file',
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
725 'locking', 'long', 'loop', 'macroexpand', 'macroexpand-1',
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
726 'make-array', 'make-node', 'map', 'map-invert', 'map?', 'mapcat',
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
727 'max', 'max-key', 'memfn', 'merge', 'merge-with', 'meta', 'min',
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
728 'min-key', 'name', 'namespace', 'neg?', 'new', 'newline', 'next',
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
729 'nil?', 'node', 'not', 'not-any?', 'not-every?', 'not=', 'ns-imports',
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
730 'ns-interns', 'ns-map', 'ns-name', 'ns-publics', 'ns-refers',
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
731 'ns-resolve', 'ns-unmap', 'nth', 'nthrest', 'or', 'parse', 'partial',
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
732 'path', 'peek', 'pop', 'pos?', 'pr', 'pr-str', 'print', 'print-str',
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
733 'println', 'println-str', 'prn', 'prn-str', 'project', 'proxy',
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
734 'proxy-mappings', 'quot', 'rand', 'rand-int', 'range', 're-find',
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
735 're-groups', 're-matcher', 're-matches', 're-pattern', 're-seq',
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
736 'read', 'read-line', 'reduce', 'ref', 'ref-set', 'refer', 'rem',
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
737 'remove', 'remove-method', 'remove-ns', 'rename', 'rename-keys',
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
738 'repeat', 'replace', 'replicate', 'resolve', 'rest', 'resultset-seq',
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
739 'reverse', 'rfirst', 'right', 'rights', 'root', 'rrest', 'rseq',
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
740 'second', 'select', 'select-keys', 'send', 'send-off', 'seq',
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
741 'seq-zip', 'seq?', 'set', 'short', 'slurp', 'some', 'sort',
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
742 'sort-by', 'sorted-map', 'sorted-map-by', 'sorted-set',
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
743 'special-symbol?', 'split-at', 'split-with', 'str', 'string?',
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
744 'struct', 'struct-map', 'subs', 'subvec', 'symbol', 'symbol?',
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
745 'sync', 'take', 'take-nth', 'take-while', 'test', 'time', 'to-array',
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
746 'to-array-2d', 'tree-seq', 'true?', 'union', 'up', 'update-proxy',
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
747 'val', 'vals', 'var-get', 'var-set', 'var?', 'vector', 'vector-zip',
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
748 'vector?', 'when', 'when-first', 'when-let', 'when-not',
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
749 'with-local-vars', 'with-meta', 'with-open', 'with-out-str',
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
750 'xml-seq', 'xml-zip', 'zero?', 'zipmap', 'zipper']
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
751
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
752 # valid names for identifiers
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
753 # well, names can only not consist fully of numbers
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
754 # but this should be good enough for now
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
755
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
756 # TODO / should divide keywords/symbols into namespace/rest
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
757 # but that's hard, so just pretend / is part of the name
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
758 valid_name = r'(?!#)[\w!$%*+<=>?/.#-]+'
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
759
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
760 def _multi_escape(entries):
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
761 return '(%s)' % ('|'.join(re.escape(entry) + ' ' for entry in entries))
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
762
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
763 tokens = {
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
764 'root': [
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
765 # the comments - always starting with semicolon
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
766 # and going to the end of the line
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
767 (r';.*$', Comment.Single),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
768
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
769 # whitespaces - usually not relevant
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
770 (r'[,\s]+', Text),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
771
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
772 # numbers
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
773 (r'-?\d+\.\d+', Number.Float),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
774 (r'-?\d+', Number.Integer),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
775 (r'0x-?[abcdef\d]+', Number.Hex),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
776
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
777 # strings, symbols and characters
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
778 (r'"(\\\\|\\"|[^"])*"', String),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
779 (r"'" + valid_name, String.Symbol),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
780 (r"\\(.|[a-z]+)", String.Char),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
781
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
782 # keywords
2426
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
783 (r'::?' + valid_name, String.Symbol),
1705
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
784
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
785 # special operators
2426
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
786 (r'~@|[`\'#^~&@]', Operator),
1705
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
787
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
788 # highlight the special forms
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
789 (_multi_escape(special_forms), Keyword),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
790
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
791 # Technically, only the special forms are 'keywords'. The problem
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
792 # is that only treating them as keywords means that things like
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
793 # 'defn' and 'ns' need to be highlighted as builtins. This is ugly
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
794 # and weird for most styles. So, as a compromise we're going to
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
795 # highlight them as Keyword.Declarations.
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
796 (_multi_escape(declarations), Keyword.Declaration),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
797
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
798 # highlight the builtins
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
799 (_multi_escape(builtins), Name.Builtin),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
800
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
801 # the remaining functions
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
802 (r'(?<=\()' + valid_name, Name.Function),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
803
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
804 # find the remaining variables
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
805 (valid_name, Name.Variable),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
806
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
807 # Clojure accepts vector notation
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
808 (r'(\[|\])', Punctuation),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
809
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
810 # Clojure accepts map notation
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
811 (r'(\{|\})', Punctuation),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
812
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
813 # the famous parentheses!
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
814 (r'(\(|\))', Punctuation),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
815 ],
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
816 }
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
817
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
818
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
819 class TeaLangLexer(RegexLexer):
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
820 """
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
821 For `Tea <http://teatrove.org/>`_ source code. Only used within a
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
822 TeaTemplateLexer.
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
823
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
824 *New in Pygments 1.5.*
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
825 """
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
826
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
827 flags = re.MULTILINE | re.DOTALL
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
828
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
829 tokens = {
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
830 'root': [
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
831 # method names
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
832 (r'^(\s*(?:[a-zA-Z_][a-zA-Z0-9_\.\[\]]*\s+)+?)' # return arguments
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
833 r'([a-zA-Z_][a-zA-Z0-9_]*)' # method name
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
834 r'(\s*)(\()', # signature start
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
835 bygroups(using(this), Name.Function, Text, Operator)),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
836 (r'[^\S\n]+', Text),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
837 (r'//.*?\n', Comment.Single),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
838 (r'/\*.*?\*/', Comment.Multiline),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
839 (r'@[a-zA-Z_][a-zA-Z0-9_\.]*', Name.Decorator),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
840 (r'(and|break|else|foreach|if|in|not|or|reverse)\b',
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
841 Keyword),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
842 (r'(as|call|define)\b', Keyword.Declaration),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
843 (r'(true|false|null)\b', Keyword.Constant),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
844 (r'(template)(\s+)', bygroups(Keyword.Declaration, Text), 'template'),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
845 (r'(import)(\s+)', bygroups(Keyword.Namespace, Text), 'import'),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
846 (r'"(\\\\|\\"|[^"])*"', String),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
847 (r'\'(\\\\|\\\'|[^\'])*\'', String),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
848 (r'(\.)([a-zA-Z_][a-zA-Z0-9_]*)', bygroups(Operator, Name.Attribute)),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
849 (r'[a-zA-Z_][a-zA-Z0-9_]*:', Name.Label),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
850 (r'[a-zA-Z_\$][a-zA-Z0-9_]*', Name),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
851 (r'(isa|[.]{3}|[.]{2}|[=#!<>+-/%&;,.\*\\\(\)\[\]\{\}])', Operator),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
852 (r'[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float),
2426
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
853 (r'0x[0-9a-fA-F]+', Number.Hex),
1705
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
854 (r'[0-9]+L?', Number.Integer),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
855 (r'\n', Text)
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
856 ],
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
857 'template': [
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
858 (r'[a-zA-Z_][a-zA-Z0-9_]*', Name.Class, '#pop')
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
859 ],
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
860 'import': [
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
861 (r'[a-zA-Z0-9_.]+\*?', Name.Namespace, '#pop')
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
862 ],
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
863 }
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
864
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
865
2426
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
866 class CeylonLexer(RegexLexer):
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
867 """
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
868 For `Ceylon <http://ceylon-lang.org/>`_ source code.
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
869
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
870 *New in Pygments 1.6.*
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
871 """
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
872
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
873 name = 'Ceylon'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
874 aliases = ['ceylon']
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
875 filenames = ['*.ceylon']
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
876 mimetypes = ['text/x-ceylon']
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
877
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
878 flags = re.MULTILINE | re.DOTALL
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
879
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
880 #: optional Comment or Whitespace
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
881 _ws = r'(?:\s|//.*?\n|/[*].*?[*]/)+'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
882
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
883 tokens = {
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
884 'root': [
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
885 # method names
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
886 (r'^(\s*(?:[a-zA-Z_][a-zA-Z0-9_\.\[\]]*\s+)+?)' # return arguments
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
887 r'([a-zA-Z_][a-zA-Z0-9_]*)' # method name
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
888 r'(\s*)(\()', # signature start
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
889 bygroups(using(this), Name.Function, Text, Operator)),
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
890 (r'[^\S\n]+', Text),
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
891 (r'//.*?\n', Comment.Single),
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
892 (r'/\*.*?\*/', Comment.Multiline),
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
893 (r'(variable|shared|abstract|doc|by|formal|actual)',
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
894 Name.Decorator),
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
895 (r'(break|case|catch|continue|default|else|finally|for|in|'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
896 r'variable|if|return|switch|this|throw|try|while|is|exists|'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
897 r'nonempty|then|outer)\b', Keyword),
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
898 (r'(abstracts|extends|satisfies|adapts|'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
899 r'super|given|of|out|assign|'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
900 r'transient|volatile)\b', Keyword.Declaration),
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
901 (r'(function|value|void)\b',
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
902 Keyword.Type),
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
903 (r'(package)(\s+)', bygroups(Keyword.Namespace, Text)),
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
904 (r'(true|false|null)\b', Keyword.Constant),
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
905 (r'(class|interface|object)(\s+)',
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
906 bygroups(Keyword.Declaration, Text), 'class'),
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
907 (r'(import)(\s+)', bygroups(Keyword.Namespace, Text), 'import'),
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
908 (r'"(\\\\|\\"|[^"])*"', String),
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
909 (r"'\\.'|'[^\\]'|'\\u[0-9a-fA-F]{4}'", String.Quoted),
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
910 (r"`\\.`|`[^\\]`|`\\u[0-9a-fA-F]{4}`", String.Char),
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
911 (r'(\.)([a-zA-Z_][a-zA-Z0-9_]*)',
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
912 bygroups(Operator, Name.Attribute)),
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
913 (r'[a-zA-Z_][a-zA-Z0-9_]*:', Name.Label),
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
914 (r'[a-zA-Z_\$][a-zA-Z0-9_]*', Name),
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
915 (r'[~\^\*!%&\[\]\(\)\{\}<>\|+=:;,./?-]', Operator),
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
916 (r'\d{1,3}(_\d{3})+\.\d{1,3}(_\d{3})+[kMGTPmunpf]?', Number.Float),
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
917 (r'\d{1,3}(_\d{3})+\.[0-9]+([eE][+-]?[0-9]+)?[kMGTPmunpf]?',
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
918 Number.Float),
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
919 (r'[0-9][0-9]*\.\d{1,3}(_\d{3})+[kMGTPmunpf]?', Number.Float),
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
920 (r'[0-9][0-9]*\.[0-9]+([eE][+-]?[0-9]+)?[kMGTPmunpf]?',
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
921 Number.Float),
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
922 (r'0x[0-9a-fA-F]+', Number.Hex),
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
923 (r'\d{1,3}(_\d{3})+[kMGTP]?', Number.Integer),
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
924 (r'[0-9]+[kMGTP]?', Number.Integer),
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
925 (r'\n', Text)
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
926 ],
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
927 'class': [
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
928 (r'[a-zA-Z_][a-zA-Z0-9_]*', Name.Class, '#pop')
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
929 ],
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
930 'import': [
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
931 (r'[a-zA-Z0-9_.]+\w+ \{([a-zA-Z,]+|\.\.\.)\}',
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
932 Name.Namespace, '#pop')
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
933 ],
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
934 }
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
935
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
936
1705
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
937 class KotlinLexer(RegexLexer):
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
938 """
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
939 For `Kotlin <http://confluence.jetbrains.net/display/Kotlin/>`_
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
940 source code.
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
941
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
942 Additional options accepted:
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
943
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
944 `unicodelevel`
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
945 Determines which Unicode characters this lexer allows for identifiers.
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
946 The possible values are:
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
947
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
948 * ``none`` -- only the ASCII letters and numbers are allowed. This
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
949 is the fastest selection.
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
950 * ``basic`` -- all Unicode characters from the specification except
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
951 category ``Lo`` are allowed.
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
952 * ``full`` -- all Unicode characters as specified in the C# specs
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
953 are allowed. Note that this means a considerable slowdown since the
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
954 ``Lo`` category has more than 40,000 characters in it!
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
955
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
956 The default value is ``basic``.
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
957
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
958 *New in Pygments 1.5.*
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
959 """
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
960
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
961 name = 'Kotlin'
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
962 aliases = ['kotlin']
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
963 filenames = ['*.kt']
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
964 mimetypes = ['text/x-kotlin'] # inferred
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
965
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
966 flags = re.MULTILINE | re.DOTALL | re.UNICODE
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
967
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
968 # for the range of allowed unicode characters in identifiers,
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
969 # see http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-334.pdf
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
970
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
971 levels = {
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
972 'none': '@?[_a-zA-Z][a-zA-Z0-9_]*',
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
973 'basic': ('@?[_' + uni.Lu + uni.Ll + uni.Lt + uni.Lm + uni.Nl + ']' +
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
974 '[' + uni.Lu + uni.Ll + uni.Lt + uni.Lm + uni.Nl +
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
975 uni.Nd + uni.Pc + uni.Cf + uni.Mn + uni.Mc + ']*'),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
976 'full': ('@?(?:_|[^' +
2426
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
977 uni.allexcept('Lu', 'Ll', 'Lt', 'Lm', 'Lo', 'Nl') + '])'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
978 + '[^' + uni.allexcept('Lu', 'Ll', 'Lt', 'Lm', 'Lo', 'Nl',
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
979 'Nd', 'Pc', 'Cf', 'Mn', 'Mc') + ']*'),
1705
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
980 }
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
981
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
982 tokens = {}
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
983 token_variants = True
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
984
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
985 for levelname, cs_ident in list(levels.items()):
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
986 tokens[levelname] = {
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
987 'root': [
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
988 # method names
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
989 (r'^([ \t]*(?:' + cs_ident + r'(?:\[\])?\s+)+?)' # return type
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
990 r'(' + cs_ident + ')' # method name
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
991 r'(\s*)(\()', # signature start
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
992 bygroups(using(this), Name.Function, Text, Punctuation)),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
993 (r'^\s*\[.*?\]', Name.Attribute),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
994 (r'[^\S\n]+', Text),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
995 (r'\\\n', Text), # line continuation
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
996 (r'//.*?\n', Comment.Single),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
997 (r'/[*](.|\n)*?[*]/', Comment.Multiline),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
998 (r'\n', Text),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
999 (r'[~!%^&*()+=|\[\]:;,.<>/?-]', Punctuation),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1000 (r'[{}]', Punctuation),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1001 (r'@"(""|[^"])*"', String),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1002 (r'"(\\\\|\\"|[^"\n])*["\n]', String),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1003 (r"'\\.'|'[^\\]'", String.Char),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1004 (r"[0-9](\.[0-9]*)?([eE][+-][0-9]+)?"
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1005 r"[flFLdD]?|0[xX][0-9a-fA-F]+[Ll]?", Number),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1006 (r'#[ \t]*(if|endif|else|elif|define|undef|'
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1007 r'line|error|warning|region|endregion|pragma)\b.*?\n',
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1008 Comment.Preproc),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1009 (r'\b(extern)(\s+)(alias)\b', bygroups(Keyword, Text,
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1010 Keyword)),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1011 (r'(abstract|as|break|catch|'
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1012 r'fun|continue|default|delegate|'
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1013 r'do|else|enum|extern|false|finally|'
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1014 r'fixed|for|goto|if|implicit|in|interface|'
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1015 r'internal|is|lock|null|'
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1016 r'out|override|private|protected|public|readonly|'
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1017 r'ref|return|sealed|sizeof|'
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1018 r'when|this|throw|true|try|typeof|'
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1019 r'unchecked|unsafe|virtual|void|while|'
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1020 r'get|set|new|partial|yield|val|var)\b', Keyword),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1021 (r'(global)(::)', bygroups(Keyword, Punctuation)),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1022 (r'(bool|byte|char|decimal|double|dynamic|float|int|long|'
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1023 r'short)\b\??', Keyword.Type),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1024 (r'(class|struct)(\s+)', bygroups(Keyword, Text), 'class'),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1025 (r'(package|using)(\s+)', bygroups(Keyword, Text), 'package'),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1026 (cs_ident, Name),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1027 ],
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1028 'class': [
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1029 (cs_ident, Name.Class, '#pop')
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1030 ],
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1031 'package': [
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1032 (r'(?=\()', Text, '#pop'), # using (resource)
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1033 ('(' + cs_ident + r'|\.)+', Name.Namespace, '#pop')
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1034 ]
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1035 }
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1036
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1037 def __init__(self, **options):
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1038 level = get_choice_opt(options, 'unicodelevel', list(self.tokens.keys()),
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1039 'basic')
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1040 if level not in self._all_tokens:
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1041 # compile the regexes now
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1042 self._tokens = self.__class__.process_tokendef(level)
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1043 else:
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1044 self._tokens = self._all_tokens[level]
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1045
b0fbc9300f2b Update to Pygments 1.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1046 RegexLexer.__init__(self, **options)
2426
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
1047
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
1048
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
1049 class XtendLexer(RegexLexer):
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
1050 """
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
1051 For `Xtend <http://xtend-lang.org/>`_ source code.
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
1052
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
1053 *New in Pygments 1.6.*
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
1054 """
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
1055
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
1056 name = 'Xtend'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
1057 aliases = ['xtend']
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
1058 filenames = ['*.xtend']
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
1059 mimetypes = ['text/x-xtend']
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
1060
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
1061 flags = re.MULTILINE | re.DOTALL
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
1062
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
1063 tokens = {
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
1064 'root': [
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
1065 # method names
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
1066 (r'^(\s*(?:[a-zA-Z_][a-zA-Z0-9_\.\[\]]*\s+)+?)' # return arguments
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
1067 r'([a-zA-Z_$][a-zA-Z0-9_$]*)' # method name
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
1068 r'(\s*)(\()', # signature start
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
1069 bygroups(using(this), Name.Function, Text, Operator)),
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
1070 (r'[^\S\n]+', Text),
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
1071 (r'//.*?\n', Comment.Single),
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
1072 (r'/\*.*?\*/', Comment.Multiline),
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
1073 (r'@[a-zA-Z_][a-zA-Z0-9_\.]*', Name.Decorator),
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
1074 (r'(assert|break|case|catch|continue|default|do|else|finally|for|'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
1075 r'if|goto|instanceof|new|return|switch|this|throw|try|while|IF|'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
1076 r'ELSE|ELSEIF|ENDIF|FOR|ENDFOR|SEPARATOR|BEFORE|AFTER)\b',
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
1077 Keyword),
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
1078 (r'(def|abstract|const|enum|extends|final|implements|native|private|'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
1079 r'protected|public|static|strictfp|super|synchronized|throws|'
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
1080 r'transient|volatile)\b', Keyword.Declaration),
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
1081 (r'(boolean|byte|char|double|float|int|long|short|void)\b',
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
1082 Keyword.Type),
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
1083 (r'(package)(\s+)', bygroups(Keyword.Namespace, Text)),
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
1084 (r'(true|false|null)\b', Keyword.Constant),
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
1085 (r'(class|interface)(\s+)', bygroups(Keyword.Declaration, Text),
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
1086 'class'),
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
1087 (r'(import)(\s+)', bygroups(Keyword.Namespace, Text), 'import'),
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
1088 (r"(''')", String, 'template'),
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
1089 (r"(\u00BB)", String, 'template'),
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
1090 (r'"(\\\\|\\"|[^"])*"', String),
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset
1091 (r"'(\\\\|\\'|[^'])*'", String),
da76c71624de Updated to Pygments 1.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1705
diff changeset <