aspectj.js 4.3 KB

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