Pull requests

#90 Merged
Repository
kriegaex
Branch
default
Repository
birkenfeld
Branch
default

Add AspectJLexer as subclass of JavaLexer

Author
  1. Alexander Kriegisch
Reviewers
Description

[[http://www.eclipse.org/aspectj/|AspectJ]] is a JVM language and as such an extension of Java, providing new keywords and semantics. It is maintained within the Eclipse project and has a large user base.

AspectJLexer is very simple: It just subclasses JavaLexer, adds new keywords and takes care of a few AspectJ specialties I noticed when testing the lexer:

  • In {{{declare precedence: TracingAspect, LoggingAspect}}} the space before the colon is optional. If there is no space, JavaLexer thinks it has found a Java label. I have added special handling for that.

  • In {{{declare Marcus Wendt: foo}}} the {{{Marcus Wendt}}} is an AspectJ keyword rather than a Java annotation, so I also added special handling for that.

Disclaimer 1: I do not speak Python, so my code is probably awful.

Disclaimer 2: I do not claim AspectJLexer to be particularly well tested or sophisticated. It works very well for my AspectJ code, but I do not use all specialties of the language, so there might be some syntax highlighting issues I have missed. But I do think many users will be happy to get a Pygments highlighter for AspectJ.

  • Learn about pull requests

Comments (0)