summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2012-08-19 10:41:29 +0200
committerGeorg Brandl <georg@python.org>2012-08-19 10:41:29 +0200
commitb7effeecea6e64f4ed2b5c73ae325542e2115fa4 (patch)
tree7ede6f703ea7afdc9b9c8a4bd25efdad476abf10
parent8014741aa9e3dc21052f5d534fd2028d6489c4ee (diff)
parentffe56f5c28cb3285f1f6a435524984e582312cdb (diff)
downloadpygments-b7effeecea6e64f4ed2b5c73ae325542e2115fa4.tar.gz
Merge with kriegaex/pygments-main (pull request #90)
-rw-r--r--pygments/lexers/_mapping.py3
-rw-r--r--pygments/lexers/jvm.py41
2 files changed, 42 insertions, 2 deletions
diff --git a/pygments/lexers/_mapping.py b/pygments/lexers/_mapping.py
index 3f576bad..62351153 100644
--- a/pygments/lexers/_mapping.py
+++ b/pygments/lexers/_mapping.py
@@ -29,6 +29,7 @@ LEXERS = {
'AntlrRubyLexer': ('pygments.lexers.parsers', 'ANTLR With Ruby Target', ('antlr-ruby', 'antlr-rb'), ('*.G', '*.g'), ()),
'ApacheConfLexer': ('pygments.lexers.text', 'ApacheConf', ('apacheconf', 'aconf', 'apache'), ('.htaccess', 'apache.conf', 'apache2.conf'), ('text/x-apacheconf',)),
'AppleScriptLexer': ('pygments.lexers.other', 'AppleScript', ('applescript',), ('*.applescript',), ()),
+ 'AspectJLexer': ('pygments.lexers.jvm', 'AspectJ', ('aspectj',), ('*.aj',), ('text/x-aspectj',)),
'AsymptoteLexer': ('pygments.lexers.other', 'Asymptote', ('asy', 'asymptote'), ('*.asy',), ('text/x-asymptote',)),
'AutohotkeyLexer': ('pygments.lexers.other', 'autohotkey', ('ahk',), ('*.ahk', '*.ahkl'), ('text/x-autohotkey',)),
'AwkLexer': ('pygments.lexers.other', 'Awk', ('awk', 'gawk', 'mawk', 'nawk'), ('*.awk',), ('application/x-awk',)),
@@ -137,7 +138,7 @@ LEXERS = {
'JspLexer': ('pygments.lexers.templates', 'Java Server Page', ('jsp',), ('*.jsp',), ('application/x-jsp',)),
'JuliaConsoleLexer': ('pygments.lexers.math', 'Julia console', ('jlcon',), (), ()),
'JuliaLexer': ('pygments.lexers.math', 'Julia', ('julia', 'jl'), ('*.jl',), ('text/x-julia', 'application/x-julia')),
- 'KconfigLexer': ('pygments.lexers.other', 'Kconfig', ('kconfig', 'kbuild', 'menuconfig', 'linux-config', 'kernel-config'), ('*Config.in*', 'external.in*', 'standard-modules.in'), ('text/x-kconfig',)),
+ 'KconfigLexer': ('pygments.lexers.other', 'Kconfig', ('kconfig', 'menuconfig', 'linux-config', 'kernel-config'), ('Kconfig', '*Config.in*', 'external.in*', 'standard-modules.in'), ('text/x-kconfig',)),
'KotlinLexer': ('pygments.lexers.jvm', 'Kotlin', ('kotlin',), ('*.kt',), ('text/x-kotlin',)),
'LassoCssLexer': ('pygments.lexers.templates', 'CSS+Lasso', ('css+lasso',), (), ('text/css+lasso',)),
'LassoHtmlLexer': ('pygments.lexers.templates', 'HTML+Lasso', ('html+lasso',), (), ('text/html+lasso', 'application/x-httpd-lasso', 'application/x-httpd-lasso[89]')),
diff --git a/pygments/lexers/jvm.py b/pygments/lexers/jvm.py
index 50f3f4f7..e8e8ed7a 100644
--- a/pygments/lexers/jvm.py
+++ b/pygments/lexers/jvm.py
@@ -21,7 +21,7 @@ from pygments import unistring as uni
__all__ = ['JavaLexer', 'ScalaLexer', 'GosuLexer', 'GosuTemplateLexer',
'GroovyLexer', 'IokeLexer', 'ClojureLexer', 'KotlinLexer',
- 'XtendLexer']
+ 'XtendLexer', 'AspectJLexer']
class JavaLexer(RegexLexer):
@@ -79,6 +79,45 @@ class JavaLexer(RegexLexer):
}
+class AspectJLexer(JavaLexer):
+ """
+ For `AspectJ <http://www.eclipse.org/aspectj/>`_ source code.
+
+ *New in Pygments 1.6.*
+ """
+
+ name = 'AspectJ'
+ aliases = ['aspectj']
+ filenames = ['*.aj']
+ mimetypes = ['text/x-aspectj']
+
+ aj_keywords = [
+ 'aspect', 'pointcut', 'privileged', 'call', 'execution',
+ 'initialization', 'preinitialization', 'handler', 'get', 'set',
+ 'staticinitialization', 'target', 'args', 'within', 'withincode',
+ 'cflow', 'cflowbelow', 'annotation', 'before', 'after', 'around',
+ 'proceed', 'throwing', 'returning', 'adviceexecution', 'declare',
+ 'parents', 'warning', 'error', 'soft', 'precedence', 'thisJoinPoint',
+ 'thisJoinPointStaticPart', 'thisEnclosingJoinPointStaticPart',
+ 'issingleton', 'perthis', 'pertarget', 'percflow', 'percflowbelow',
+ 'pertypewithin', 'lock', 'unlock', 'thisAspectInstance'
+ ]
+ aj_inter_type = ['parents:', 'warning:', 'error:', 'soft:', 'precedence:']
+ aj_inter_type_annotation = ['@type', '@method', '@constructor', '@field']
+
+ def get_tokens_unprocessed(self, text):
+ for index, token, value in JavaLexer.get_tokens_unprocessed(self, text):
+ if token is Name and value in self.aj_keywords:
+ yield index, Keyword, value
+ elif token is Name.Label and value in self.aj_inter_type:
+ yield index, Keyword, value[:-1]
+ yield index, Operator, value[-1]
+ elif token is Name.Decorator and value in self.aj_inter_type_annotation:
+ yield index, Keyword, value
+ else:
+ yield index, token, value
+
+
class ScalaLexer(RegexLexer):
"""
For `Scala <http://www.scala-lang.org>`_ source code.