@exercism/codemirror-lang-abap 0.0.0-stage → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +115 -2
- package/dist/index.cjs +1011 -0
- package/dist/index.d.cts +21 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.js +1000 -0
- package/package.json +51 -4
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,1011 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var lr = require('@lezer/lr');
|
|
4
|
+
var language = require('@codemirror/language');
|
|
5
|
+
var highlight = require('@lezer/highlight');
|
|
6
|
+
var autocomplete = require('@codemirror/autocomplete');
|
|
7
|
+
|
|
8
|
+
// This file was generated by lezer-generator. You probably shouldn't edit it.
|
|
9
|
+
const StarComment = 1,
|
|
10
|
+
ComponentDash = 2,
|
|
11
|
+
OffsetPlus = 3,
|
|
12
|
+
LengthOpen = 4,
|
|
13
|
+
Identifier = 5,
|
|
14
|
+
CallName = 6,
|
|
15
|
+
Keyword = 7,
|
|
16
|
+
OperatorKeyword = 8,
|
|
17
|
+
TypeKeyword = 9,
|
|
18
|
+
Atom = 10,
|
|
19
|
+
Self = 11,
|
|
20
|
+
Class = 12,
|
|
21
|
+
Definition = 13,
|
|
22
|
+
Implementation = 14,
|
|
23
|
+
Deferred = 15,
|
|
24
|
+
EndClass = 16,
|
|
25
|
+
Visibility = 17,
|
|
26
|
+
Section = 18,
|
|
27
|
+
Inheriting = 19,
|
|
28
|
+
Friends = 20,
|
|
29
|
+
Interface = 21,
|
|
30
|
+
EndInterface = 22,
|
|
31
|
+
Method = 23,
|
|
32
|
+
EndMethod = 24,
|
|
33
|
+
Methods = 25,
|
|
34
|
+
ParameterKind = 26,
|
|
35
|
+
Raising = 27,
|
|
36
|
+
Optional = 28,
|
|
37
|
+
Default = 29,
|
|
38
|
+
Preferred = 30,
|
|
39
|
+
Value = 31,
|
|
40
|
+
Data = 32,
|
|
41
|
+
Types = 33,
|
|
42
|
+
FieldSymbols = 34,
|
|
43
|
+
Begin = 35,
|
|
44
|
+
End = 36,
|
|
45
|
+
Include = 37,
|
|
46
|
+
Type = 38,
|
|
47
|
+
If = 39,
|
|
48
|
+
ElseIf = 40,
|
|
49
|
+
Else = 41,
|
|
50
|
+
EndIf = 42,
|
|
51
|
+
Case = 43,
|
|
52
|
+
When = 44,
|
|
53
|
+
EndCase = 45,
|
|
54
|
+
Loop = 46,
|
|
55
|
+
EndLoop = 47,
|
|
56
|
+
At = 48,
|
|
57
|
+
EndAt = 49,
|
|
58
|
+
Do = 50,
|
|
59
|
+
EndDo = 51,
|
|
60
|
+
While = 52,
|
|
61
|
+
EndWhile = 53,
|
|
62
|
+
Try = 54,
|
|
63
|
+
Catch = 55,
|
|
64
|
+
Cleanup = 56,
|
|
65
|
+
EndTry = 57,
|
|
66
|
+
ConstructorOp = 58,
|
|
67
|
+
InlineDecl = 59,
|
|
68
|
+
InterpolationEnd = 80;
|
|
69
|
+
|
|
70
|
+
// The words of ABAP, shared by the tokenizer and the completion.
|
|
71
|
+
function list$1(text) {
|
|
72
|
+
return text.trim().split(/\s+/);
|
|
73
|
+
}
|
|
74
|
+
// Words that start a statement. The completion offers these first.
|
|
75
|
+
const statementKeywords$1 = list$1(`
|
|
76
|
+
ADD ALIASES APPEND ASSERT ASSIGN AT AUTHORITY-CHECK BREAK-POINT CALL CASE CATCH CHECK
|
|
77
|
+
CLASS CLASS-DATA CLASS-EVENTS CLASS-METHODS CLEANUP CLEAR CLOSE COLLECT COMMIT CONCATENATE
|
|
78
|
+
CONDENSE CONSTANTS CONTINUE CONVERT CREATE DATA DELETE DESCRIBE DIVIDE DO ELSE ELSEIF
|
|
79
|
+
ENDAT ENDCASE ENDCLASS ENDDO ENDIF ENDINTERFACE ENDLOOP ENDMETHOD ENDSELECT ENDTRY ENDWHILE
|
|
80
|
+
EVENTS EXIT FIELD-SYMBOLS FIND FORMAT FREE GET IF INCLUDE INSERT INTERFACE INTERFACES LEAVE
|
|
81
|
+
LOOP METHOD METHODS MESSAGE MODIFY MOVE MOVE-CORRESPONDING MULTIPLY OVERLAY RAISE READ
|
|
82
|
+
REFRESH REPLACE RESUME RETRY RETURN ROLLBACK SELECT SET SHIFT SORT SPLIT STATICS SUBTRACT
|
|
83
|
+
TRANSLATE TRY TYPES UNASSIGN UPDATE WHEN WHILE WRITE SEARCH
|
|
84
|
+
`);
|
|
85
|
+
// The other ABAP words, which come inside statements.
|
|
86
|
+
const additionKeywords = list$1(`
|
|
87
|
+
ABSTRACT ACCEPTING ACCORDING ADJACENT AFTER ALIAS ALL ALIGN AND ANY APPENDING AS ASCENDING
|
|
88
|
+
ASSIGNED ASSIGNING BACKWARD BASE BEFORE BEGIN BETWEEN BINARY BLANKS BOUND BOUNDARIES BY
|
|
89
|
+
BYPASSING BYTE BYTE-CA BYTE-CN BYTE-CO BYTE-CS BYTE-NA BYTE-NS CASTING CHANGING CHARACTER
|
|
90
|
+
CLIENT COMPARING COMPONENTS CORRESPONDING CREATE CRITICAL CURRENT DANGEROUS DECIMALS DEFAULT
|
|
91
|
+
DEFERRED DEFINITION DELETING DESCENDING DESTINATION DISTINCT DURATION EMPTY ENABLED END
|
|
92
|
+
ENDING ENTRIES ENUM EQ EVENT EXCEPTION EXCEPTIONS EXCLUDING EXISTS EXPORTING FIELDS FINAL
|
|
93
|
+
FIRST FOR FORWARD FRIENDS FROM FUNCTION GAPS GE GLOBAL GROUP GROUPS GT HARMLESS HASHED
|
|
94
|
+
HAVING IGNORING IMPLEMENTATION IMPORTING IN INDEX INHERITING INIT INITIAL INNER INSTANCE
|
|
95
|
+
INTO IS JOIN KEEPING KEY LANGUAGE LAST LE LEADING LEFT LENGTH LET LEVEL LIKE LINE LINES
|
|
96
|
+
LOAD LOCAL LONG LOWER LT MATCH MEDIUM MEMBERS MODE NE NEW NEXT NO NO-GAP NO-GAPS
|
|
97
|
+
NON-UNIQUE NOT OBJECT OCCURRENCE OCCURRENCES OCCURS OF OFF OPTIONAL ON ONLY OR ORDER
|
|
98
|
+
OTHERS OUTER PARAMETER PARAMETERS PART PERFORMING PREFERRED PRIMARY PRIVATE PROTECTED
|
|
99
|
+
PUBLIC RAISING RANGE READ-ONLY RECEIVING REDEFINITION REF REFERENCE REGEX RESPECTING
|
|
100
|
+
RESUMABLE RETURNING RIGHT RISK ROWS SECONDARY SECTION SEPARATED SHORT SINGLE SIZE SORTED
|
|
101
|
+
STABLE STANDARD STEP STRUCTURE SUBMATCHES SUBSTRING SUPPLIED TABLE TESTING THEN TIMES TO
|
|
102
|
+
TRAILING TRANSPORTING TYPE UNDER UNIQUE UNIT UNTIL UNWIND UP UPPER USING VALUE VALUES
|
|
103
|
+
THROW VARYING WHERE WITH WITHOUT PLACES CIRCULAR MAXIMUM MINIMUM
|
|
104
|
+
`);
|
|
105
|
+
const keywords = new Set([...statementKeywords$1, ...additionKeywords]);
|
|
106
|
+
const operatorKeywords = new Set(list$1(`
|
|
107
|
+
AND OR NOT EQUIV XOR EQ NE LT GT LE GE CO CN CA NA CS NS CP NP MOD DIV IS IN BETWEEN
|
|
108
|
+
BIT-AND BIT-OR BIT-XOR BIT-NOT BYTE-CA BYTE-CN BYTE-CO BYTE-CS BYTE-NA BYTE-NS
|
|
109
|
+
`));
|
|
110
|
+
// The words between TYPE and the name of a type.
|
|
111
|
+
const typeKeywords = new Set(list$1(`
|
|
112
|
+
REF TO STANDARD SORTED HASHED TABLE OF LINE RANGE ANY INDEX
|
|
113
|
+
`));
|
|
114
|
+
const atoms = new Set(list$1(`ABAP_TRUE ABAP_FALSE ABAP_UNDEFINED SPACE`));
|
|
115
|
+
const constructorOperators = new Set(list$1(`
|
|
116
|
+
NEW VALUE CONV CORRESPONDING CAST REF EXACT REDUCE FILTER COND SWITCH
|
|
117
|
+
`));
|
|
118
|
+
const builtinFunctions = list$1(`
|
|
119
|
+
abs ceil floor frac sign trunc ipow nmax nmin round rescale sqrt exp log log10
|
|
120
|
+
sin cos tan asin acos atan sinh cosh tanh
|
|
121
|
+
strlen xstrlen numofchar charlen dbmaxlen lines line_exists line_index
|
|
122
|
+
boolc boolx xsdbool char_off cmax cmin concat_lines_of condense contains
|
|
123
|
+
contains_any_of contains_any_not_of count count_any_of count_any_not_of distance
|
|
124
|
+
escape find find_end find_any_of find_any_not_of insert match matches repeat replace
|
|
125
|
+
reverse segment shift_left shift_right substring substring_after substring_before
|
|
126
|
+
substring_from substring_to to_lower to_upper to_mixed from_mixed translate
|
|
127
|
+
utclong_current utclong_add utclong_diff
|
|
128
|
+
`);
|
|
129
|
+
const builtinTypes = list$1(`
|
|
130
|
+
i int8 f p c n d t x b s string xstring decfloat16 decfloat34 utclong abap_bool
|
|
131
|
+
any clike csequence data decfloat numeric object simple xsequence
|
|
132
|
+
`);
|
|
133
|
+
const builtinConstants = list$1(`abap_true abap_false abap_undefined space me sy`);
|
|
134
|
+
|
|
135
|
+
const newline = 10, carriageReturn = 13, space = 32, tab = 9;
|
|
136
|
+
const star = 42, hyphen = 45, plus = 43, openParen = 40, closeParen = 41;
|
|
137
|
+
const openBracket = 91, closeBracket = 93, greaterThan = 62, lessThan = 60;
|
|
138
|
+
const equals = 61, tilde = 126, hash = 35, question = 63, ampersand = 38, slash = 47;
|
|
139
|
+
const underscore = 95;
|
|
140
|
+
function isLetter(ch) {
|
|
141
|
+
return (ch >= 65 && ch <= 90) || (ch >= 97 && ch <= 122);
|
|
142
|
+
}
|
|
143
|
+
function isWordStart(ch) {
|
|
144
|
+
return isLetter(ch) || ch == underscore;
|
|
145
|
+
}
|
|
146
|
+
function isWordChar(ch) {
|
|
147
|
+
return isLetter(ch) || ch == underscore || (ch >= 48 && ch <= 57);
|
|
148
|
+
}
|
|
149
|
+
function isSpace(ch) {
|
|
150
|
+
return ch == space || ch == tab || ch == newline || ch == carriageReturn;
|
|
151
|
+
}
|
|
152
|
+
// A `*` in the first column makes the whole line a comment.
|
|
153
|
+
const starComment = new lr.ExternalTokenizer((input) => {
|
|
154
|
+
if (input.next != star)
|
|
155
|
+
return;
|
|
156
|
+
let prev = input.peek(-1);
|
|
157
|
+
if (prev != -1 && prev != newline)
|
|
158
|
+
return;
|
|
159
|
+
let len = 1;
|
|
160
|
+
while (input.peek(len) != newline && input.peek(len) != -1)
|
|
161
|
+
len++;
|
|
162
|
+
input.acceptToken(StarComment, len);
|
|
163
|
+
});
|
|
164
|
+
// ABAP needs spaces around its operators, so a `-`, `+` or `(` written
|
|
165
|
+
// straight after a name means something else: `ls_line-name` selects a
|
|
166
|
+
// component, and `text+2(3)` takes three characters from the third.
|
|
167
|
+
const tightPunctuation = new lr.ExternalTokenizer((input, stack) => {
|
|
168
|
+
let next = input.next, prev = input.peek(-1), after = input.peek(1);
|
|
169
|
+
let afterName = isWordChar(prev) || prev == greaterThan || prev == closeBracket || prev == closeParen;
|
|
170
|
+
if (next == hyphen) {
|
|
171
|
+
if (afterName && isWordChar(after) && stack.canShift(ComponentDash))
|
|
172
|
+
input.acceptToken(ComponentDash, 1);
|
|
173
|
+
}
|
|
174
|
+
else if (next == plus) {
|
|
175
|
+
if ((isWordChar(prev) || prev == greaterThan) && isWordChar(after) && stack.canShift(OffsetPlus))
|
|
176
|
+
input.acceptToken(OffsetPlus, 1);
|
|
177
|
+
}
|
|
178
|
+
else if (next == openParen) {
|
|
179
|
+
if ((isWordChar(prev) || prev == greaterThan) && !isSpace(after) && after != closeParen && after != -1 &&
|
|
180
|
+
stack.canShift(LengthOpen))
|
|
181
|
+
input.acceptToken(LengthOpen, 1);
|
|
182
|
+
}
|
|
183
|
+
}, { contextual: true });
|
|
184
|
+
const specific = {
|
|
185
|
+
CLASS: Class, DEFINITION: Definition, IMPLEMENTATION: Implementation,
|
|
186
|
+
DEFERRED: Deferred, LOAD: Deferred, ENDCLASS: EndClass,
|
|
187
|
+
PUBLIC: Visibility, PROTECTED: Visibility, PRIVATE: Visibility, SECTION: Section,
|
|
188
|
+
INHERITING: Inheriting, FRIENDS: Friends, INTERFACE: Interface, ENDINTERFACE: EndInterface,
|
|
189
|
+
METHOD: Method, ENDMETHOD: EndMethod, METHODS: Methods, "CLASS-METHODS": Methods,
|
|
190
|
+
IMPORTING: ParameterKind, EXPORTING: ParameterKind, CHANGING: ParameterKind, RETURNING: ParameterKind,
|
|
191
|
+
RAISING: Raising, OPTIONAL: Optional, DEFAULT: Default, PREFERRED: Preferred,
|
|
192
|
+
DATA: Data, "CLASS-DATA": Data, STATICS: Data, CONSTANTS: Data,
|
|
193
|
+
TYPES: Types, "FIELD-SYMBOLS": FieldSymbols,
|
|
194
|
+
BEGIN: Begin, END: End, INCLUDE: Include, TYPE: Type, LIKE: Type,
|
|
195
|
+
IF: If, ELSEIF: ElseIf, ELSE: Else, ENDIF: EndIf,
|
|
196
|
+
CASE: Case, WHEN: When, ENDCASE: EndCase,
|
|
197
|
+
LOOP: Loop, ENDLOOP: EndLoop, AT: At, ENDAT: EndAt,
|
|
198
|
+
DO: Do, ENDDO: EndDo, WHILE: While, ENDWHILE: EndWhile,
|
|
199
|
+
TRY: Try, CATCH: Catch, CLEANUP: Cleanup, ENDTRY: EndTry,
|
|
200
|
+
};
|
|
201
|
+
// Words that open a bracket straight after them: DATA(x) and
|
|
202
|
+
// FIELD-SYMBOL(<fs>) declare a name, and VALUE(x) passes a parameter by value.
|
|
203
|
+
const inlineWords = new Set(["DATA", "FINAL", "FIELD-SYMBOL"]);
|
|
204
|
+
const parenWords = new Set(["VALUE", "REFERENCE", "RESUMABLE"]);
|
|
205
|
+
// If one of these words comes before TYPE, it is still a keyword, as in
|
|
206
|
+
// `RAISE EXCEPTION TYPE cx_x`.
|
|
207
|
+
const beforeType = new Set(["EXCEPTION", "CASE", "WHEN", "BASE", "OBJECT", "CREATE", "RAISE", "OTHERS", "DATA"]);
|
|
208
|
+
function readWord(input, from) {
|
|
209
|
+
let end = from;
|
|
210
|
+
while (isWordChar(input.peek(end)))
|
|
211
|
+
end++;
|
|
212
|
+
let text = "";
|
|
213
|
+
for (let i = from; i < end; i++)
|
|
214
|
+
text += String.fromCharCode(input.peek(i));
|
|
215
|
+
return { end, text: text.toUpperCase() };
|
|
216
|
+
}
|
|
217
|
+
function skipSpaces(input, from) {
|
|
218
|
+
while (isSpace(input.peek(from)))
|
|
219
|
+
from++;
|
|
220
|
+
return from;
|
|
221
|
+
}
|
|
222
|
+
// The words before the token, latest first, read back over spaces on the
|
|
223
|
+
// same statement.
|
|
224
|
+
function previousWords(input, count) {
|
|
225
|
+
let result = [];
|
|
226
|
+
let pos = -1;
|
|
227
|
+
while (result.length < count) {
|
|
228
|
+
while (input.peek(pos) == space || input.peek(pos) == tab || input.peek(pos) == newline || input.peek(pos) == carriageReturn)
|
|
229
|
+
pos--;
|
|
230
|
+
let end = pos + 1;
|
|
231
|
+
while (isWordChar(input.peek(pos)))
|
|
232
|
+
pos--;
|
|
233
|
+
if (end == pos + 1)
|
|
234
|
+
break;
|
|
235
|
+
let text = "";
|
|
236
|
+
for (let i = pos + 1; i < end; i++)
|
|
237
|
+
text += String.fromCharCode(input.peek(i));
|
|
238
|
+
result.push(text.toUpperCase());
|
|
239
|
+
}
|
|
240
|
+
return result;
|
|
241
|
+
}
|
|
242
|
+
// `x = 1`, `x += 1` and `x ?= y` assign to x, so x is a name.
|
|
243
|
+
function isAssignment(input, pos) {
|
|
244
|
+
let a = input.peek(pos), b = input.peek(pos + 1), c = input.peek(pos + 2);
|
|
245
|
+
if (a == equals)
|
|
246
|
+
return b != greaterThan && b != lessThan;
|
|
247
|
+
if ((a == plus || a == hyphen || a == star || a == slash || a == question) && b == equals)
|
|
248
|
+
return true;
|
|
249
|
+
return a == ampersand && b == ampersand && c == equals;
|
|
250
|
+
}
|
|
251
|
+
// The type after TYPE, LIKE, REF TO or TABLE OF is a name, even if it is
|
|
252
|
+
// also an ABAP word, as in `TYPE REF TO data`.
|
|
253
|
+
const statementKeywords = new Set(statementKeywords$1);
|
|
254
|
+
const operatorChars = new Set([equals, lessThan, greaterThan, plus, hyphen, star, slash, ampersand]);
|
|
255
|
+
const openers = new Set([openParen, openBracket, 123]);
|
|
256
|
+
const closers = new Set([closeParen, closeBracket, 125]);
|
|
257
|
+
// The character before the word, skipping spaces. A `>` closing a field
|
|
258
|
+
// symbol such as `<fs>`, or the `*` of `ref->*`, doesn't count as an operator.
|
|
259
|
+
function previousChar(input) {
|
|
260
|
+
let pos = -1;
|
|
261
|
+
while (isSpace(input.peek(pos)))
|
|
262
|
+
pos--;
|
|
263
|
+
let ch = input.peek(pos), before = input.peek(pos - 1);
|
|
264
|
+
if (operatorChars.has(ch) && !isSpace(before) && !operatorChars.has(before))
|
|
265
|
+
return -1;
|
|
266
|
+
if (ch == star && before == greaterThan)
|
|
267
|
+
return -1;
|
|
268
|
+
return ch;
|
|
269
|
+
}
|
|
270
|
+
// Words that can end an expression, as in `( x IS INITIAL )`.
|
|
271
|
+
const closingWords = new Set(list("INITIAL BOUND ASSIGNED SUPPLIED SIZE ASCENDING DESCENDING KEY OTHERS"));
|
|
272
|
+
// After these words, the next word is an operand, as in `count DIV rows`.
|
|
273
|
+
const beforeOperand = new Set(list(`
|
|
274
|
+
MOD DIV AND OR EQ NE LT GT LE GE CO CN CA NA CS NS CP NP EQUIV XOR BIT-AND BIT-OR BIT-XOR
|
|
275
|
+
DO SUBMATCHES KEY COMPONENTS
|
|
276
|
+
`));
|
|
277
|
+
function list(text) {
|
|
278
|
+
return text.trim().split(/\s+/);
|
|
279
|
+
}
|
|
280
|
+
// A word used as an operand is a name, even if it is also an ABAP word:
|
|
281
|
+
// `index < 0`, `x = table`, `{ unit }` or `DO rows TIMES`.
|
|
282
|
+
function isOperand(input, word, pos, following) {
|
|
283
|
+
if (operatorKeywords.has(word))
|
|
284
|
+
return false;
|
|
285
|
+
let before = previousChar(input), next = input.peek(pos);
|
|
286
|
+
if (openers.has(before) && closers.has(next))
|
|
287
|
+
return true;
|
|
288
|
+
if (closers.has(next) && !closingWords.has(word)) {
|
|
289
|
+
let [last] = previousWords(input, 1);
|
|
290
|
+
if (last == "ELSE" || last == "THEN")
|
|
291
|
+
return true;
|
|
292
|
+
}
|
|
293
|
+
if (operatorChars.has(before))
|
|
294
|
+
return !(word == "GROUP" && (following === null || following === void 0 ? void 0 : following.text) == "SIZE");
|
|
295
|
+
if (operatorChars.has(next) && isSpace(input.peek(pos + 1)) && !statementKeywords.has(word) &&
|
|
296
|
+
word != "SINGLE" && word != "DISTINCT")
|
|
297
|
+
return true;
|
|
298
|
+
if ((next == lessThan || next == greaterThan) && input.peek(pos + 1) != next && isSpace(input.peek(pos + 2)) &&
|
|
299
|
+
!statementKeywords.has(word))
|
|
300
|
+
return true;
|
|
301
|
+
if ((following === null || following === void 0 ? void 0 : following.text) == "IN")
|
|
302
|
+
return true;
|
|
303
|
+
let [last, beforeLast] = previousWords(input, 2);
|
|
304
|
+
if (last && beforeOperand.has(last))
|
|
305
|
+
return true;
|
|
306
|
+
if (last && operandStatements.has(last) && !statementAdditions.has(word) && startsStatement(input))
|
|
307
|
+
return true;
|
|
308
|
+
if (last == "AT" && beforeLast == "LOOP")
|
|
309
|
+
return word != "GROUP" && word != "SCREEN";
|
|
310
|
+
return false;
|
|
311
|
+
}
|
|
312
|
+
// After these words at the start of a statement, the next word is an
|
|
313
|
+
// operand unless it is one of the additions, as in `APPEND line TO result`
|
|
314
|
+
// and `APPEND LINES OF x TO result`.
|
|
315
|
+
const operandStatements = new Set(list(`
|
|
316
|
+
APPEND INSERT CLEAR FREE CONDENSE SPLIT SORT COLLECT TRANSLATE SHIFT CHECK WRITE ASSIGN
|
|
317
|
+
MOVE ADD SUBTRACT MULTIPLY DIVIDE UNASSIGN CONCATENATE
|
|
318
|
+
`));
|
|
319
|
+
const statementAdditions = new Set(list(`
|
|
320
|
+
LINES INITIAL TABLE ALL FIRST CORRESPONDING COMPONENT LEFT RIGHT CIRCULAR DELETING INTO
|
|
321
|
+
AT NOT SORTED STANDARD HASHED
|
|
322
|
+
`));
|
|
323
|
+
// Whether the word before the token starts its statement.
|
|
324
|
+
function startsStatement(input) {
|
|
325
|
+
let pos = -1;
|
|
326
|
+
while (isSpace(input.peek(pos)))
|
|
327
|
+
pos--;
|
|
328
|
+
while (isWordChar(input.peek(pos)) || input.peek(pos) == hyphen)
|
|
329
|
+
pos--;
|
|
330
|
+
while (input.peek(pos) == space || input.peek(pos) == tab)
|
|
331
|
+
pos--;
|
|
332
|
+
if (input.peek(pos) == newline || input.peek(pos) == -1)
|
|
333
|
+
return true;
|
|
334
|
+
while (isSpace(input.peek(pos)))
|
|
335
|
+
pos--;
|
|
336
|
+
let ch = input.peek(pos);
|
|
337
|
+
return ch == 46 /* . */ || ch == 58 /* : */;
|
|
338
|
+
}
|
|
339
|
+
// The formatting options in a string template, as in `{ x WIDTH = 5 ALIGN = RIGHT }`.
|
|
340
|
+
const formatOptions = new Set(list(`
|
|
341
|
+
WIDTH ALIGN PAD CASE SIGN EXPONENT DECIMALS ZERO XSD STYLE CURRENCY NUMBER DATE TIME
|
|
342
|
+
TIMESTAMP TIMEZONE COUNTRY ALPHA
|
|
343
|
+
`));
|
|
344
|
+
const formatValues = new Set(list("LEFT RIGHT CENTER ISO USER ENVIRONMENT RAW UPPER LOWER IN OUT"));
|
|
345
|
+
function inTypePosition(input) {
|
|
346
|
+
let [last, before] = previousWords(input, 2);
|
|
347
|
+
if (last == "TYPE" || last == "LIKE")
|
|
348
|
+
return true;
|
|
349
|
+
if (last == "TO")
|
|
350
|
+
return before == "REF";
|
|
351
|
+
if (last == "OF")
|
|
352
|
+
return before == "TABLE" || before == "LINE" || before == "RANGE";
|
|
353
|
+
return false;
|
|
354
|
+
}
|
|
355
|
+
function classify(input, stack, word, len) {
|
|
356
|
+
let after = input.peek(len);
|
|
357
|
+
if (word == "ME" && stack.canShift(Self))
|
|
358
|
+
return Self;
|
|
359
|
+
if (atoms.has(word) && stack.canShift(Atom))
|
|
360
|
+
return Atom;
|
|
361
|
+
if (after == openParen) {
|
|
362
|
+
let inside = input.peek(len + 1);
|
|
363
|
+
if (inlineWords.has(word) && stack.canShift(InlineDecl))
|
|
364
|
+
return InlineDecl;
|
|
365
|
+
if (parenWords.has(word) && stack.canShift(Value))
|
|
366
|
+
return Value;
|
|
367
|
+
if ((isSpace(inside) || inside == closeParen) && stack.canShift(CallName))
|
|
368
|
+
return CallName;
|
|
369
|
+
return Identifier;
|
|
370
|
+
}
|
|
371
|
+
if (after == openBracket || after == tilde)
|
|
372
|
+
return Identifier;
|
|
373
|
+
if (after == hyphen && (isWordChar(input.peek(len + 1)) || input.peek(len + 1) == greaterThan))
|
|
374
|
+
return Identifier;
|
|
375
|
+
if (after == equals && input.peek(len + 1) == greaterThan)
|
|
376
|
+
return Identifier;
|
|
377
|
+
if (after == plus && isWordChar(input.peek(len + 1)))
|
|
378
|
+
return Identifier;
|
|
379
|
+
let pos = skipSpaces(input, len);
|
|
380
|
+
if (stack.canShift(InterpolationEnd) && stack.canShift(Keyword)) {
|
|
381
|
+
if (formatOptions.has(word) && input.peek(pos) == equals)
|
|
382
|
+
return Keyword;
|
|
383
|
+
if (formatValues.has(word) && previousChar(input) == equals)
|
|
384
|
+
return Keyword;
|
|
385
|
+
}
|
|
386
|
+
if (isAssignment(input, pos) && stack.canShift(Identifier))
|
|
387
|
+
return Identifier;
|
|
388
|
+
let following = isWordStart(input.peek(pos)) ? readWord(input, pos) : null;
|
|
389
|
+
if (following && (following.text == "TYPE" || following.text == "LIKE") && !beforeType.has(word) &&
|
|
390
|
+
stack.canShift(Identifier))
|
|
391
|
+
return Identifier;
|
|
392
|
+
let anyType = (word == "ANY" || word == "INDEX") && (following === null || following === void 0 ? void 0 : following.text) != "TABLE";
|
|
393
|
+
if ((!typeKeywords.has(word) || anyType) && inTypePosition(input) && stack.canShift(Identifier))
|
|
394
|
+
return Identifier;
|
|
395
|
+
if (constructorOperators.has(word) && stack.canShift(ConstructorOp)) {
|
|
396
|
+
let next = input.peek(pos);
|
|
397
|
+
if (next == hash)
|
|
398
|
+
return ConstructorOp;
|
|
399
|
+
if (following) {
|
|
400
|
+
let close = input.peek(following.end);
|
|
401
|
+
if (close == openParen || (close == equals && input.peek(following.end + 1) == greaterThan))
|
|
402
|
+
return ConstructorOp;
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
let term = specific[word];
|
|
406
|
+
if (term == Begin || term == End) {
|
|
407
|
+
if ((following === null || following === void 0 ? void 0 : following.text) != "OF")
|
|
408
|
+
term = undefined;
|
|
409
|
+
}
|
|
410
|
+
if (word == "LOCAL" && (following === null || following === void 0 ? void 0 : following.text) == "FRIENDS")
|
|
411
|
+
term = Deferred;
|
|
412
|
+
if (term != undefined && stack.canShift(term))
|
|
413
|
+
return term;
|
|
414
|
+
if (isOperand(input, word, pos, following) && stack.canShift(Identifier))
|
|
415
|
+
return Identifier;
|
|
416
|
+
if (typeKeywords.has(word) && stack.canShift(TypeKeyword)) {
|
|
417
|
+
// `TYPE ANY TABLE` uses ANY as a keyword, and `TYPE any` names a type.
|
|
418
|
+
if ((word != "ANY" && word != "INDEX") || (following === null || following === void 0 ? void 0 : following.text) == "TABLE")
|
|
419
|
+
return TypeKeyword;
|
|
420
|
+
}
|
|
421
|
+
if (operatorKeywords.has(word) && stack.canShift(OperatorKeyword))
|
|
422
|
+
return OperatorKeyword;
|
|
423
|
+
// LINE and LINES are common names, and keywords only in `INITIAL LINE`
|
|
424
|
+
// and `LINES OF`.
|
|
425
|
+
if (word == "LINE" || word == "LINES") {
|
|
426
|
+
let [last] = previousWords(input, 1);
|
|
427
|
+
let keyword = (following === null || following === void 0 ? void 0 : following.text) == "OF" || (word == "LINE" && last == "INITIAL");
|
|
428
|
+
return keyword && stack.canShift(Keyword) ? Keyword : Identifier;
|
|
429
|
+
}
|
|
430
|
+
if ((keywords.has(word) || term != undefined) && stack.canShift(Keyword))
|
|
431
|
+
return Keyword;
|
|
432
|
+
return Identifier;
|
|
433
|
+
}
|
|
434
|
+
const hyphenTerms = {
|
|
435
|
+
"CLASS-DATA": Data, "CLASS-METHODS": Methods, "FIELD-SYMBOLS": FieldSymbols,
|
|
436
|
+
};
|
|
437
|
+
const words = new lr.ExternalTokenizer((input, stack) => {
|
|
438
|
+
if (!isWordStart(input.next))
|
|
439
|
+
return;
|
|
440
|
+
let { end, text } = readWord(input, 0);
|
|
441
|
+
// Keywords such as CLASS-DATA and NO-GAPS are written with hyphens.
|
|
442
|
+
let pos = end;
|
|
443
|
+
while (input.peek(pos) == hyphen && isWordStart(input.peek(pos + 1))) {
|
|
444
|
+
let segment = readWord(input, pos + 1);
|
|
445
|
+
let full = "";
|
|
446
|
+
for (let i = 0; i < segment.end; i++)
|
|
447
|
+
full += String.fromCharCode(input.peek(i));
|
|
448
|
+
full = full.toUpperCase();
|
|
449
|
+
pos = segment.end;
|
|
450
|
+
if (full == "FIELD-SYMBOL" && input.peek(pos) == openParen && stack.canShift(InlineDecl)) {
|
|
451
|
+
input.acceptToken(InlineDecl, pos);
|
|
452
|
+
return;
|
|
453
|
+
}
|
|
454
|
+
if (keywords.has(full) || operatorKeywords.has(full) || hyphenTerms[full]) {
|
|
455
|
+
let term = hyphenTerms[full];
|
|
456
|
+
if (term != undefined && stack.canShift(term))
|
|
457
|
+
return input.acceptToken(term, pos);
|
|
458
|
+
if (operatorKeywords.has(full) && stack.canShift(OperatorKeyword))
|
|
459
|
+
return input.acceptToken(OperatorKeyword, pos);
|
|
460
|
+
if (stack.canShift(Keyword))
|
|
461
|
+
return input.acceptToken(Keyword, pos);
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
input.acceptToken(classify(input, stack, text, end), end);
|
|
465
|
+
}, { contextual: true });
|
|
466
|
+
|
|
467
|
+
// This file was generated by lezer-generator. You probably shouldn't edit it.
|
|
468
|
+
const parser = lr.LRParser.deserialize({
|
|
469
|
+
version: 14,
|
|
470
|
+
states: "!)bQ`Q_OOO$XO`O'#DzO&jQ_O'#E_O&qQ_O'#EbO&xQXO'#EcO&}Q]O'#EeO'YQXO'#EgO'_Q]O'#EjO'gQ]O'#EmO'oQ_O'#EnO*hQ]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V$[$w$y%r%t&o'X]&l$x&j&m(R)Y)oR!`]Q!^]Q#p!_R%R#m!pbOn!z#O#Q#S#T$_$b$h$l$n$p$x%u&R&U&X&j&m'^'d'f'j'n'p'}(R(m(t({)P)Y)_)f)o)r)x){`sQRouwy#X#`S!rb!s!c!xdefgh!]!d!n!y!{!}#P#R#l#s$T$d$i%Q%V%w&Q&W&c&q&s'c'|(|)g)i)watQRouwy#X#`R!g^Q!e^Q#w!fR%W#tR!l_Q!j_Q$S!kR%j$PT#}!i$OT%a#y%cX&y%a&z&{(]R(Z&xR!q`Q!o`Q$X!pR%n$UT']%u'^T)](f)^Q$`!zQ$o#QQ$q#SQ$r#TQ%v$_Q&[$nQ&^$pQ'k&RQ(n'dQ(o'fQ(q'jQ)Q'}Q)c(mQ)h({Q)k)PQ)s)_Q)v)fQ)y)rQ)|)xR*P){SlOnz$a!z#Q#S#T$_$b$n$p&R'd'f'j'}(m({)P)_)f)r)x){`$j#O$h$l&U&X'n'p(tT'[%u'^a$k#O$h$l&U&X'n'p(t",
|
|
473
|
+
nodeNames: "⚠ StarComment ComponentDash OffsetPlus LengthOpen Identifier CallName Keyword OperatorKeyword TypeKeyword Atom Self Class Definition Implementation Deferred EndClass Visibility Section Inheriting Friends Interface EndInterface Method EndMethod Methods ParameterKind Raising Optional Default Preferred Value Data Types FieldSymbols Begin End Include Type If ElseIf Else EndIf Case When EndCase Loop EndLoop At EndAt Do EndDo While EndWhile Try Catch Cleanup EndTry ConstructorOp InlineDecl LineComment Pragma Program . ClassDefinition ClassDefName TypeName => ~ VisibilitySection DataDeclaration : VariableDefinition Number String BackquoteString StringTemplate | TemplateContent TemplateEscape } Interpolation { , | ArithOp CompareOp UpdateOp = # ! @ ->* ) ( ParenGroup ] [ TableExpression Call ArgList ConstructorExpression ConstructorType InlineDeclaration FieldSymbolDefinition FieldSymbol MemberAccess -> PropertyName ComponentAccess TypeClause Offset Length TypesDeclaration TypeDefinition MethodsDeclaration MethodDefinition ParameterList Parameter ParameterDefinition RaisingClause ExceptionName PreferredParameter FieldSymbolsDeclaration Statement ClassDeclaration ClassImplementation ClassName MethodImplementation MethodName IfStatement ElseIfClause ElseClause CaseStatement WhenClause LoopStatement AtBlock DoStatement WhileStatement TryStatement CatchClause CleanupClause InterfaceDefinition InterfaceDefName InterfaceDeclaration",
|
|
474
|
+
maxTerm: 198,
|
|
475
|
+
nodeProps: [
|
|
476
|
+
["openedBy", 93,"(",96,"["],
|
|
477
|
+
["closedBy", 94,")",97,"]"]
|
|
478
|
+
],
|
|
479
|
+
skippedNodes: [0,1,60,61],
|
|
480
|
+
repeatNodeCount: 28,
|
|
481
|
+
tokenData: "*w~RnXY#PYZ#P]^#Ppq#Pqr#brs#gst$Ovw$xwx%_xy&Syz&Xz{&^{|%Q|}&n}!O&s!O!P']!P!Q%Q!Q!['b![!]'j!^!_'o!_!`(q!`!a)R!a!b)^!b!c)d!}#O)i#P#Q)n#S#T)s#p#q*h#q#r*m#r#s*r~#US$u~XY#PYZ#P]^#Ppq#P~#gO!|~~#lS!^~OY#gZ;'S#g;'S;=`#x<%lO#g~#{P;=`<%l#g~$TP!{~st$W~$ZS!Q![$g!c!}$g#R#S$g#T#o$g~$lS!_~!Q![$g!c!}$g#R#S$g#T#o$g~$}P!w~vw%Q~%VP!w~!_!`%Y~%_O!y~~%bUOY%_Zw%_wx%tx;'S%_;'S;=`%|<%lO%_~%yP!l~wx%_~&PP;=`<%l%_~&XO#Q~~&^O#P~~&cQ!w~z{&i!_!`%Y~&nO!w~~&sO!u~~&xQ!w~!_!`%Y!`!a'O~'TP#_~z{'W~']O#O~~'bO!a~~'gP!k~!Q!['b~'oO!i~~'tT!x~!_!`(T!`!a(T!c!}(Y#R#S(Y#T#o(Y~(YO!x~~(]T!Q![(Y!`!a(l!c!}(Y#R#S(Y#T#o(Y~(qO#]~~(vQ!z~!^!_(T!`!a(|~)RO!e~~)WQ!x~!^!_(T!_!`(T~)aP!_!`%Y~)iO!}~~)nO#T~~)sO#S~~)vUOY)sZ#S)s#S#T*Y#T;'S)s;'S;=`*b<%lO)s~*_P!m~#S#T)s~*eP;=`<%l)s~*mO!o~~*rO!r~~*wO!f~",
|
|
482
|
+
tokenizers: [starComment, tightPunctuation, words, 1, new lr.LocalTokenGroup("!Q~RR#O#P[#o#pu#p#qz~_RO;'Sh;'S;=`m;=`Oh~mO!q~~rP!q~;=`<%lh~zO!t~~!PO!v~~", 47, 78)],
|
|
483
|
+
topRules: {"Program":[0,62]},
|
|
484
|
+
tokenPrec: 3461
|
|
485
|
+
});
|
|
486
|
+
|
|
487
|
+
// Nothing is offered inside these nodes, or while typing a new name.
|
|
488
|
+
const dontComplete = new Set([
|
|
489
|
+
"String", "BackquoteString", "TemplateContent", "TemplateEscape",
|
|
490
|
+
"LineComment", "StarComment", "Pragma", "Number",
|
|
491
|
+
"VariableDefinition", "TypeDefinition", "MethodDefinition", "ParameterDefinition",
|
|
492
|
+
"ClassDefName", "InterfaceDefName", "FieldSymbolDefinition",
|
|
493
|
+
]);
|
|
494
|
+
function blocked(node) {
|
|
495
|
+
for (let n = node; n; n = n.parent)
|
|
496
|
+
if (dontComplete.has(n.name))
|
|
497
|
+
return true;
|
|
498
|
+
return false;
|
|
499
|
+
}
|
|
500
|
+
const snippetTemplates = [
|
|
501
|
+
{
|
|
502
|
+
label: "CLASS",
|
|
503
|
+
detail: "definition and implementation",
|
|
504
|
+
template: "CLASS ${zcl_name} DEFINITION PUBLIC FINAL CREATE PUBLIC.\n" +
|
|
505
|
+
" PUBLIC SECTION.\n" +
|
|
506
|
+
" METHODS ${method_name}\n" +
|
|
507
|
+
" IMPORTING ${input} TYPE ${string}\n" +
|
|
508
|
+
" RETURNING VALUE(${result}) TYPE ${string}.\n" +
|
|
509
|
+
" PROTECTED SECTION.\n" +
|
|
510
|
+
" PRIVATE SECTION.\n" +
|
|
511
|
+
"ENDCLASS.\n\n" +
|
|
512
|
+
"CLASS ${zcl_name} IMPLEMENTATION.\n" +
|
|
513
|
+
" METHOD ${method_name}.\n" +
|
|
514
|
+
" ${}\n" +
|
|
515
|
+
" ENDMETHOD.\n" +
|
|
516
|
+
"ENDCLASS.",
|
|
517
|
+
},
|
|
518
|
+
{
|
|
519
|
+
label: "CLASS DEFINITION",
|
|
520
|
+
detail: "block",
|
|
521
|
+
template: "CLASS ${zcl_name} DEFINITION PUBLIC FINAL CREATE PUBLIC.\n" +
|
|
522
|
+
" PUBLIC SECTION.\n" +
|
|
523
|
+
" ${}\n" +
|
|
524
|
+
" PROTECTED SECTION.\n" +
|
|
525
|
+
" PRIVATE SECTION.\n" +
|
|
526
|
+
"ENDCLASS.",
|
|
527
|
+
},
|
|
528
|
+
{
|
|
529
|
+
label: "CLASS IMPLEMENTATION",
|
|
530
|
+
detail: "block",
|
|
531
|
+
template: "CLASS ${zcl_name} IMPLEMENTATION.\n ${}\nENDCLASS.",
|
|
532
|
+
},
|
|
533
|
+
{ label: "METHOD", detail: "implementation", template: "METHOD ${name}.\n ${}\nENDMETHOD." },
|
|
534
|
+
{
|
|
535
|
+
label: "METHODS",
|
|
536
|
+
detail: "declaration",
|
|
537
|
+
template: "METHODS ${name}\n IMPORTING ${input} TYPE ${string}\n RETURNING VALUE(${result}) TYPE ${string}.",
|
|
538
|
+
},
|
|
539
|
+
{ label: "LOOP AT", detail: "INTO DATA", template: "LOOP AT ${table} INTO DATA(${line}).\n ${}\nENDLOOP." },
|
|
540
|
+
{
|
|
541
|
+
label: "LOOP AT",
|
|
542
|
+
detail: "ASSIGNING FIELD-SYMBOL",
|
|
543
|
+
template: "LOOP AT ${table} ASSIGNING FIELD-SYMBOL(<${line}>).\n ${}\nENDLOOP.",
|
|
544
|
+
},
|
|
545
|
+
{ label: "IF", detail: "block", template: "IF ${condition}.\n ${}\nENDIF." },
|
|
546
|
+
{ label: "IF", detail: "/ ELSE block", template: "IF ${condition}.\n ${}\nELSE.\n \nENDIF." },
|
|
547
|
+
{
|
|
548
|
+
label: "CASE",
|
|
549
|
+
detail: "block",
|
|
550
|
+
template: "CASE ${value}.\n WHEN ${first}.\n ${}\n WHEN OTHERS.\n \nENDCASE.",
|
|
551
|
+
},
|
|
552
|
+
{ label: "DO", detail: "TIMES", template: "DO ${count} TIMES.\n ${}\nENDDO." },
|
|
553
|
+
{ label: "WHILE", detail: "block", template: "WHILE ${condition}.\n ${}\nENDWHILE." },
|
|
554
|
+
{
|
|
555
|
+
label: "TRY",
|
|
556
|
+
detail: "/ CATCH block",
|
|
557
|
+
template: "TRY.\n ${}\nCATCH ${cx_root} INTO DATA(${error}).\n \nENDTRY.",
|
|
558
|
+
},
|
|
559
|
+
{ label: "DATA", detail: "declaration", template: "DATA ${name} TYPE ${type}." },
|
|
560
|
+
{ label: "DATA(", detail: "inline declaration", template: "DATA(${name}) = ${value}." },
|
|
561
|
+
{
|
|
562
|
+
label: "TYPES",
|
|
563
|
+
detail: "structure",
|
|
564
|
+
template: "TYPES: BEGIN OF ${name},\n ${field} TYPE ${type},\n END OF ${name}.",
|
|
565
|
+
},
|
|
566
|
+
{ label: "VALUE #(", detail: "constructor", template: "VALUE #( ${} )" },
|
|
567
|
+
{ label: "COND #(", detail: "constructor", template: "COND #( WHEN ${condition} THEN ${value} ELSE ${other} )" },
|
|
568
|
+
];
|
|
569
|
+
// Snippets in upper case, or in lower case for a student who writes
|
|
570
|
+
// keywords in lower case. The names in the fields stay as they are.
|
|
571
|
+
function snippetsInCase(lower) {
|
|
572
|
+
let lowerKeywords = (s) => s.replace(/\$\{[^}]*\}|\b[A-Z][A-Z-]*\b/g, (w) => (w.startsWith("$") ? w : w.toLowerCase()));
|
|
573
|
+
return snippetTemplates.map((s) => autocomplete.snippetCompletion(lower ? lowerKeywords(s.template) : s.template, {
|
|
574
|
+
label: lower ? s.label.toLowerCase() : s.label,
|
|
575
|
+
detail: s.detail,
|
|
576
|
+
type: "keyword",
|
|
577
|
+
}));
|
|
578
|
+
}
|
|
579
|
+
/// The snippets, in upper case.
|
|
580
|
+
const snippets = snippetsInCase(false);
|
|
581
|
+
function keywordOptions(lower) {
|
|
582
|
+
let word = (w) => (lower ? w.toLowerCase() : w);
|
|
583
|
+
return [
|
|
584
|
+
...snippetsInCase(lower),
|
|
585
|
+
...statementKeywords$1.map((w) => ({ label: word(w), type: "keyword", boost: 1 })),
|
|
586
|
+
...additionKeywords.map((w) => ({ label: word(w), type: "keyword" })),
|
|
587
|
+
...builtinFunctions.map((w) => ({ label: w, type: "function", detail: "built-in" })),
|
|
588
|
+
...builtinTypes.map((w) => ({ label: w, type: "type", detail: "built-in" })),
|
|
589
|
+
...builtinConstants.map((w) => ({ label: w, type: "constant" })),
|
|
590
|
+
];
|
|
591
|
+
}
|
|
592
|
+
const upperOptions = keywordOptions(false), lowerOptions = keywordOptions(true);
|
|
593
|
+
// `me->`, `zcl_x=>`, `if_x~` or `line-`: only members make sense after these.
|
|
594
|
+
const memberBefore = /([\w<>]+)(->|=>|~|-)(\w*)$/;
|
|
595
|
+
/// Completes ABAP keywords, built-in functions, types and constants, and
|
|
596
|
+
/// the snippets. Keywords come in the case the student is typing in.
|
|
597
|
+
const keywordCompletionSource = (context) => {
|
|
598
|
+
let node = language.syntaxTree(context.state).resolveInner(context.pos, -1);
|
|
599
|
+
if (blocked(node))
|
|
600
|
+
return null;
|
|
601
|
+
let line = context.state.doc.lineAt(context.pos);
|
|
602
|
+
let before = context.state.sliceDoc(line.from, context.pos);
|
|
603
|
+
let member = memberBefore.exec(before);
|
|
604
|
+
// CLASS-DATA and NO-GAPS are keywords with a dash.
|
|
605
|
+
if (member && !(member[2] == "-" && /^[A-Za-z]+$/.test(member[1]) && hyphenStart.has(member[1].toUpperCase())))
|
|
606
|
+
return null;
|
|
607
|
+
let word = context.matchBefore(/[\w-]*$/);
|
|
608
|
+
if (!word || (word.from == word.to && !context.explicit))
|
|
609
|
+
return null;
|
|
610
|
+
let lower = /[a-z]/.test(word.text) && word.text == word.text.toLowerCase();
|
|
611
|
+
return { from: word.from, options: lower ? lowerOptions : upperOptions, validFor: /^[\w-]*$/ };
|
|
612
|
+
};
|
|
613
|
+
const hyphenStart = new Set([...statementKeywords$1, ...additionKeywords].filter((w) => w.includes("-")).map((w) => w.split("-")[0]));
|
|
614
|
+
function text(state, node) {
|
|
615
|
+
return node ? state.sliceDoc(node.from, node.to) : "";
|
|
616
|
+
}
|
|
617
|
+
function key(name) {
|
|
618
|
+
return name.toLowerCase();
|
|
619
|
+
}
|
|
620
|
+
function typeOf(state, clause) {
|
|
621
|
+
if (!clause || clause.name != "TypeClause")
|
|
622
|
+
return {};
|
|
623
|
+
let name = clause.getChild("TypeName");
|
|
624
|
+
let isRef = clause.getChildren("TypeKeyword").some((k) => /^ref$/i.test(text(state, k)));
|
|
625
|
+
let ids = name ? name.getChildren("Identifier") : [];
|
|
626
|
+
return { typeName: ids.length ? key(text(state, ids[ids.length - 1])) : undefined, isRef };
|
|
627
|
+
}
|
|
628
|
+
// Reads the entries of a DATA or TYPES chain, and puts the fields between
|
|
629
|
+
// BEGIN OF and END OF into their structure.
|
|
630
|
+
function readChain(state, decl, defName, type, into, types) {
|
|
631
|
+
var _a;
|
|
632
|
+
let stack = [];
|
|
633
|
+
let constant = /^constants$/i.test(text(state, decl.firstChild));
|
|
634
|
+
let current = null;
|
|
635
|
+
let add = (d) => (stack.length ? stack[stack.length - 1].components : into).push(d);
|
|
636
|
+
for (let child = decl.firstChild; child; child = child.nextSibling) {
|
|
637
|
+
if (child.name == "Begin") {
|
|
638
|
+
let def = (_a = child.nextSibling) === null || _a === void 0 ? void 0 : _a.nextSibling;
|
|
639
|
+
if (def && def.name == defName) {
|
|
640
|
+
let d = { name: text(state, def), type: stack.length ? "property" : type, from: def.from, components: [] };
|
|
641
|
+
add(d);
|
|
642
|
+
if (type == "type" && !stack.length)
|
|
643
|
+
types.set(key(d.name), d);
|
|
644
|
+
stack.push(d);
|
|
645
|
+
child = def;
|
|
646
|
+
}
|
|
647
|
+
current = null;
|
|
648
|
+
}
|
|
649
|
+
else if (child.name == "End") {
|
|
650
|
+
stack.pop();
|
|
651
|
+
current = null;
|
|
652
|
+
}
|
|
653
|
+
else if (child.name == defName) {
|
|
654
|
+
current = { name: text(state, child), type: stack.length ? "property" : constant ? "constant" : type, from: child.from };
|
|
655
|
+
add(current);
|
|
656
|
+
if (type == "type" && !stack.length)
|
|
657
|
+
types.set(key(current.name), current);
|
|
658
|
+
}
|
|
659
|
+
else if (child.name == "TypeClause" && current) {
|
|
660
|
+
Object.assign(current, typeOf(state, child));
|
|
661
|
+
}
|
|
662
|
+
else if (child.name == ",") {
|
|
663
|
+
current = null;
|
|
664
|
+
}
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
function readMethods(state, decl, container, into) {
|
|
668
|
+
let params = [];
|
|
669
|
+
for (let child = decl.firstChild; child; child = child.nextSibling) {
|
|
670
|
+
if (child.name == "MethodDefinition") {
|
|
671
|
+
let name = text(state, child);
|
|
672
|
+
into.push({ name, type: "method", from: child.from });
|
|
673
|
+
params = [];
|
|
674
|
+
container === null || container === void 0 ? void 0 : container.parameters.set(key(name), params);
|
|
675
|
+
}
|
|
676
|
+
else if (child.name == "ParameterList") {
|
|
677
|
+
for (let p of child.getChildren("Parameter")) {
|
|
678
|
+
let def = p.getChild("ParameterDefinition");
|
|
679
|
+
if (def)
|
|
680
|
+
params.push(Object.assign({ name: text(state, def), type: "variable", from: def.from }, typeOf(state, p.getChild("TypeClause"))));
|
|
681
|
+
}
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
function readDeclaration(state, node, container, into, types) {
|
|
686
|
+
if (node.name == "DataDeclaration")
|
|
687
|
+
readChain(state, node, "VariableDefinition", "variable", into, types);
|
|
688
|
+
else if (node.name == "TypesDeclaration")
|
|
689
|
+
readChain(state, node, "TypeDefinition", "type", into, types);
|
|
690
|
+
else if (node.name == "MethodsDeclaration")
|
|
691
|
+
readMethods(state, node, container, into);
|
|
692
|
+
else if (node.name == "FieldSymbolsDeclaration") {
|
|
693
|
+
for (let def of node.getChildren("FieldSymbolDefinition"))
|
|
694
|
+
into.push(Object.assign({ name: text(state, def), type: "variable", from: def.from }, typeOf(state, def.nextSibling)));
|
|
695
|
+
}
|
|
696
|
+
}
|
|
697
|
+
// Reads every declaration in a method body, including those inside blocks
|
|
698
|
+
// and inline declarations such as DATA(x).
|
|
699
|
+
function readBody(state, body, into, types) {
|
|
700
|
+
let cursor = body.cursor();
|
|
701
|
+
while (cursor.next() && cursor.from < body.to) {
|
|
702
|
+
let node = cursor.node;
|
|
703
|
+
if (node.name == "InlineDeclaration") {
|
|
704
|
+
let def = node.getChild("VariableDefinition") || node.getChild("FieldSymbolDefinition");
|
|
705
|
+
if (def)
|
|
706
|
+
into.push({ name: text(state, def), type: "variable", from: def.from });
|
|
707
|
+
}
|
|
708
|
+
else if (/Declaration$/.test(node.name)) {
|
|
709
|
+
readDeclaration(state, node, null, into, types);
|
|
710
|
+
}
|
|
711
|
+
}
|
|
712
|
+
}
|
|
713
|
+
const models = new WeakMap();
|
|
714
|
+
function containerName(state, node) {
|
|
715
|
+
return text(state, node.getChild("ClassDefName") || node.getChild("InterfaceDefName"));
|
|
716
|
+
}
|
|
717
|
+
function modelOf(state) {
|
|
718
|
+
var _a;
|
|
719
|
+
let tree = language.syntaxTree(state);
|
|
720
|
+
let found = models.get(tree);
|
|
721
|
+
if (found)
|
|
722
|
+
return found;
|
|
723
|
+
let model = { containers: new Map(), types: new Map(), globals: [] };
|
|
724
|
+
for (let top = tree.topNode.firstChild; top; top = top.nextSibling) {
|
|
725
|
+
let isClass = top.name == "ClassDefinition" || top.name == "ClassDeclaration";
|
|
726
|
+
if (isClass || top.name == "InterfaceDefinition" || top.name == "InterfaceDeclaration") {
|
|
727
|
+
let name = containerName(state, top);
|
|
728
|
+
let container = model.containers.get(key(name));
|
|
729
|
+
if (!container || top.name.endsWith("Definition")) {
|
|
730
|
+
container = { name, kind: isClass ? "class" : "interface", members: [], parameters: new Map() };
|
|
731
|
+
model.containers.set(key(name), container);
|
|
732
|
+
}
|
|
733
|
+
let inheriting = top.getChild("Inheriting");
|
|
734
|
+
let parent = (_a = inheriting === null || inheriting === void 0 ? void 0 : inheriting.nextSibling) === null || _a === void 0 ? void 0 : _a.nextSibling;
|
|
735
|
+
if (parent)
|
|
736
|
+
container.parent = key(text(state, parent));
|
|
737
|
+
let sections = top.name == "ClassDefinition" ? top.getChildren("VisibilitySection") : [top];
|
|
738
|
+
for (let section of sections)
|
|
739
|
+
for (let child = section.firstChild; child; child = child.nextSibling)
|
|
740
|
+
readDeclaration(state, child, container, container.members, model.types);
|
|
741
|
+
}
|
|
742
|
+
else {
|
|
743
|
+
readDeclaration(state, top, null, model.globals, model.types);
|
|
744
|
+
}
|
|
745
|
+
}
|
|
746
|
+
models.set(tree, model);
|
|
747
|
+
return model;
|
|
748
|
+
}
|
|
749
|
+
// The members of a class or interface, with those of the classes it
|
|
750
|
+
// inherits from.
|
|
751
|
+
function membersOf(model, name) {
|
|
752
|
+
let result = [];
|
|
753
|
+
let seen = new Set();
|
|
754
|
+
for (let c = name ? model.containers.get(key(name)) : undefined; c && !seen.has(key(c.name));) {
|
|
755
|
+
seen.add(key(c.name));
|
|
756
|
+
result.unshift(...c.members);
|
|
757
|
+
c = c.parent ? model.containers.get(c.parent) : undefined;
|
|
758
|
+
}
|
|
759
|
+
return result;
|
|
760
|
+
}
|
|
761
|
+
function parametersOf(model, className, method) {
|
|
762
|
+
let [owner, name] = method.includes("~") ? method.split("~") : [className, method];
|
|
763
|
+
let seen = new Set();
|
|
764
|
+
for (let c = model.containers.get(key(owner)); c && !seen.has(key(c.name));) {
|
|
765
|
+
seen.add(key(c.name));
|
|
766
|
+
let params = c.parameters.get(key(name));
|
|
767
|
+
if (params)
|
|
768
|
+
return params;
|
|
769
|
+
c = c.parent ? model.containers.get(c.parent) : undefined;
|
|
770
|
+
}
|
|
771
|
+
return [];
|
|
772
|
+
}
|
|
773
|
+
// The names in scope at a position. ABAP has no block scope, so a method
|
|
774
|
+
// sees its class's members, its parameters, and everything declared in it
|
|
775
|
+
// before the position.
|
|
776
|
+
function scopeAt(state, model, node, pos) {
|
|
777
|
+
let method = null, impl = null, def = null;
|
|
778
|
+
for (let n = node; n; n = n.parent) {
|
|
779
|
+
if (n.name == "MethodImplementation" && !method)
|
|
780
|
+
method = n;
|
|
781
|
+
if (n.name == "ClassImplementation")
|
|
782
|
+
impl = n;
|
|
783
|
+
if (n.name == "ClassDefinition" || n.name == "InterfaceDefinition")
|
|
784
|
+
def = n;
|
|
785
|
+
}
|
|
786
|
+
let decls = [];
|
|
787
|
+
for (let c of model.containers.values())
|
|
788
|
+
decls.push({ name: c.name, type: c.kind, from: 0 });
|
|
789
|
+
decls.push(...model.types.values());
|
|
790
|
+
decls.push(...model.globals.filter((d) => d.from < pos && d.type != "type"));
|
|
791
|
+
let className;
|
|
792
|
+
if (impl) {
|
|
793
|
+
className = text(state, impl.getChild("ClassName"));
|
|
794
|
+
decls.push(...membersOf(model, className).filter((d) => d.type != "type"));
|
|
795
|
+
if (method) {
|
|
796
|
+
decls.push(...parametersOf(model, className, text(state, method.getChild("MethodName"))));
|
|
797
|
+
let local = [];
|
|
798
|
+
readBody(state, method, local, model.types);
|
|
799
|
+
decls.push(...local.filter((d) => d.from < pos));
|
|
800
|
+
}
|
|
801
|
+
}
|
|
802
|
+
else if (def) {
|
|
803
|
+
className = containerName(state, def);
|
|
804
|
+
}
|
|
805
|
+
return { className, decls };
|
|
806
|
+
}
|
|
807
|
+
function findDecl(scope, name) {
|
|
808
|
+
let k = key(name);
|
|
809
|
+
for (let i = scope.decls.length - 1; i >= 0; i--)
|
|
810
|
+
if (key(scope.decls[i].name) == k)
|
|
811
|
+
return scope.decls[i];
|
|
812
|
+
return null;
|
|
813
|
+
}
|
|
814
|
+
// The names that make sense after `me->`, `zcl_x=>`, `ref->` or `struct-`.
|
|
815
|
+
function membersAfter(model, scope, target, op) {
|
|
816
|
+
var _a;
|
|
817
|
+
if (op != "-") {
|
|
818
|
+
if (/^me$/i.test(target))
|
|
819
|
+
return membersOf(model, scope.className);
|
|
820
|
+
if (model.containers.has(key(target)))
|
|
821
|
+
return membersOf(model, target);
|
|
822
|
+
let decl = findDecl(scope, target);
|
|
823
|
+
if ((decl === null || decl === void 0 ? void 0 : decl.isRef) && decl.typeName)
|
|
824
|
+
return membersOf(model, decl.typeName);
|
|
825
|
+
return null;
|
|
826
|
+
}
|
|
827
|
+
let decl = findDecl(scope, target);
|
|
828
|
+
let type = (decl === null || decl === void 0 ? void 0 : decl.components) ? decl : (decl === null || decl === void 0 ? void 0 : decl.typeName) ? model.types.get(decl.typeName) : undefined;
|
|
829
|
+
return (_a = type === null || type === void 0 ? void 0 : type.components) !== null && _a !== void 0 ? _a : null;
|
|
830
|
+
}
|
|
831
|
+
// One option per name, keeping the latest declaration of it.
|
|
832
|
+
function options(decls) {
|
|
833
|
+
let seen = new Set();
|
|
834
|
+
let result = [];
|
|
835
|
+
for (let i = decls.length - 1; i >= 0; i--) {
|
|
836
|
+
let d = decls[i], k = key(d.name);
|
|
837
|
+
if (seen.has(k))
|
|
838
|
+
continue;
|
|
839
|
+
seen.add(k);
|
|
840
|
+
result.push({ label: d.name, type: d.type });
|
|
841
|
+
}
|
|
842
|
+
return result;
|
|
843
|
+
}
|
|
844
|
+
/// Completes the names declared in the file that are in scope at the
|
|
845
|
+
/// cursor: classes, interfaces, types, attributes, methods, parameters,
|
|
846
|
+
/// local data and field symbols, and the members after `->`, `=>` and `-`.
|
|
847
|
+
const localCompletionSource = (context) => {
|
|
848
|
+
let { state, pos } = context;
|
|
849
|
+
let node = language.syntaxTree(state).resolveInner(pos, -1);
|
|
850
|
+
if (blocked(node))
|
|
851
|
+
return null;
|
|
852
|
+
let model = modelOf(state);
|
|
853
|
+
let line = state.doc.lineAt(pos);
|
|
854
|
+
let before = state.sliceDoc(line.from, pos);
|
|
855
|
+
let member = memberBefore.exec(before);
|
|
856
|
+
if (member && !(member[2] == "-" && hyphenStart.has(member[1].toUpperCase()))) {
|
|
857
|
+
let found = membersAfter(model, scopeAt(state, model, node, pos), member[1], member[2]);
|
|
858
|
+
if (!found)
|
|
859
|
+
return null;
|
|
860
|
+
return { from: pos - member[3].length, options: options(found), validFor: /^\w*$/ };
|
|
861
|
+
}
|
|
862
|
+
let fieldSymbol = /<\w*$/.exec(before);
|
|
863
|
+
let word = fieldSymbol ? { from: pos - fieldSymbol[0].length } : context.matchBefore(/\w+$/);
|
|
864
|
+
if (!word && !context.explicit)
|
|
865
|
+
return null;
|
|
866
|
+
let scope = scopeAt(state, model, node, pos);
|
|
867
|
+
let decls = scope.decls.filter((d) => d.name.startsWith("<") == !!fieldSymbol);
|
|
868
|
+
return { from: word ? word.from : pos, options: options(decls), validFor: fieldSymbol ? /^<\w*>?$/ : /^\w*$/ };
|
|
869
|
+
};
|
|
870
|
+
|
|
871
|
+
const clauses = new Set([
|
|
872
|
+
"VisibilitySection", "ElseIfClause", "ElseClause", "WhenClause", "CatchClause", "CleanupClause",
|
|
873
|
+
]);
|
|
874
|
+
// Indents the lines inside a block by one unit, and puts the words that
|
|
875
|
+
// close or split the block (such as ELSE and ENDIF) back at its start.
|
|
876
|
+
// Some clauses (WHEN, and the sections of a class) sit one unit in from
|
|
877
|
+
// the block. A line straight after a clause with no body yet, such as
|
|
878
|
+
// `WHEN 1.` or `PUBLIC SECTION.`, goes one unit in from the clause.
|
|
879
|
+
function blockIndent(closing, innerClause) {
|
|
880
|
+
return (cx) => {
|
|
881
|
+
if (closing.test(cx.textAfter))
|
|
882
|
+
return cx.baseIndent;
|
|
883
|
+
if (innerClause && innerClause.test(cx.textAfter))
|
|
884
|
+
return cx.baseIndent + cx.unit;
|
|
885
|
+
let before = cx.node.childBefore(cx.pos);
|
|
886
|
+
if (before && clauses.has(before.name))
|
|
887
|
+
return cx.lineIndent(before.from) + cx.unit;
|
|
888
|
+
return cx.baseIndent + cx.unit;
|
|
889
|
+
};
|
|
890
|
+
}
|
|
891
|
+
const blockEnds = {
|
|
892
|
+
ClassDefinition: /^\s*ENDCLASS\b/i,
|
|
893
|
+
VisibilitySection: /^\s*(PUBLIC|PROTECTED|PRIVATE|ENDCLASS)\b/i,
|
|
894
|
+
ClassImplementation: /^\s*ENDCLASS\b/i,
|
|
895
|
+
InterfaceDefinition: /^\s*ENDINTERFACE\b/i,
|
|
896
|
+
MethodImplementation: /^\s*ENDMETHOD\b/i,
|
|
897
|
+
IfStatement: /^\s*(ELSEIF|ELSE|ENDIF)\b/i,
|
|
898
|
+
ElseIfClause: /^\s*(ELSEIF|ELSE|ENDIF)\b/i,
|
|
899
|
+
ElseClause: /^\s*ENDIF\b/i,
|
|
900
|
+
CaseStatement: /^\s*ENDCASE\b/i,
|
|
901
|
+
WhenClause: /^\s*(WHEN|ENDCASE)\b/i,
|
|
902
|
+
LoopStatement: /^\s*ENDLOOP\b/i,
|
|
903
|
+
AtBlock: /^\s*ENDAT\b/i,
|
|
904
|
+
DoStatement: /^\s*ENDDO\b/i,
|
|
905
|
+
WhileStatement: /^\s*ENDWHILE\b/i,
|
|
906
|
+
TryStatement: /^\s*(CATCH|CLEANUP|ENDTRY)\b/i,
|
|
907
|
+
CatchClause: /^\s*(CATCH|CLEANUP|ENDTRY)\b/i,
|
|
908
|
+
CleanupClause: /^\s*ENDTRY\b/i,
|
|
909
|
+
};
|
|
910
|
+
const indentRules = {};
|
|
911
|
+
for (let name in blockEnds)
|
|
912
|
+
indentRules[name] = blockIndent(blockEnds[name]);
|
|
913
|
+
indentRules.ClassDefinition = blockIndent(blockEnds.ClassDefinition, /^\s*(PUBLIC|PROTECTED|PRIVATE)\b/i);
|
|
914
|
+
indentRules.CaseStatement = blockIndent(blockEnds.CaseStatement, /^\s*WHEN\b/i);
|
|
915
|
+
// Folds a block from the end of its first line to the line before the
|
|
916
|
+
// word that closes it, so that ENDIF and ENDMETHOD stay visible.
|
|
917
|
+
function foldBlock(node, state) {
|
|
918
|
+
let from = state.doc.lineAt(node.from).to;
|
|
919
|
+
let last = node.lastChild;
|
|
920
|
+
if (last && last.name == ".")
|
|
921
|
+
last = last.prevSibling;
|
|
922
|
+
let to = node.to;
|
|
923
|
+
if (last && /^End/.test(last.name))
|
|
924
|
+
to = state.doc.lineAt(last.from).from - 1;
|
|
925
|
+
return to > from ? { from, to } : null;
|
|
926
|
+
}
|
|
927
|
+
// Folds a clause such as ELSE or WHEN, or a declaration that runs over
|
|
928
|
+
// several lines, from the end of its first line.
|
|
929
|
+
function foldClause(node, state) {
|
|
930
|
+
let from = state.doc.lineAt(node.from).to;
|
|
931
|
+
return node.to > from ? { from, to: node.to } : null;
|
|
932
|
+
}
|
|
933
|
+
const abapLanguage = language.LRLanguage.define({
|
|
934
|
+
name: "abap",
|
|
935
|
+
parser: parser.configure({
|
|
936
|
+
props: [
|
|
937
|
+
language.indentNodeProp.add(Object.assign(Object.assign({}, indentRules), { "Statement DataDeclaration TypesDeclaration MethodsDeclaration FieldSymbolsDeclaration": language.continuedIndent() })),
|
|
938
|
+
language.foldNodeProp.add({
|
|
939
|
+
"ClassDefinition ClassImplementation InterfaceDefinition MethodImplementation": foldBlock,
|
|
940
|
+
"IfStatement CaseStatement LoopStatement AtBlock DoStatement WhileStatement TryStatement": foldBlock,
|
|
941
|
+
"VisibilitySection ElseIfClause ElseClause WhenClause CatchClause CleanupClause": foldClause,
|
|
942
|
+
"DataDeclaration TypesDeclaration MethodsDeclaration": foldClause,
|
|
943
|
+
}),
|
|
944
|
+
highlight.styleTags({
|
|
945
|
+
"LineComment StarComment": highlight.tags.lineComment,
|
|
946
|
+
Pragma: highlight.tags.meta,
|
|
947
|
+
Keyword: highlight.tags.keyword,
|
|
948
|
+
"Class Definition Implementation Deferred EndClass Interface EndInterface": highlight.tags.definitionKeyword,
|
|
949
|
+
"Method EndMethod Methods Data Types FieldSymbols Begin End Include InlineDecl": highlight.tags.definitionKeyword,
|
|
950
|
+
"Visibility Section Inheriting Friends": highlight.tags.modifier,
|
|
951
|
+
"ParameterKind Raising Optional Default Preferred Value Type TypeKeyword": highlight.tags.keyword,
|
|
952
|
+
"If ElseIf Else EndIf Case When EndCase Loop EndLoop At EndAt": highlight.tags.controlKeyword,
|
|
953
|
+
"Do EndDo While EndWhile Try Catch Cleanup EndTry": highlight.tags.controlKeyword,
|
|
954
|
+
"ConstructorOp OperatorKeyword": highlight.tags.operatorKeyword,
|
|
955
|
+
Atom: highlight.tags.atom,
|
|
956
|
+
Self: highlight.tags.self,
|
|
957
|
+
Number: highlight.tags.number,
|
|
958
|
+
"String BackquoteString": highlight.tags.string,
|
|
959
|
+
StringTemplate: highlight.tags.special(highlight.tags.string),
|
|
960
|
+
TemplateEscape: highlight.tags.escape,
|
|
961
|
+
"Interpolation/{ Interpolation/}": highlight.tags.special(highlight.tags.brace),
|
|
962
|
+
Identifier: highlight.tags.variableName,
|
|
963
|
+
FieldSymbol: highlight.tags.special(highlight.tags.variableName),
|
|
964
|
+
"VariableDefinition/Identifier ParameterDefinition/Identifier": highlight.tags.definition(highlight.tags.variableName),
|
|
965
|
+
"FieldSymbolDefinition/FieldSymbol": highlight.tags.definition(highlight.tags.special(highlight.tags.variableName)),
|
|
966
|
+
"TypeDefinition/Identifier": highlight.tags.definition(highlight.tags.typeName),
|
|
967
|
+
"ClassDefName/Identifier InterfaceDefName/Identifier": highlight.tags.definition(highlight.tags.className),
|
|
968
|
+
"MethodDefinition/Identifier MethodName/Identifier": highlight.tags.function(highlight.tags.definition(highlight.tags.variableName)),
|
|
969
|
+
"ClassName/Identifier": highlight.tags.className,
|
|
970
|
+
"TypeName/Identifier ExceptionName/Identifier ConstructorType/Identifier ConstructorType/CallName": highlight.tags.typeName,
|
|
971
|
+
CallName: highlight.tags.function(highlight.tags.variableName),
|
|
972
|
+
"MemberAccess/Call/CallName": highlight.tags.function(highlight.tags.propertyName),
|
|
973
|
+
"PropertyName/Identifier": highlight.tags.propertyName,
|
|
974
|
+
ArithOp: highlight.tags.arithmeticOperator,
|
|
975
|
+
CompareOp: highlight.tags.compareOperator,
|
|
976
|
+
UpdateOp: highlight.tags.updateOperator,
|
|
977
|
+
"=": highlight.tags.definitionOperator,
|
|
978
|
+
"-> => ~ ->* ComponentDash": highlight.tags.derefOperator,
|
|
979
|
+
"OffsetPlus #": highlight.tags.operator,
|
|
980
|
+
"( ) LengthOpen": highlight.tags.paren,
|
|
981
|
+
"[ ]": highlight.tags.squareBracket,
|
|
982
|
+
".": highlight.tags.punctuation,
|
|
983
|
+
", :": highlight.tags.separator,
|
|
984
|
+
}),
|
|
985
|
+
],
|
|
986
|
+
}),
|
|
987
|
+
languageData: {
|
|
988
|
+
commentTokens: { line: '"' },
|
|
989
|
+
closeBrackets: { brackets: ["(", "[", "'", "`", "|"] },
|
|
990
|
+
indentOnInput: /^\s*(ELSE|ELSEIF|ENDIF|WHEN|ENDCASE|ENDLOOP|ENDDO|ENDWHILE|ENDAT|CATCH|CLEANUP|ENDTRY|ENDMETHOD|ENDCLASS|ENDINTERFACE|PUBLIC|PROTECTED|PRIVATE)$/i,
|
|
991
|
+
},
|
|
992
|
+
});
|
|
993
|
+
/// ABAP support, with completion of keywords, built-in functions and
|
|
994
|
+
/// types, snippets, and the names declared in the file.
|
|
995
|
+
function abap() {
|
|
996
|
+
return new language.LanguageSupport(abapLanguage, [
|
|
997
|
+
abapLanguage.data.of({ autocomplete: keywordCompletionSource }),
|
|
998
|
+
abapLanguage.data.of({ autocomplete: localCompletionSource }),
|
|
999
|
+
]);
|
|
1000
|
+
}
|
|
1001
|
+
|
|
1002
|
+
exports.abap = abap;
|
|
1003
|
+
exports.abapLanguage = abapLanguage;
|
|
1004
|
+
exports.additionKeywords = additionKeywords;
|
|
1005
|
+
exports.builtinConstants = builtinConstants;
|
|
1006
|
+
exports.builtinFunctions = builtinFunctions;
|
|
1007
|
+
exports.builtinTypes = builtinTypes;
|
|
1008
|
+
exports.keywordCompletionSource = keywordCompletionSource;
|
|
1009
|
+
exports.localCompletionSource = localCompletionSource;
|
|
1010
|
+
exports.snippets = snippets;
|
|
1011
|
+
exports.statementKeywords = statementKeywords$1;
|