@abaplint/core 2.84.12 → 2.85.3
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/build/abaplint.d.ts +6 -4
- package/build/src/abap/1_lexer/lexer.js +6 -1
- package/build/src/abap/2_statements/expand_macros.js +20 -2
- package/build/src/abap/2_statements/expressions/concatenated_constant.js +3 -2
- package/build/src/abap/2_statements/expressions/form_param.js +1 -1
- package/build/src/abap/2_statements/expressions/sql_alias_field.js +1 -1
- package/build/src/abap/2_statements/statement_parser.js +3 -2
- package/build/src/abap/5_syntax/_object_oriented.js +9 -2
- package/build/src/abap/5_syntax/basic_types.js +3 -0
- package/build/src/abap/5_syntax/expressions/form_param.js +1 -1
- package/build/src/abap/abap_parser.js +3 -2
- package/build/src/abap/types/class_definition.js +1 -1
- package/build/src/objects/_abap_object.js +2 -2
- package/build/src/objects/_abstract_object.js +1 -1
- package/build/src/objects/table.js +2 -4
- package/build/src/registry.js +2 -2
- package/package.json +1 -1
package/build/abaplint.d.ts
CHANGED
|
@@ -25,7 +25,7 @@ export declare abstract class ABAPObject extends AbstractObject {
|
|
|
25
25
|
abstract getDescription(): string | undefined;
|
|
26
26
|
constructor(name: string);
|
|
27
27
|
static is(x: any): x is ABAPObject;
|
|
28
|
-
parse(version: Version, globalMacros?: readonly string[]): IParseResult;
|
|
28
|
+
parse(version: Version, globalMacros?: readonly string[], reg?: IRegistry): IParseResult;
|
|
29
29
|
setDirty(): void;
|
|
30
30
|
getABAPFiles(): readonly ABAPFile[];
|
|
31
31
|
getABAPFileByName(filename: string): ABAPFile | undefined;
|
|
@@ -79,7 +79,7 @@ declare abstract class AbstractObject implements IObject {
|
|
|
79
79
|
abstract getDescription(): string | undefined;
|
|
80
80
|
constructor(name: string);
|
|
81
81
|
getParsingIssues(): readonly Issue[];
|
|
82
|
-
parse(_version?: Version, _globalMacros?: readonly string[]): IParseResult;
|
|
82
|
+
parse(_version?: Version, _globalMacros?: readonly string[], _reg?: IRegistry): IParseResult;
|
|
83
83
|
getName(): string;
|
|
84
84
|
setDirty(): void;
|
|
85
85
|
addFile(file: IFile): void;
|
|
@@ -3100,8 +3100,10 @@ export declare interface IObject extends IArtifact {
|
|
|
3100
3100
|
getDescription(): string | undefined;
|
|
3101
3101
|
setDirty(): void;
|
|
3102
3102
|
isDirty(): boolean;
|
|
3103
|
-
/** returns true if the object was parsed, false if no changes since last parse
|
|
3104
|
-
|
|
3103
|
+
/** returns true if the object was parsed, false if no changes since last parse
|
|
3104
|
+
* registry for global cross object macros
|
|
3105
|
+
*/
|
|
3106
|
+
parse(version?: Version, globalMacros?: readonly string[], reg?: IRegistry): IParseResult;
|
|
3105
3107
|
getParsingIssues(): readonly Issue[];
|
|
3106
3108
|
getFiles(): readonly IFile[];
|
|
3107
3109
|
addFile(file: IFile): void;
|
|
@@ -319,7 +319,12 @@ class Lexer {
|
|
|
319
319
|
&& ahead !== "`") {
|
|
320
320
|
// end of ping
|
|
321
321
|
this.add();
|
|
322
|
-
|
|
322
|
+
if (ahead === `"`) {
|
|
323
|
+
this.m = Mode.Comment;
|
|
324
|
+
}
|
|
325
|
+
else {
|
|
326
|
+
this.m = Mode.Normal;
|
|
327
|
+
}
|
|
323
328
|
}
|
|
324
329
|
else if (this.m === Mode.Template
|
|
325
330
|
&& buf.length > 1
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ExpandMacros = void 0;
|
|
4
4
|
const Statements = require("./statements");
|
|
5
|
+
const Expressions = require("./expressions");
|
|
5
6
|
const Tokens = require("../1_lexer/tokens");
|
|
6
7
|
const _statement_1 = require("./statements/_statement");
|
|
7
8
|
const statement_node_1 = require("../nodes/statement_node");
|
|
@@ -37,11 +38,15 @@ class Macros {
|
|
|
37
38
|
}
|
|
38
39
|
}
|
|
39
40
|
class ExpandMacros {
|
|
40
|
-
|
|
41
|
+
// "reg" must be supplied if there are cross object macros via INCLUDE
|
|
42
|
+
constructor(globalMacros, version, reg) {
|
|
41
43
|
this.macros = new Macros(globalMacros);
|
|
42
44
|
this.version = version;
|
|
45
|
+
this.globalMacros = globalMacros;
|
|
46
|
+
this.reg = reg;
|
|
43
47
|
}
|
|
44
48
|
find(statements) {
|
|
49
|
+
var _a, _b;
|
|
45
50
|
let name = undefined;
|
|
46
51
|
let contents = [];
|
|
47
52
|
for (let i = 0; i < statements.length; i++) {
|
|
@@ -52,6 +57,19 @@ class ExpandMacros {
|
|
|
52
57
|
name = statement.getTokens()[1].getStr();
|
|
53
58
|
contents = [];
|
|
54
59
|
}
|
|
60
|
+
else if (type instanceof Statements.Include) {
|
|
61
|
+
const includeName = (_a = statement.findDirectExpression(Expressions.IncludeName)) === null || _a === void 0 ? void 0 : _a.concatTokens();
|
|
62
|
+
// todo, this does not take function module includes into account
|
|
63
|
+
const prog = (_b = this.reg) === null || _b === void 0 ? void 0 : _b.getObject("PROG", includeName);
|
|
64
|
+
if (prog) {
|
|
65
|
+
prog.parse(this.version, this.globalMacros, this.reg);
|
|
66
|
+
const main = prog.getMainABAPFile();
|
|
67
|
+
if (main) {
|
|
68
|
+
// slow, this copies everything,
|
|
69
|
+
this.find([...main.getStatements()]);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
55
73
|
else if (name) {
|
|
56
74
|
if (type instanceof Statements.EndOfDefinition) {
|
|
57
75
|
this.macros.addMacro(name, contents);
|
|
@@ -116,7 +134,7 @@ class ExpandMacros {
|
|
|
116
134
|
}
|
|
117
135
|
const file = new memory_file_1.MemoryFile("expand_macros.abap.prog", str);
|
|
118
136
|
const lexerResult = lexer_1.Lexer.run(file, statement.getFirstToken().getStart());
|
|
119
|
-
const result = new statement_parser_1.StatementParser(this.version).run([lexerResult], this.macros.listMacroNames());
|
|
137
|
+
const result = new statement_parser_1.StatementParser(this.version, this.reg).run([lexerResult], this.macros.listMacroNames());
|
|
120
138
|
return result[0].statements;
|
|
121
139
|
}
|
|
122
140
|
buildInput(statement) {
|
|
@@ -4,8 +4,9 @@ exports.ConcatenatedConstant = void 0;
|
|
|
4
4
|
const combi_1 = require("../combi");
|
|
5
5
|
class ConcatenatedConstant extends combi_1.Expression {
|
|
6
6
|
getRunnable() {
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
const str = (0, combi_1.seq)((0, combi_1.regex)(/^`.*`$/), (0, combi_1.plusPrio)((0, combi_1.seq)("&", (0, combi_1.regex)(/^`.*`$/))));
|
|
8
|
+
const char = (0, combi_1.seq)((0, combi_1.regex)(/^'.*'$/), (0, combi_1.plusPrio)((0, combi_1.seq)("&", (0, combi_1.regex)(/^'.*'$/))));
|
|
9
|
+
return (0, combi_1.altPrio)(str, char);
|
|
9
10
|
}
|
|
10
11
|
}
|
|
11
12
|
exports.ConcatenatedConstant = ConcatenatedConstant;
|
|
@@ -5,7 +5,7 @@ const combi_1 = require("../combi");
|
|
|
5
5
|
const _1 = require(".");
|
|
6
6
|
class FormParam extends combi_1.Expression {
|
|
7
7
|
getRunnable() {
|
|
8
|
-
const stru = (0, combi_1.seq)("STRUCTURE", _1.
|
|
8
|
+
const stru = (0, combi_1.seq)("STRUCTURE", _1.SimpleFieldChain);
|
|
9
9
|
const ret = (0, combi_1.seq)((0, combi_1.altPrio)(_1.PassByValue, _1.FormParamName), (0, combi_1.optPrio)((0, combi_1.altPrio)(_1.FormParamType, stru)));
|
|
10
10
|
return ret;
|
|
11
11
|
}
|
|
@@ -4,7 +4,7 @@ exports.SQLAliasField = void 0;
|
|
|
4
4
|
const combi_1 = require("../combi");
|
|
5
5
|
class SQLAliasField extends combi_1.Expression {
|
|
6
6
|
getRunnable() {
|
|
7
|
-
return (0, combi_1.regex)(
|
|
7
|
+
return (0, combi_1.regex)(/^(\/\w+\/)?\w+~\w+$/);
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
10
|
exports.SQLAliasField = SQLAliasField;
|
|
@@ -63,15 +63,16 @@ class WorkArea {
|
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
class StatementParser {
|
|
66
|
-
constructor(version) {
|
|
66
|
+
constructor(version, reg) {
|
|
67
67
|
if (!StatementParser.map) {
|
|
68
68
|
StatementParser.map = new StatementMap();
|
|
69
69
|
}
|
|
70
70
|
this.version = version;
|
|
71
|
+
this.reg = reg;
|
|
71
72
|
}
|
|
72
73
|
/** input is one full object */
|
|
73
74
|
run(input, globalMacros) {
|
|
74
|
-
const macros = new expand_macros_1.ExpandMacros(globalMacros, this.version);
|
|
75
|
+
const macros = new expand_macros_1.ExpandMacros(globalMacros, this.version, this.reg);
|
|
75
76
|
const wa = input.map(i => new WorkArea(i.file, i.tokens));
|
|
76
77
|
for (const w of wa) {
|
|
77
78
|
this.process(w);
|
|
@@ -195,13 +195,14 @@ class ObjectOriented {
|
|
|
195
195
|
if (def === undefined || name === undefined) {
|
|
196
196
|
return undefined;
|
|
197
197
|
}
|
|
198
|
+
const upper = name.toUpperCase();
|
|
198
199
|
for (const a of def.getAttributes().getConstants()) {
|
|
199
|
-
if (a.getName().toUpperCase() ===
|
|
200
|
+
if (a.getName().toUpperCase() === upper) {
|
|
200
201
|
return a;
|
|
201
202
|
}
|
|
202
203
|
}
|
|
203
204
|
for (const a of def.getAliases().getAll()) {
|
|
204
|
-
if (a.getName().toUpperCase() ===
|
|
205
|
+
if (a.getName().toUpperCase() === upper) {
|
|
205
206
|
const comp = a.getComponent();
|
|
206
207
|
const res = this.searchConstantName(this.scope.findObjectDefinition(comp.split("~")[0]), comp.split("~")[1]);
|
|
207
208
|
if (res) {
|
|
@@ -209,6 +210,12 @@ class ObjectOriented {
|
|
|
209
210
|
}
|
|
210
211
|
}
|
|
211
212
|
}
|
|
213
|
+
if (name.includes("~")) {
|
|
214
|
+
const interfaceName = upper.split("~")[0];
|
|
215
|
+
if (def.getImplementing().some((a) => a.name.toUpperCase() === interfaceName)) {
|
|
216
|
+
return this.searchConstantName(this.scope.findInterfaceDefinition(interfaceName), name.split("~")[1]);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
212
219
|
const sup = def.getSuperClass();
|
|
213
220
|
if (sup) {
|
|
214
221
|
return this.searchConstantName(this.findSuperDefinition(sup), name);
|
|
@@ -65,6 +65,9 @@ class BasicTypes {
|
|
|
65
65
|
if (chain === undefined) {
|
|
66
66
|
chain = node.findFirstExpression(Expressions.FieldSub);
|
|
67
67
|
}
|
|
68
|
+
if (chain === undefined) {
|
|
69
|
+
chain = node.findFirstExpression(Expressions.SimpleFieldChain);
|
|
70
|
+
}
|
|
68
71
|
if (chain === undefined) {
|
|
69
72
|
throw new Error("resolveLikeName, chain undefined");
|
|
70
73
|
}
|
|
@@ -11,7 +11,7 @@ class FormParam {
|
|
|
11
11
|
const nameToken = (_a = node.findFirstExpression(expressions_1.FormParamName)) === null || _a === void 0 ? void 0 : _a.getFirstToken();
|
|
12
12
|
if (node.findDirectTokenByText("STRUCTURE") && nameToken) {
|
|
13
13
|
// STRUCTURES typing
|
|
14
|
-
const typeName = (_b = node.findDirectExpression(expressions_1.
|
|
14
|
+
const typeName = (_b = node.findDirectExpression(expressions_1.SimpleFieldChain)) === null || _b === void 0 ? void 0 : _b.getFirstToken().getStr();
|
|
15
15
|
let type = undefined;
|
|
16
16
|
if (typeName) {
|
|
17
17
|
type = (_c = scope.findType(typeName)) === null || _c === void 0 ? void 0 : _c.getType();
|
|
@@ -8,9 +8,10 @@ const structure_parser_1 = require("./3_structures/structure_parser");
|
|
|
8
8
|
const abap_file_information_1 = require("./4_file_information/abap_file_information");
|
|
9
9
|
const abap_file_1 = require("./abap_file");
|
|
10
10
|
class ABAPParser {
|
|
11
|
-
constructor(version, globalMacros) {
|
|
11
|
+
constructor(version, globalMacros, reg) {
|
|
12
12
|
this.version = version ? version : version_1.defaultVersion;
|
|
13
13
|
this.globalMacros = globalMacros ? globalMacros : [];
|
|
14
|
+
this.reg = reg;
|
|
14
15
|
}
|
|
15
16
|
// files is input for a single object
|
|
16
17
|
parse(files) {
|
|
@@ -23,7 +24,7 @@ class ABAPParser {
|
|
|
23
24
|
const lexingRuntime = Date.now() - b1;
|
|
24
25
|
// 2: statements
|
|
25
26
|
const b2 = Date.now();
|
|
26
|
-
const statementResult = new statement_parser_1.StatementParser(this.version).run(lexerResult, this.globalMacros);
|
|
27
|
+
const statementResult = new statement_parser_1.StatementParser(this.version, this.reg).run(lexerResult, this.globalMacros);
|
|
27
28
|
const statementsRuntime = Date.now() - b2;
|
|
28
29
|
// 3: structures
|
|
29
30
|
const b3 = Date.now();
|
|
@@ -35,11 +35,11 @@ class ClassDefinition extends _identifier_1.Identifier {
|
|
|
35
35
|
helper.addAliasedTypes(this.aliases);
|
|
36
36
|
this.attributes = new class_attributes_1.Attributes(this.node, this.filename, scope);
|
|
37
37
|
this.types = this.attributes.getTypes();
|
|
38
|
-
this.methodDefs = new method_definitions_1.MethodDefinitions(this.node, this.filename, scope);
|
|
39
38
|
const events = this.node.findAllStatements(Statements.Events);
|
|
40
39
|
for (const e of events) {
|
|
41
40
|
this.events.push(new event_definition_1.EventDefinition(e, visibility_1.Visibility.Public, this.filename, scope)); // todo, all these are not Public
|
|
42
41
|
}
|
|
42
|
+
this.methodDefs = new method_definitions_1.MethodDefinitions(this.node, this.filename, scope);
|
|
43
43
|
scope.pop(node.getLastToken().getEnd());
|
|
44
44
|
const concat = this.node.findFirstStatement(Statements.ClassDefinition).concatTokens().toUpperCase();
|
|
45
45
|
this.testing = concat.includes(" FOR TESTING");
|
|
@@ -13,12 +13,12 @@ class ABAPObject extends _abstract_object_1.AbstractObject {
|
|
|
13
13
|
static is(x) {
|
|
14
14
|
return !!x && x instanceof ABAPObject;
|
|
15
15
|
}
|
|
16
|
-
parse(version, globalMacros) {
|
|
16
|
+
parse(version, globalMacros, reg) {
|
|
17
17
|
if (this.isDirty() === false) {
|
|
18
18
|
return { updated: false, runtime: 0 };
|
|
19
19
|
}
|
|
20
20
|
const abapFiles = this.getFiles().filter(f => f.getFilename().endsWith(".abap"));
|
|
21
|
-
const result = new abap_parser_1.ABAPParser(version, globalMacros).parse(abapFiles);
|
|
21
|
+
const result = new abap_parser_1.ABAPParser(version, globalMacros, reg).parse(abapFiles);
|
|
22
22
|
this.parsed = result.output;
|
|
23
23
|
this.old = result.issues;
|
|
24
24
|
this.dirty = false;
|
|
@@ -93,10 +93,8 @@ class Table extends _abstract_object_1.AbstractObject {
|
|
|
93
93
|
if (field.GROUPNAME !== undefined) {
|
|
94
94
|
components.push({ name: field.GROUPNAME, type: found });
|
|
95
95
|
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
components.push({ name: c.name, type: c.type });
|
|
99
|
-
}
|
|
96
|
+
for (const c of found.getComponents()) {
|
|
97
|
+
components.push({ name: c.name, type: c.type });
|
|
100
98
|
}
|
|
101
99
|
}
|
|
102
100
|
else if ((((_a = field.PRECFIELD) === null || _a === void 0 ? void 0 : _a.startsWith("CI_")) || ((_b = field.PRECFIELD) === null || _b === void 0 ? void 0 : _b.startsWith("SI_")))
|
package/build/src/registry.js
CHANGED
|
@@ -68,7 +68,7 @@ class Registry {
|
|
|
68
68
|
}
|
|
69
69
|
static abaplintVersion() {
|
|
70
70
|
// magic, see build script "version.sh"
|
|
71
|
-
return "2.
|
|
71
|
+
return "2.85.3";
|
|
72
72
|
}
|
|
73
73
|
getDDICReferences() {
|
|
74
74
|
return this.references;
|
|
@@ -259,7 +259,7 @@ class Registry {
|
|
|
259
259
|
// todo, refactor, this is a mess, see where-used, a lot of the code should be in this method instead
|
|
260
260
|
parsePrivate(input) {
|
|
261
261
|
const config = this.getConfig();
|
|
262
|
-
const result = input.parse(config.getVersion(), config.getSyntaxSetttings().globalMacros);
|
|
262
|
+
const result = input.parse(config.getVersion(), config.getSyntaxSetttings().globalMacros, this);
|
|
263
263
|
ParsingPerformance.push(input, result);
|
|
264
264
|
}
|
|
265
265
|
isDirty() {
|