l0bsterssg

node.js static responsive blog post generator
Log | Files | Refs | README

aspectj.js (4723B)


      1 /*
      2 Language: AspectJ
      3 Author: Hakan Ozler <ozler.hakan@gmail.com>
      4 Website: https://www.eclipse.org/aspectj/
      5 Description: Syntax Highlighting for the AspectJ Language which is a general-purpose aspect-oriented extension to the Java programming language.
      6  */
      7 
      8 /** @type LanguageFn */
      9 function aspectj(hljs) {
     10   var KEYWORDS =
     11     'false synchronized int abstract float private char boolean static null if const ' +
     12     'for true while long throw strictfp finally protected import native final return void ' +
     13     'enum else extends implements break transient new catch instanceof byte super volatile case ' +
     14     'assert short package default double public try this switch continue throws privileged ' +
     15     'aspectOf adviceexecution proceed cflowbelow cflow initialization preinitialization ' +
     16     'staticinitialization withincode target within execution getWithinTypeName handler ' +
     17     'thisJoinPoint thisJoinPointStaticPart thisEnclosingJoinPointStaticPart declare parents '+
     18     'warning error soft precedence thisAspectInstance';
     19   var SHORTKEYS = 'get set args call';
     20   return {
     21     name: 'AspectJ',
     22     keywords : KEYWORDS,
     23     illegal : /<\/|#/,
     24     contains : [
     25       hljs.COMMENT(
     26         '/\\*\\*',
     27         '\\*/',
     28         {
     29           relevance : 0,
     30           contains : [
     31             {
     32               // eat up @'s in emails to prevent them to be recognized as doctags
     33               begin: /\w+@/, relevance: 0
     34             },
     35             {
     36               className : 'doctag',
     37               begin : '@[A-Za-z]+'
     38             }
     39           ]
     40         }
     41       ),
     42       hljs.C_LINE_COMMENT_MODE,
     43       hljs.C_BLOCK_COMMENT_MODE,
     44       hljs.APOS_STRING_MODE,
     45       hljs.QUOTE_STRING_MODE,
     46       {
     47         className : 'class',
     48         beginKeywords : 'aspect',
     49         end : /[{;=]/,
     50         excludeEnd : true,
     51         illegal : /[:;"\[\]]/,
     52         contains : [
     53           {
     54             beginKeywords : 'extends implements pertypewithin perthis pertarget percflowbelow percflow issingleton'
     55           },
     56           hljs.UNDERSCORE_TITLE_MODE,
     57           {
     58             begin : /\([^\)]*/,
     59             end : /[)]+/,
     60             keywords : KEYWORDS + ' ' + SHORTKEYS,
     61             excludeEnd : false
     62           }
     63         ]
     64       },
     65       {
     66         className : 'class',
     67         beginKeywords : 'class interface',
     68         end : /[{;=]/,
     69         excludeEnd : true,
     70         relevance: 0,
     71         keywords : 'class interface',
     72         illegal : /[:"\[\]]/,
     73         contains : [
     74           {beginKeywords : 'extends implements'},
     75           hljs.UNDERSCORE_TITLE_MODE
     76         ]
     77       },
     78       {
     79         // AspectJ Constructs
     80         beginKeywords : 'pointcut after before around throwing returning',
     81         end : /[)]/,
     82         excludeEnd : false,
     83         illegal : /["\[\]]/,
     84         contains : [
     85           {
     86             begin : hljs.UNDERSCORE_IDENT_RE + '\\s*\\(',
     87             returnBegin : true,
     88             contains : [hljs.UNDERSCORE_TITLE_MODE]
     89           }
     90         ]
     91       },
     92       {
     93         begin : /[:]/,
     94         returnBegin : true,
     95         end : /[{;]/,
     96         relevance: 0,
     97         excludeEnd : false,
     98         keywords : KEYWORDS,
     99         illegal : /["\[\]]/,
    100         contains : [
    101           {
    102             begin : hljs.UNDERSCORE_IDENT_RE + '\\s*\\(',
    103             keywords : KEYWORDS + ' ' + SHORTKEYS,
    104             relevance: 0
    105           },
    106           hljs.QUOTE_STRING_MODE
    107         ]
    108       },
    109       {
    110         // this prevents 'new Name(...), or throw ...' from being recognized as a function definition
    111         beginKeywords : 'new throw',
    112         relevance : 0
    113       },
    114       {
    115         // the function class is a bit different for AspectJ compared to the Java language
    116         className : 'function',
    117         begin : /\w+ +\w+(\.)?\w+\s*\([^\)]*\)\s*((throws)[\w\s,]+)?[\{;]/,
    118         returnBegin : true,
    119         end : /[{;=]/,
    120         keywords : KEYWORDS,
    121         excludeEnd : true,
    122         contains : [
    123           {
    124             begin : hljs.UNDERSCORE_IDENT_RE + '\\s*\\(',
    125             returnBegin : true,
    126             relevance: 0,
    127             contains : [hljs.UNDERSCORE_TITLE_MODE]
    128           },
    129           {
    130             className : 'params',
    131             begin : /\(/, end : /\)/,
    132             relevance: 0,
    133             keywords : KEYWORDS,
    134             contains : [
    135               hljs.APOS_STRING_MODE,
    136               hljs.QUOTE_STRING_MODE,
    137               hljs.C_NUMBER_MODE,
    138               hljs.C_BLOCK_COMMENT_MODE
    139             ]
    140           },
    141           hljs.C_LINE_COMMENT_MODE,
    142           hljs.C_BLOCK_COMMENT_MODE
    143         ]
    144       },
    145       hljs.C_NUMBER_MODE,
    146       {
    147         // annotation is also used in this language
    148         className : 'meta',
    149         begin : '@[A-Za-z]+'
    150       }
    151     ]
    152   };
    153 }
    154 
    155 module.exports = aspectj;