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