@abaplint/core 2.82.16 → 2.83.2
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/README.md +6 -6
- package/build/abaplint.d.ts +11 -39
- package/build/src/abap/2_statements/expressions/index.js +0 -7
- package/build/src/abap/2_statements/statement_parser.js +1 -1
- package/build/src/abap/2_statements/statements/call_function.js +1 -1
- package/build/src/abap/artifacts.js +3 -3
- package/build/src/abap/flow/flow_graph.js +7 -7
- package/build/src/cds/artifacts.js +18 -0
- package/build/src/cds/cds_lexer.js +111 -0
- package/build/src/cds/cds_parser.js +25 -0
- package/build/src/cds/expressions/cds_annotation.js +14 -0
- package/build/src/cds/expressions/cds_association.js +13 -0
- package/build/src/cds/expressions/cds_define_view.js +14 -0
- package/build/src/cds/expressions/cds_element.js +12 -0
- package/build/src/cds/expressions/cds_join.js +12 -0
- package/build/src/cds/expressions/cds_name.js +11 -0
- package/build/src/cds/expressions/cds_select.js +15 -0
- package/build/src/cds/expressions/cds_where.js +12 -0
- package/build/src/cds/expressions/index.js +21 -0
- package/build/src/config.js +1 -0
- package/build/src/ddic.js +2 -2
- package/build/src/ddl/artifacts.js +18 -0
- package/build/src/ddl/ddl_parser.js +1 -1
- package/build/src/{abap/2_statements/expressions/ddl → ddl/expressions}/ddl_include.js +1 -1
- package/build/src/{abap/2_statements/expressions/ddl → ddl/expressions}/ddl_name.js +1 -1
- package/build/src/{abap/2_statements/expressions/ddl → ddl/expressions}/ddl_structure.js +1 -1
- package/build/src/{abap/2_statements/expressions/ddl → ddl/expressions}/ddl_structure_field.js +1 -1
- package/build/src/{abap/2_statements/expressions/ddl → ddl/expressions}/ddl_table.js +1 -1
- package/build/src/{abap/2_statements/expressions/ddl → ddl/expressions}/ddl_table_field.js +1 -1
- package/build/src/{abap/2_statements/expressions/ddl → ddl/expressions}/ddl_type.js +1 -1
- package/build/src/ddl/expressions/index.js +20 -0
- package/build/src/index.js +2 -2
- package/build/src/lsp/help.js +7 -7
- package/build/src/objects/data_definition.js +10 -2
- package/build/src/objects/data_element.js +6 -1
- package/build/src/objects/domain.js +2 -2
- package/build/src/objects/table.js +1 -1
- package/build/src/registry.js +15 -2
- package/build/src/rules/abapdoc.js +1 -1
- package/build/src/rules/align_parameters.js +33 -33
- package/build/src/rules/ambiguous_statement.js +5 -5
- package/build/src/rules/avoid_use.js +6 -6
- package/build/src/rules/begin_end_names.js +4 -4
- package/build/src/rules/begin_single_include.js +12 -12
- package/build/src/rules/call_transaction_authority_check.js +3 -3
- package/build/src/rules/cds_parser_error.js +46 -0
- package/build/src/rules/chain_mainly_declarations.js +4 -4
- package/build/src/rules/check_abstract.js +2 -2
- package/build/src/rules/check_comments.js +3 -3
- package/build/src/rules/check_include.js +3 -3
- package/build/src/rules/check_no_handler_pragma.js +8 -8
- package/build/src/rules/check_subrc.js +8 -8
- package/build/src/rules/commented_code.js +1 -1
- package/build/src/rules/constructor_visibility_public.js +4 -4
- package/build/src/rules/contains_tab.js +2 -2
- package/build/src/rules/dangerous_statement.js +1 -1
- package/build/src/rules/downport.js +35 -35
- package/build/src/rules/exit_or_check.js +3 -3
- package/build/src/rules/exporting.js +1 -1
- package/build/src/rules/forbidden_identifier.js +1 -1
- package/build/src/rules/forbidden_void_type.js +2 -2
- package/build/src/rules/functional_writing.js +17 -17
- package/build/src/rules/global_class.js +10 -10
- package/build/src/rules/identical_conditions.js +2 -2
- package/build/src/rules/identical_contents.js +15 -15
- package/build/src/rules/identical_descriptions.js +4 -4
- package/build/src/rules/if_in_if.js +7 -7
- package/build/src/rules/implement_methods.js +3 -3
- package/build/src/rules/in_statement_indentation.js +11 -11
- package/build/src/rules/index.js +3 -0
- package/build/src/rules/intf_referencing_clas.js +3 -3
- package/build/src/rules/line_break_style.js +2 -2
- package/build/src/rules/line_length.js +1 -1
- package/build/src/rules/line_only_punc.js +1 -1
- package/build/src/rules/local_variable_names.js +2 -2
- package/build/src/rules/many_parentheses.js +10 -10
- package/build/src/rules/max_one_method_parameter_per_line.js +7 -7
- package/build/src/rules/max_one_statement.js +3 -3
- package/build/src/rules/nesting.js +1 -1
- package/build/src/rules/no_aliases.js +43 -0
- package/build/src/rules/no_chained_assignment.js +1 -1
- package/build/src/rules/no_public_attributes.js +1 -1
- package/build/src/rules/no_yoda_conditions.js +4 -4
- package/build/src/rules/obsolete_statement.js +40 -38
- package/build/src/rules/omit_parameter_name.js +3 -3
- package/build/src/rules/omit_receiving.js +13 -13
- package/build/src/rules/parser_702_chaining.js +2 -2
- package/build/src/rules/parser_error.js +2 -2
- package/build/src/rules/parser_missing_space.js +1 -1
- package/build/src/rules/prefer_corresponding.js +48 -0
- package/build/src/rules/prefer_inline.js +16 -16
- package/build/src/rules/prefer_is_not.js +7 -7
- package/build/src/rules/prefer_raise_exception_new.js +3 -3
- package/build/src/rules/prefer_returning_to_exporting.js +1 -1
- package/build/src/rules/prefer_xsdbool.js +2 -2
- package/build/src/rules/remove_descriptions.js +4 -4
- package/build/src/rules/rfc_error_handling.js +9 -9
- package/build/src/rules/select_add_order_by.js +30 -15
- package/build/src/rules/select_performance.js +2 -2
- package/build/src/rules/sicf_consistency.js +4 -4
- package/build/src/rules/space_before_dot.js +2 -2
- package/build/src/rules/start_at_tab.js +1 -1
- package/build/src/rules/sy_modification.js +2 -2
- package/build/src/rules/tabl_enhancement_category.js +2 -2
- package/build/src/rules/unused_methods.js +9 -9
- package/build/src/rules/unused_variables.js +6 -6
- package/build/src/rules/use_bool_expression.js +8 -8
- package/build/src/rules/use_line_exists.js +6 -6
- package/build/src/rules/use_new.js +2 -2
- package/build/src/rules/when_others_last.js +6 -6
- package/package.json +66 -66
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
# @abaplint/core
|
|
2
|
-
|
|
3
|
-
[abaplint](https://abaplint.org/) core library
|
|
4
|
-
|
|
5
|
-
Exposes functionallity like the parser and rules, which can be used in other projects.
|
|
6
|
-
|
|
1
|
+
# @abaplint/core
|
|
2
|
+
|
|
3
|
+
[abaplint](https://abaplint.org/) core library
|
|
4
|
+
|
|
5
|
+
Exposes functionallity like the parser and rules, which can be used in other projects.
|
|
6
|
+
|
|
7
7
|
For more information see https://github.com/abaplint/abaplint
|
package/build/abaplint.d.ts
CHANGED
|
@@ -170,7 +170,7 @@ declare class ArrowOrDash extends Expression {
|
|
|
170
170
|
getRunnable(): IStatementRunnable;
|
|
171
171
|
}
|
|
172
172
|
|
|
173
|
-
export declare class
|
|
173
|
+
export declare class ArtifactsABAP {
|
|
174
174
|
static getStructures(): IStructure[];
|
|
175
175
|
static getExpressions(): (new () => Expression)[];
|
|
176
176
|
static getStatements(): IStatement[];
|
|
@@ -1123,6 +1123,8 @@ declare class DataDefinition extends AbstractObject {
|
|
|
1123
1123
|
getDescription(): string | undefined;
|
|
1124
1124
|
parseType(_reg: IRegistry): AbstractType;
|
|
1125
1125
|
setDirty(): void;
|
|
1126
|
+
findSourceFile(): IFile | undefined;
|
|
1127
|
+
temporaryParse(): ExpressionNode | undefined;
|
|
1126
1128
|
parse(): IParseResult;
|
|
1127
1129
|
}
|
|
1128
1130
|
|
|
@@ -1139,6 +1141,7 @@ declare class DataElement extends AbstractObject {
|
|
|
1139
1141
|
allowNamespace: boolean;
|
|
1140
1142
|
};
|
|
1141
1143
|
setDirty(): void;
|
|
1144
|
+
getDomainName(): string | undefined;
|
|
1142
1145
|
parseType(reg: IRegistry): AbstractType;
|
|
1143
1146
|
parse(): {
|
|
1144
1147
|
updated: boolean;
|
|
@@ -1177,7 +1180,7 @@ declare class DDIC {
|
|
|
1177
1180
|
lookupNoVoid(name: string): ILookupResult | undefined;
|
|
1178
1181
|
/** lookup with voiding and unknown types */
|
|
1179
1182
|
lookup(name: string): ILookupResult;
|
|
1180
|
-
lookupDomain(name: string): ILookupResult;
|
|
1183
|
+
lookupDomain(name: string, parent?: string): ILookupResult;
|
|
1181
1184
|
lookupDataElement(name: string | undefined): ILookupResult;
|
|
1182
1185
|
lookupTableOrView(name: string | undefined): ILookupResult;
|
|
1183
1186
|
lookupTableOrView2(name: string | undefined): Table | DataDefinition | View | undefined;
|
|
@@ -1187,44 +1190,16 @@ declare class DDIC {
|
|
|
1187
1190
|
textToType(text: string | undefined, length: string | undefined, decimals: string | undefined, parent: string, qualify?: boolean): AbstractType;
|
|
1188
1191
|
}
|
|
1189
1192
|
|
|
1190
|
-
declare class DDLInclude extends Expression {
|
|
1191
|
-
getRunnable(): IStatementRunnable;
|
|
1192
|
-
}
|
|
1193
|
-
|
|
1194
1193
|
declare enum DDLKind {
|
|
1195
1194
|
Structure = "structure",
|
|
1196
1195
|
Table = "table"
|
|
1197
1196
|
}
|
|
1198
1197
|
|
|
1199
|
-
declare class DDLName extends Expression {
|
|
1200
|
-
getRunnable(): IStatementRunnable;
|
|
1201
|
-
}
|
|
1202
|
-
|
|
1203
1198
|
export declare class DDLParser {
|
|
1204
1199
|
parse(file: IFile): IDDLParserResult | undefined;
|
|
1205
1200
|
private parsedToResult;
|
|
1206
1201
|
}
|
|
1207
1202
|
|
|
1208
|
-
declare class DDLStructure extends Expression {
|
|
1209
|
-
getRunnable(): IStatementRunnable;
|
|
1210
|
-
}
|
|
1211
|
-
|
|
1212
|
-
declare class DDLStructureField extends Expression {
|
|
1213
|
-
getRunnable(): IStatementRunnable;
|
|
1214
|
-
}
|
|
1215
|
-
|
|
1216
|
-
declare class DDLTable extends Expression {
|
|
1217
|
-
getRunnable(): IStatementRunnable;
|
|
1218
|
-
}
|
|
1219
|
-
|
|
1220
|
-
declare class DDLTableField extends Expression {
|
|
1221
|
-
getRunnable(): IStatementRunnable;
|
|
1222
|
-
}
|
|
1223
|
-
|
|
1224
|
-
declare class DDLType extends Expression {
|
|
1225
|
-
getRunnable(): IStatementRunnable;
|
|
1226
|
-
}
|
|
1227
|
-
|
|
1228
1203
|
declare class DecFloat16Type extends AbstractType {
|
|
1229
1204
|
toText(): string;
|
|
1230
1205
|
isGeneric(): boolean;
|
|
@@ -1358,7 +1333,7 @@ declare class Domain extends AbstractObject {
|
|
|
1358
1333
|
allowNamespace: boolean;
|
|
1359
1334
|
};
|
|
1360
1335
|
setDirty(): void;
|
|
1361
|
-
parseType(reg: IRegistry): AbstractType;
|
|
1336
|
+
parseType(reg: IRegistry, parent?: string): AbstractType;
|
|
1362
1337
|
parse(): {
|
|
1363
1338
|
updated: boolean;
|
|
1364
1339
|
runtime: number;
|
|
@@ -1688,13 +1663,6 @@ declare namespace Expressions {
|
|
|
1688
1663
|
DataDefinition_2 as DataDefinition,
|
|
1689
1664
|
DatabaseConnection,
|
|
1690
1665
|
DatabaseTable,
|
|
1691
|
-
DDLInclude,
|
|
1692
|
-
DDLName,
|
|
1693
|
-
DDLStructureField,
|
|
1694
|
-
DDLStructure,
|
|
1695
|
-
DDLTableField,
|
|
1696
|
-
DDLTable,
|
|
1697
|
-
DDLType,
|
|
1698
1666
|
Decimals,
|
|
1699
1667
|
Default,
|
|
1700
1668
|
DefinitionName,
|
|
@@ -2572,10 +2540,14 @@ declare interface IGlobalConfig {
|
|
|
2572
2540
|
useApackDependencies?: boolean;
|
|
2573
2541
|
/** Do not report any issues for includes without main programs */
|
|
2574
2542
|
skipIncludesWithoutMain?: boolean;
|
|
2575
|
-
/** list of files to exclude, case insensitive regex
|
|
2543
|
+
/** list of files to exclude, these files are not added when running syntax check or any other rules, case insensitive regex
|
|
2576
2544
|
* @uniqueItems true
|
|
2577
2545
|
*/
|
|
2578
2546
|
exclude?: string[];
|
|
2547
|
+
/** list of files to not report any issues for, case insensitive regex
|
|
2548
|
+
* @uniqueItems true
|
|
2549
|
+
*/
|
|
2550
|
+
noIssues?: string[];
|
|
2579
2551
|
}
|
|
2580
2552
|
|
|
2581
2553
|
declare interface IImplementing {
|
|
@@ -47,13 +47,6 @@ __exportStar(require("./corresponding_body"), exports);
|
|
|
47
47
|
__exportStar(require("./data_definition"), exports);
|
|
48
48
|
__exportStar(require("./database_connection"), exports);
|
|
49
49
|
__exportStar(require("./database_table"), exports);
|
|
50
|
-
__exportStar(require("./ddl/ddl_include"), exports);
|
|
51
|
-
__exportStar(require("./ddl/ddl_name"), exports);
|
|
52
|
-
__exportStar(require("./ddl/ddl_structure_field"), exports);
|
|
53
|
-
__exportStar(require("./ddl/ddl_structure"), exports);
|
|
54
|
-
__exportStar(require("./ddl/ddl_table_field"), exports);
|
|
55
|
-
__exportStar(require("./ddl/ddl_table"), exports);
|
|
56
|
-
__exportStar(require("./ddl/ddl_type"), exports);
|
|
57
50
|
__exportStar(require("./decimals"), exports);
|
|
58
51
|
__exportStar(require("./default"), exports);
|
|
59
52
|
__exportStar(require("./definition_name"), exports);
|
|
@@ -14,7 +14,7 @@ exports.STATEMENT_MAX_TOKENS = 1000;
|
|
|
14
14
|
class StatementMap {
|
|
15
15
|
constructor() {
|
|
16
16
|
this.map = {};
|
|
17
|
-
for (const stat of artifacts_1.
|
|
17
|
+
for (const stat of artifacts_1.ArtifactsABAP.getStatements()) {
|
|
18
18
|
const f = stat.getMatcher().first();
|
|
19
19
|
if (f.length === 0) {
|
|
20
20
|
throw new Error("StatementMap, first must have contents");
|
|
@@ -9,7 +9,7 @@ class CallFunction {
|
|
|
9
9
|
const starting = (0, combi_1.seq)("STARTING NEW TASK", expressions_1.SimpleSource2);
|
|
10
10
|
const update = (0, combi_1.str)("IN UPDATE TASK");
|
|
11
11
|
const unit = (0, combi_1.seq)("UNIT", expressions_1.Source);
|
|
12
|
-
const background = (0, combi_1.seq)("IN BACKGROUND", (0, combi_1.alt)("TASK", unit));
|
|
12
|
+
const background = (0, combi_1.verNot)(version_1.Version.Cloud, (0, combi_1.seq)("IN BACKGROUND", (0, combi_1.alt)("TASK", unit)));
|
|
13
13
|
const calling = (0, combi_1.seq)("CALLING", expressions_1.MethodName, "ON END OF TASK");
|
|
14
14
|
const performing = (0, combi_1.seq)("PERFORMING", expressions_1.FormName, "ON END OF TASK");
|
|
15
15
|
const separate = (0, combi_1.str)("AS SEPARATE UNIT");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.ArtifactsABAP = void 0;
|
|
4
4
|
const Statements = require("./2_statements/statements");
|
|
5
5
|
const Expressions = require("./2_statements/expressions");
|
|
6
6
|
const combi_1 = require("./2_statements/combi");
|
|
@@ -35,7 +35,7 @@ class List {
|
|
|
35
35
|
function className(cla) {
|
|
36
36
|
return cla.constructor.name;
|
|
37
37
|
}
|
|
38
|
-
class
|
|
38
|
+
class ArtifactsABAP {
|
|
39
39
|
static getStructures() {
|
|
40
40
|
const ret = [];
|
|
41
41
|
const list = Structures;
|
|
@@ -77,5 +77,5 @@ class Artifacts {
|
|
|
77
77
|
return list.get();
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
|
-
exports.
|
|
80
|
+
exports.ArtifactsABAP = ArtifactsABAP;
|
|
81
81
|
//# sourceMappingURL=artifacts.js.map
|
|
@@ -72,13 +72,13 @@ class FlowGraph {
|
|
|
72
72
|
this.label = label;
|
|
73
73
|
}
|
|
74
74
|
toDigraph() {
|
|
75
|
-
return `digraph G {
|
|
76
|
-
labelloc="t";
|
|
77
|
-
label="${this.label}";
|
|
78
|
-
graph [fontname = "helvetica"];
|
|
79
|
-
node [fontname = "helvetica", shape="box"];
|
|
80
|
-
edge [fontname = "helvetica"];
|
|
81
|
-
${this.toTextEdges()}
|
|
75
|
+
return `digraph G {
|
|
76
|
+
labelloc="t";
|
|
77
|
+
label="${this.label}";
|
|
78
|
+
graph [fontname = "helvetica"];
|
|
79
|
+
node [fontname = "helvetica", shape="box"];
|
|
80
|
+
edge [fontname = "helvetica"];
|
|
81
|
+
${this.toTextEdges()}
|
|
82
82
|
}`;
|
|
83
83
|
}
|
|
84
84
|
listSources(node) {
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ArtifactsCDS = void 0;
|
|
4
|
+
const Expressions = require("./expressions");
|
|
5
|
+
class ArtifactsCDS {
|
|
6
|
+
static getExpressions() {
|
|
7
|
+
const ret = [];
|
|
8
|
+
const list = Expressions;
|
|
9
|
+
for (const key in Expressions) {
|
|
10
|
+
if (typeof list[key] === "function") {
|
|
11
|
+
ret.push(list[key]);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
return ret;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.ArtifactsCDS = ArtifactsCDS;
|
|
18
|
+
//# sourceMappingURL=artifacts.js.map
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CDSLexer = void 0;
|
|
4
|
+
const tokens_1 = require("../abap/1_lexer/tokens");
|
|
5
|
+
const position_1 = require("../position");
|
|
6
|
+
// todo: Keywords must be all uppercase, all lowercase, or in lowercase with an
|
|
7
|
+
// uppercase initial letter. Other mixes of uppercase and lowercase are not allowed
|
|
8
|
+
class Stream {
|
|
9
|
+
constructor(buffer) {
|
|
10
|
+
this.buffer = buffer;
|
|
11
|
+
}
|
|
12
|
+
takeNext() {
|
|
13
|
+
const next = this.buffer.substring(0, 1);
|
|
14
|
+
this.buffer = this.buffer.substring(1);
|
|
15
|
+
return next;
|
|
16
|
+
}
|
|
17
|
+
peekNext() {
|
|
18
|
+
const next = this.buffer.substring(0, 1);
|
|
19
|
+
return next;
|
|
20
|
+
}
|
|
21
|
+
length() {
|
|
22
|
+
return this.buffer.length;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
class Result {
|
|
26
|
+
constructor() {
|
|
27
|
+
this.result = [];
|
|
28
|
+
}
|
|
29
|
+
add(text, row, col) {
|
|
30
|
+
if (text.length > 0) {
|
|
31
|
+
this.result.push(new tokens_1.Identifier(new position_1.Position(row, col), text));
|
|
32
|
+
}
|
|
33
|
+
return "";
|
|
34
|
+
}
|
|
35
|
+
get() {
|
|
36
|
+
return this.result;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
var Mode;
|
|
40
|
+
(function (Mode) {
|
|
41
|
+
Mode[Mode["Default"] = 0] = "Default";
|
|
42
|
+
Mode[Mode["String"] = 1] = "String";
|
|
43
|
+
Mode[Mode["SingleLineComment"] = 2] = "SingleLineComment";
|
|
44
|
+
Mode[Mode["MultiLineComment"] = 3] = "MultiLineComment";
|
|
45
|
+
})(Mode || (Mode = {}));
|
|
46
|
+
class CDSLexer {
|
|
47
|
+
static run(file) {
|
|
48
|
+
const result = new Result();
|
|
49
|
+
let mode = Mode.Default;
|
|
50
|
+
let row = 1;
|
|
51
|
+
let col = 1;
|
|
52
|
+
let build = "";
|
|
53
|
+
const stream = new Stream(file.getRaw());
|
|
54
|
+
while (stream.length() > 0) {
|
|
55
|
+
const next = stream.takeNext();
|
|
56
|
+
const nextNext = stream.peekNext();
|
|
57
|
+
col++;
|
|
58
|
+
if (mode === Mode.String) {
|
|
59
|
+
build += next;
|
|
60
|
+
if (next === "'") {
|
|
61
|
+
build = result.add(build, row, col);
|
|
62
|
+
mode = Mode.Default;
|
|
63
|
+
}
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
if (mode === Mode.SingleLineComment) {
|
|
67
|
+
if (next === "\n") {
|
|
68
|
+
mode = Mode.Default;
|
|
69
|
+
}
|
|
70
|
+
continue;
|
|
71
|
+
}
|
|
72
|
+
else if (mode === Mode.Default && next === "/" && nextNext === "/") {
|
|
73
|
+
mode = Mode.SingleLineComment;
|
|
74
|
+
build = result.add(build, row, col);
|
|
75
|
+
continue;
|
|
76
|
+
}
|
|
77
|
+
switch (next) {
|
|
78
|
+
case "'":
|
|
79
|
+
mode = Mode.String;
|
|
80
|
+
build += next;
|
|
81
|
+
break;
|
|
82
|
+
case " ":
|
|
83
|
+
build = result.add(build, row, col);
|
|
84
|
+
break;
|
|
85
|
+
case "\n":
|
|
86
|
+
build = result.add(build, row, col);
|
|
87
|
+
row++;
|
|
88
|
+
col = 0;
|
|
89
|
+
break;
|
|
90
|
+
case ";":
|
|
91
|
+
case ",":
|
|
92
|
+
case ".":
|
|
93
|
+
case "{":
|
|
94
|
+
case ":":
|
|
95
|
+
case "}":
|
|
96
|
+
case "[":
|
|
97
|
+
case "]":
|
|
98
|
+
build = result.add(build, row, col);
|
|
99
|
+
result.add(next, row, col);
|
|
100
|
+
break;
|
|
101
|
+
default:
|
|
102
|
+
build += next;
|
|
103
|
+
break;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
result.add(build, row, col);
|
|
107
|
+
return result.get();
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
exports.CDSLexer = CDSLexer;
|
|
111
|
+
//# sourceMappingURL=cds_lexer.js.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CDSParser = void 0;
|
|
4
|
+
const combi_1 = require("../abap/2_statements/combi");
|
|
5
|
+
const nodes_1 = require("../abap/nodes");
|
|
6
|
+
const version_1 = require("../version");
|
|
7
|
+
const cds_lexer_1 = require("./cds_lexer");
|
|
8
|
+
const Expressions = require("./expressions");
|
|
9
|
+
// todo: the names of the ABAP + CDS + DDL expressions might overlap, if overlapping the singleton will fail
|
|
10
|
+
class CDSParser {
|
|
11
|
+
parse(file) {
|
|
12
|
+
if (file === undefined) {
|
|
13
|
+
return undefined;
|
|
14
|
+
}
|
|
15
|
+
const tokens = cds_lexer_1.CDSLexer.run(file);
|
|
16
|
+
// console.dir(tokens);
|
|
17
|
+
const res = combi_1.Combi.run(new Expressions.CDSDefineView(), tokens, version_1.defaultVersion);
|
|
18
|
+
if (res === undefined || !(res[0] instanceof nodes_1.ExpressionNode)) {
|
|
19
|
+
return undefined;
|
|
20
|
+
}
|
|
21
|
+
return res[0];
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.CDSParser = CDSParser;
|
|
25
|
+
//# sourceMappingURL=cds_parser.js.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CDSAnnotation = void 0;
|
|
4
|
+
const combi_1 = require("../../abap/2_statements/combi");
|
|
5
|
+
class CDSAnnotation extends combi_1.Expression {
|
|
6
|
+
getRunnable() {
|
|
7
|
+
// todo: add all the known annotations
|
|
8
|
+
const value = (0, combi_1.alt)((0, combi_1.regex)(/^'[\w ]+'$/), "true", "false", (0, combi_1.regex)(/^#\w+$/));
|
|
9
|
+
const valueList = (0, combi_1.seq)("[", value, (0, combi_1.star)((0, combi_1.seq)(",", value)), "]");
|
|
10
|
+
return (0, combi_1.seq)((0, combi_1.regex)(/^@\w+$/), (0, combi_1.plus)((0, combi_1.seq)(".", (0, combi_1.regex)(/^\w+$/))), (0, combi_1.opt)(":"), (0, combi_1.opt)((0, combi_1.alt)(valueList, value)));
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.CDSAnnotation = CDSAnnotation;
|
|
14
|
+
//# sourceMappingURL=cds_annotation.js.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CDSAssociation = void 0;
|
|
4
|
+
const _1 = require(".");
|
|
5
|
+
const combi_1 = require("../../abap/2_statements/combi");
|
|
6
|
+
class CDSAssociation extends combi_1.Expression {
|
|
7
|
+
getRunnable() {
|
|
8
|
+
const cardinality = (0, combi_1.alt)("[0..1]", "[0..*]");
|
|
9
|
+
return (0, combi_1.seq)("ASSOCIATION", cardinality, "TO", _1.CDSName);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
exports.CDSAssociation = CDSAssociation;
|
|
13
|
+
//# sourceMappingURL=cds_association.js.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CDSDefineView = void 0;
|
|
4
|
+
const _1 = require(".");
|
|
5
|
+
const combi_1 = require("../../abap/2_statements/combi");
|
|
6
|
+
const cds_name_1 = require("./cds_name");
|
|
7
|
+
const cds_select_1 = require("./cds_select");
|
|
8
|
+
class CDSDefineView extends combi_1.Expression {
|
|
9
|
+
getRunnable() {
|
|
10
|
+
return (0, combi_1.seq)((0, combi_1.star)(_1.CDSAnnotation), (0, combi_1.str)("DEFINE VIEW"), cds_name_1.CDSName, "AS", cds_select_1.CDSSelect, (0, combi_1.opt)(";"));
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.CDSDefineView = CDSDefineView;
|
|
14
|
+
//# sourceMappingURL=cds_define_view.js.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CDSElement = void 0;
|
|
4
|
+
const _1 = require(".");
|
|
5
|
+
const combi_1 = require("../../abap/2_statements/combi");
|
|
6
|
+
class CDSElement extends combi_1.Expression {
|
|
7
|
+
getRunnable() {
|
|
8
|
+
return (0, combi_1.seq)((0, combi_1.star)(_1.CDSAnnotation), (0, combi_1.optPrio)("KEY"), _1.CDSName, (0, combi_1.optPrio)((0, combi_1.seq)("AS", _1.CDSName)));
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.CDSElement = CDSElement;
|
|
12
|
+
//# sourceMappingURL=cds_element.js.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CDSJoin = void 0;
|
|
4
|
+
const _1 = require(".");
|
|
5
|
+
const combi_1 = require("../../abap/2_statements/combi");
|
|
6
|
+
class CDSJoin extends combi_1.Expression {
|
|
7
|
+
getRunnable() {
|
|
8
|
+
return (0, combi_1.seq)("INNER JOIN", _1.CDSName);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.CDSJoin = CDSJoin;
|
|
12
|
+
//# sourceMappingURL=cds_join.js.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CDSName = void 0;
|
|
4
|
+
const combi_1 = require("../../abap/2_statements/combi");
|
|
5
|
+
class CDSName extends combi_1.Expression {
|
|
6
|
+
getRunnable() {
|
|
7
|
+
return (0, combi_1.regex)(/^\$?[\w_]+$/);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
exports.CDSName = CDSName;
|
|
11
|
+
//# sourceMappingURL=cds_name.js.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CDSSelect = void 0;
|
|
4
|
+
const _1 = require(".");
|
|
5
|
+
const combi_1 = require("../../abap/2_statements/combi");
|
|
6
|
+
const cds_association_1 = require("./cds_association");
|
|
7
|
+
const cds_element_1 = require("./cds_element");
|
|
8
|
+
const cds_join_1 = require("./cds_join");
|
|
9
|
+
class CDSSelect extends combi_1.Expression {
|
|
10
|
+
getRunnable() {
|
|
11
|
+
return (0, combi_1.seq)((0, combi_1.str)("SELECT FROM"), _1.CDSName, (0, combi_1.opt)((0, combi_1.seq)("AS", _1.CDSName)), (0, combi_1.opt)(cds_join_1.CDSJoin), (0, combi_1.star)(cds_association_1.CDSAssociation), (0, combi_1.str)("{"), (0, combi_1.plus)(cds_element_1.CDSElement), (0, combi_1.star)((0, combi_1.seq)(",", cds_element_1.CDSElement)), (0, combi_1.str)("}"), (0, combi_1.opt)(_1.CDSWhere));
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.CDSSelect = CDSSelect;
|
|
15
|
+
//# sourceMappingURL=cds_select.js.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CDSWhere = void 0;
|
|
4
|
+
const _1 = require(".");
|
|
5
|
+
const combi_1 = require("../../abap/2_statements/combi");
|
|
6
|
+
class CDSWhere extends combi_1.Expression {
|
|
7
|
+
getRunnable() {
|
|
8
|
+
return (0, combi_1.seq)("WHERE", _1.CDSName, "=", _1.CDSName, (0, combi_1.star)((0, combi_1.seq)(".", _1.CDSName)));
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.CDSWhere = CDSWhere;
|
|
12
|
+
//# sourceMappingURL=cds_where.js.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
__exportStar(require("./cds_annotation"), exports);
|
|
14
|
+
__exportStar(require("./cds_association"), exports);
|
|
15
|
+
__exportStar(require("./cds_define_view"), exports);
|
|
16
|
+
__exportStar(require("./cds_element"), exports);
|
|
17
|
+
__exportStar(require("./cds_join"), exports);
|
|
18
|
+
__exportStar(require("./cds_name"), exports);
|
|
19
|
+
__exportStar(require("./cds_select"), exports);
|
|
20
|
+
__exportStar(require("./cds_where"), exports);
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
package/build/src/config.js
CHANGED
package/build/src/ddic.js
CHANGED
|
@@ -185,10 +185,10 @@ class DDIC {
|
|
|
185
185
|
return { type: new Types.VoidType(name) };
|
|
186
186
|
}
|
|
187
187
|
}
|
|
188
|
-
lookupDomain(name) {
|
|
188
|
+
lookupDomain(name, parent) {
|
|
189
189
|
const found = this.reg.getObject("DOMA", name);
|
|
190
190
|
if (found) {
|
|
191
|
-
return { type: found.parseType(this.reg), object: found };
|
|
191
|
+
return { type: found.parseType(this.reg, parent), object: found };
|
|
192
192
|
}
|
|
193
193
|
else if (this.reg.inErrorNamespace(name)) {
|
|
194
194
|
return { type: new Types.UnknownType(name + ", lookupDomain"), object: undefined };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ArtifactsDDL = void 0;
|
|
4
|
+
const Expressions = require("./expressions");
|
|
5
|
+
class ArtifactsDDL {
|
|
6
|
+
static getExpressions() {
|
|
7
|
+
const ret = [];
|
|
8
|
+
const list = Expressions;
|
|
9
|
+
for (const key in Expressions) {
|
|
10
|
+
if (typeof list[key] === "function") {
|
|
11
|
+
ret.push(list[key]);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
return ret;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.ArtifactsDDL = ArtifactsDDL;
|
|
18
|
+
//# sourceMappingURL=artifacts.js.map
|
|
@@ -5,7 +5,7 @@ const combi_1 = require("../abap/2_statements/combi");
|
|
|
5
5
|
const nodes_1 = require("../abap/nodes");
|
|
6
6
|
const version_1 = require("../version");
|
|
7
7
|
const ddl_lexer_1 = require("./ddl_lexer");
|
|
8
|
-
const Expressions = require("
|
|
8
|
+
const Expressions = require("./expressions");
|
|
9
9
|
var DDLKind;
|
|
10
10
|
(function (DDLKind) {
|
|
11
11
|
DDLKind["Structure"] = "structure";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DDLInclude = void 0;
|
|
4
|
-
const combi_1 = require("../../combi");
|
|
4
|
+
const combi_1 = require("../../abap/2_statements/combi");
|
|
5
5
|
const ddl_name_1 = require("./ddl_name");
|
|
6
6
|
class DDLInclude extends combi_1.Expression {
|
|
7
7
|
getRunnable() {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DDLName = void 0;
|
|
4
|
-
const combi_1 = require("../../combi");
|
|
4
|
+
const combi_1 = require("../../abap/2_statements/combi");
|
|
5
5
|
class DDLName extends combi_1.Expression {
|
|
6
6
|
getRunnable() {
|
|
7
7
|
return (0, combi_1.regex)(/^\w+$/);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DDLStructure = void 0;
|
|
4
|
-
const combi_1 = require("../../combi");
|
|
4
|
+
const combi_1 = require("../../abap/2_statements/combi");
|
|
5
5
|
const ddl_structure_field_1 = require("./ddl_structure_field");
|
|
6
6
|
const ddl_name_1 = require("./ddl_name");
|
|
7
7
|
const ddl_include_1 = require("./ddl_include");
|
package/build/src/{abap/2_statements/expressions/ddl → ddl/expressions}/ddl_structure_field.js
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DDLStructureField = void 0;
|
|
4
|
-
const combi_1 = require("../../combi");
|
|
4
|
+
const combi_1 = require("../../abap/2_statements/combi");
|
|
5
5
|
const ddl_name_1 = require("./ddl_name");
|
|
6
6
|
const ddl_type_1 = require("./ddl_type");
|
|
7
7
|
class DDLStructureField extends combi_1.Expression {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DDLTable = void 0;
|
|
4
|
-
const combi_1 = require("../../combi");
|
|
4
|
+
const combi_1 = require("../../abap/2_statements/combi");
|
|
5
5
|
const ddl_include_1 = require("./ddl_include");
|
|
6
6
|
const ddl_name_1 = require("./ddl_name");
|
|
7
7
|
const ddl_table_field_1 = require("./ddl_table_field");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DDLTableField = void 0;
|
|
4
|
-
const combi_1 = require("../../combi");
|
|
4
|
+
const combi_1 = require("../../abap/2_statements/combi");
|
|
5
5
|
const ddl_name_1 = require("./ddl_name");
|
|
6
6
|
const ddl_type_1 = require("./ddl_type");
|
|
7
7
|
class DDLTableField extends combi_1.Expression {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DDLType = void 0;
|
|
4
|
-
const combi_1 = require("../../combi");
|
|
4
|
+
const combi_1 = require("../../abap/2_statements/combi");
|
|
5
5
|
class DDLType extends combi_1.Expression {
|
|
6
6
|
getRunnable() {
|
|
7
7
|
return (0, combi_1.regex)(/^(abap\.)?\w+(\(\d+\))?$/);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
__exportStar(require("./ddl_include"), exports);
|
|
14
|
+
__exportStar(require("./ddl_name"), exports);
|
|
15
|
+
__exportStar(require("./ddl_structure_field"), exports);
|
|
16
|
+
__exportStar(require("./ddl_structure"), exports);
|
|
17
|
+
__exportStar(require("./ddl_table_field"), exports);
|
|
18
|
+
__exportStar(require("./ddl_table"), exports);
|
|
19
|
+
__exportStar(require("./ddl_type"), exports);
|
|
20
|
+
//# sourceMappingURL=index.js.map
|