@abaplint/core 2.119.54 → 2.119.55
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 +20 -4
- package/build/src/abap/2_statements/combi.js +1 -1
- package/build/src/abap/2_statements/expressions/type_structure.js +4 -4
- package/build/src/cds/cds_parser.js +6 -0
- package/build/src/cds/expressions/cds_aggregate.js +3 -5
- package/build/src/cds/expressions/cds_define_abstract.js +1 -1
- package/build/src/cds/expressions/cds_define_external_entity.js +20 -0
- package/build/src/cds/expressions/cds_define_hierarchy.js +7 -1
- package/build/src/cds/expressions/cds_define_projection.js +3 -1
- package/build/src/cds/expressions/cds_define_table_entity.js +19 -0
- package/build/src/cds/expressions/cds_define_view.js +2 -1
- package/build/src/cds/expressions/cds_element.js +4 -7
- package/build/src/cds/expressions/cds_extend_view.js +8 -3
- package/build/src/cds/expressions/cds_function.js +5 -4
- package/build/src/cds/expressions/cds_prefixed_name.js +2 -15
- package/build/src/cds/expressions/cds_provider_contract.js +1 -1
- package/build/src/cds/expressions/cds_select.js +5 -2
- package/build/src/cds/expressions/cds_source.js +6 -5
- package/build/src/cds/expressions/cds_string.js +1 -8
- package/build/src/cds/expressions/index.js +2 -0
- package/build/src/config.js +8 -3
- package/build/src/ddl/ddl_parser.js +89 -24
- package/build/src/ddl/expressions/ddl_aspect.js +18 -0
- package/build/src/ddl/expressions/ddl_clauses.js +27 -0
- package/build/src/ddl/expressions/ddl_extend.js +15 -0
- package/build/src/ddl/expressions/ddl_extend_type.js +18 -0
- package/build/src/ddl/expressions/ddl_include.js +4 -1
- package/build/src/ddl/expressions/ddl_literal.js +18 -0
- package/build/src/ddl/expressions/ddl_name.js +2 -1
- package/build/src/ddl/expressions/ddl_named_include.js +15 -0
- package/build/src/ddl/expressions/ddl_qualified_name.js +12 -0
- package/build/src/ddl/expressions/ddl_structure.js +6 -3
- package/build/src/ddl/expressions/ddl_structure_field.js +2 -1
- package/build/src/ddl/expressions/ddl_table.js +5 -1
- package/build/src/ddl/expressions/ddl_table_field.js +4 -1
- package/build/src/ddl/expressions/ddl_type.js +7 -1
- package/build/src/ddl/expressions/ddl_where.js +15 -0
- package/build/src/ddl/expressions/index.js +8 -0
- package/build/src/index.js +3 -2
- package/build/src/objects/data_definition.js +7 -0
- package/build/src/registry.js +1 -1
- package/package.json +1 -1
package/build/abaplint.d.ts
CHANGED
|
@@ -927,6 +927,10 @@ declare class CDSDefineCustom extends Expression {
|
|
|
927
927
|
getRunnable(): IStatementRunnable;
|
|
928
928
|
}
|
|
929
929
|
|
|
930
|
+
declare class CDSDefineExternalEntity extends Expression {
|
|
931
|
+
getRunnable(): IStatementRunnable;
|
|
932
|
+
}
|
|
933
|
+
|
|
930
934
|
declare class CDSDefineHierarchy extends Expression {
|
|
931
935
|
getRunnable(): IStatementRunnable;
|
|
932
936
|
}
|
|
@@ -935,6 +939,10 @@ declare class CDSDefineProjection extends Expression {
|
|
|
935
939
|
getRunnable(): IStatementRunnable;
|
|
936
940
|
}
|
|
937
941
|
|
|
942
|
+
declare class CDSDefineTableEntity extends Expression {
|
|
943
|
+
getRunnable(): IStatementRunnable;
|
|
944
|
+
}
|
|
945
|
+
|
|
938
946
|
declare class CDSDefineTableFunction extends Expression {
|
|
939
947
|
getRunnable(): IStatementRunnable;
|
|
940
948
|
}
|
|
@@ -1862,14 +1870,20 @@ declare class DDIC {
|
|
|
1862
1870
|
}): AbstractType;
|
|
1863
1871
|
}
|
|
1864
1872
|
|
|
1865
|
-
declare enum DDLKind {
|
|
1873
|
+
export declare enum DDLKind {
|
|
1866
1874
|
Structure = "structure",
|
|
1867
|
-
Table = "table"
|
|
1875
|
+
Table = "table",
|
|
1876
|
+
Aspect = "aspect",
|
|
1877
|
+
ExtendType = "extend-type"
|
|
1868
1878
|
}
|
|
1869
1879
|
|
|
1870
1880
|
export declare class DDLParser {
|
|
1871
1881
|
parse(file: IFile): IDDLParserResult | undefined;
|
|
1872
1882
|
private parsedToResult;
|
|
1883
|
+
private compactTokens;
|
|
1884
|
+
private hasKey;
|
|
1885
|
+
private hasNotNull;
|
|
1886
|
+
private kindOf;
|
|
1873
1887
|
}
|
|
1874
1888
|
|
|
1875
1889
|
declare class DecFloat16Type extends AbstractType {
|
|
@@ -2734,8 +2748,10 @@ declare namespace ExpressionsCDS {
|
|
|
2734
2748
|
CDSCondition,
|
|
2735
2749
|
CDSDefineAbstract,
|
|
2736
2750
|
CDSDefineCustom,
|
|
2751
|
+
CDSDefineExternalEntity,
|
|
2737
2752
|
CDSDefineHierarchy,
|
|
2738
2753
|
CDSDefineProjection,
|
|
2754
|
+
CDSDefineTableEntity,
|
|
2739
2755
|
CDSDefineTableFunction,
|
|
2740
2756
|
CDSDefineView,
|
|
2741
2757
|
CDSElement,
|
|
@@ -3471,13 +3487,13 @@ declare interface IDDICReferences {
|
|
|
3471
3487
|
}[];
|
|
3472
3488
|
}
|
|
3473
3489
|
|
|
3474
|
-
declare interface IDDLParserResult {
|
|
3490
|
+
export declare interface IDDLParserResult {
|
|
3475
3491
|
name: string;
|
|
3476
3492
|
kind: DDLKind;
|
|
3477
3493
|
fields: IDDLParserResultField[];
|
|
3478
3494
|
}
|
|
3479
3495
|
|
|
3480
|
-
declare interface IDDLParserResultField {
|
|
3496
|
+
export declare interface IDDLParserResultField {
|
|
3481
3497
|
key: boolean;
|
|
3482
3498
|
name: string;
|
|
3483
3499
|
type: string;
|
|
@@ -81,7 +81,7 @@ class Regex {
|
|
|
81
81
|
return result;
|
|
82
82
|
}
|
|
83
83
|
railroad() {
|
|
84
|
-
return "Railroad.Terminal(\"" + this.regexp.source.replace(/\\/g, "\\\\") + "\")";
|
|
84
|
+
return "Railroad.Terminal(\"" + this.regexp.source.replace(/\\/g, "\\\\").replace(/"/g, "\\\"") + "\")";
|
|
85
85
|
}
|
|
86
86
|
toStr() {
|
|
87
87
|
return this.regexp.toString();
|
|
@@ -8,10 +8,10 @@ const _derived_types_1 = require("./_derived_types");
|
|
|
8
8
|
class TypeStructure extends combi_1.Expression {
|
|
9
9
|
getRunnable() {
|
|
10
10
|
const entity = (0, combi_1.alt)(_1.TypeName, _1.EntityAssociation);
|
|
11
|
-
const derivedTypes = (0, _derived_types_1.derivedTypesAlt)((0, combi_1.ver)(version_1.Release.v779, (0, combi_1.seq)("FUNCTION REQUEST", entity)), (0, combi_1.ver)(version_1.Release.v779, (0, combi_1.seq)("ACTION REQUEST", entity)), (0, combi_1.seq)("ACTION IMPORT", _1.Source), (0, combi_1.ver)(version_1.Release.v781, (0, combi_1.seq)("GLOBAL AUTHORIZATION REQUEST", entity)), (0, combi_1.ver)(version_1.Release.v781, (0, combi_1.seq)("GLOBAL AUTHORIZATION RESULT", entity)), (0, combi_1.ver)(version_1.Release.v781, (0, combi_1.seq)("GLOBAL FEATURES REQUEST", entity)), (0, combi_1.ver)(version_1.Release.v781, (0, combi_1.seq)("GLOBAL FEATURES RESULT", entity)), (0, combi_1.ver)(version_1.Release.v780, (0, combi_1.seq)("AUTHORIZATION REQUEST", entity)), (0, combi_1.ver)(version_1.Release.v776, (0, combi_1.seq)("FEATURES REQUEST", entity)), (0, combi_1.seq)("PERMISSIONS REQUEST", _1.NamespaceSimpleName), (0, combi_1.ver)(version_1.Release.v780, (0, combi_1.seq)("PERMISSIONS RESULT", entity)), (0, combi_1.seq)("READ LINK", _1.EntityAssociation), (0, combi_1.seq)("HIERARCHY", _1.NamespaceSimpleName), (0, combi_1.seq)("EVENT", _1.EventName));
|
|
12
|
-
const structure = (0, combi_1.ver)(version_1.Release.v774, (0, combi_1.seq)("STRUCTURE FOR", derivedTypes));
|
|
13
|
-
const response = (0, combi_1.ver)(version_1.Release.v776, (0, combi_1.seq)("RESPONSE FOR", (0, combi_1.altPrio)((0, combi_1.seq)("FAILED EARLY", _1.NamespaceSimpleName), (0, combi_1.seq)("FAILED LATE", _1.NamespaceSimpleName), (0, combi_1.seq)("FAILED", _1.NamespaceSimpleName), (0, combi_1.seq)("MAPPED EARLY", _1.NamespaceSimpleName), (0, combi_1.seq)("MAPPED LATE", _1.NamespaceSimpleName), (0, combi_1.seq)("MAPPED", _1.NamespaceSimpleName), (0, combi_1.seq)("REPORTED EARLY", _1.NamespaceSimpleName), (0, combi_1.seq)("REPORTED LATE", _1.NamespaceSimpleName), (0, combi_1.seq)("REPORTED", _1.NamespaceSimpleName))));
|
|
14
|
-
const request = (0, combi_1.ver)(version_1.Release.v778, (0, combi_1.seq)("REQUEST FOR", (0, combi_1.alt)("CHANGE", "DELETE"), _1.NamespaceSimpleName));
|
|
11
|
+
const derivedTypes = (0, _derived_types_1.derivedTypesAlt)((0, combi_1.ver)(version_1.Release.v779, (0, combi_1.seq)("FUNCTION REQUEST", entity), { also: combi_1.AlsoIn.OpenABAP }), (0, combi_1.ver)(version_1.Release.v779, (0, combi_1.seq)("ACTION REQUEST", entity), { also: combi_1.AlsoIn.OpenABAP }), (0, combi_1.seq)("ACTION IMPORT", _1.Source), (0, combi_1.ver)(version_1.Release.v781, (0, combi_1.seq)("GLOBAL AUTHORIZATION REQUEST", entity), { also: combi_1.AlsoIn.OpenABAP }), (0, combi_1.ver)(version_1.Release.v781, (0, combi_1.seq)("GLOBAL AUTHORIZATION RESULT", entity), { also: combi_1.AlsoIn.OpenABAP }), (0, combi_1.ver)(version_1.Release.v781, (0, combi_1.seq)("GLOBAL FEATURES REQUEST", entity), { also: combi_1.AlsoIn.OpenABAP }), (0, combi_1.ver)(version_1.Release.v781, (0, combi_1.seq)("GLOBAL FEATURES RESULT", entity), { also: combi_1.AlsoIn.OpenABAP }), (0, combi_1.ver)(version_1.Release.v780, (0, combi_1.seq)("AUTHORIZATION REQUEST", entity), { also: combi_1.AlsoIn.OpenABAP }), (0, combi_1.ver)(version_1.Release.v776, (0, combi_1.seq)("FEATURES REQUEST", entity), { also: combi_1.AlsoIn.OpenABAP }), (0, combi_1.seq)("PERMISSIONS REQUEST", _1.NamespaceSimpleName), (0, combi_1.ver)(version_1.Release.v780, (0, combi_1.seq)("PERMISSIONS RESULT", entity), { also: combi_1.AlsoIn.OpenABAP }), (0, combi_1.seq)("READ LINK", _1.EntityAssociation), (0, combi_1.seq)("HIERARCHY", _1.NamespaceSimpleName), (0, combi_1.seq)("EVENT", _1.EventName));
|
|
12
|
+
const structure = (0, combi_1.ver)(version_1.Release.v774, (0, combi_1.seq)("STRUCTURE FOR", derivedTypes), { also: combi_1.AlsoIn.OpenABAP });
|
|
13
|
+
const response = (0, combi_1.ver)(version_1.Release.v776, (0, combi_1.seq)("RESPONSE FOR", (0, combi_1.altPrio)((0, combi_1.seq)("FAILED EARLY", _1.NamespaceSimpleName), (0, combi_1.seq)("FAILED LATE", _1.NamespaceSimpleName), (0, combi_1.seq)("FAILED", _1.NamespaceSimpleName), (0, combi_1.seq)("MAPPED EARLY", _1.NamespaceSimpleName), (0, combi_1.seq)("MAPPED LATE", _1.NamespaceSimpleName), (0, combi_1.seq)("MAPPED", _1.NamespaceSimpleName), (0, combi_1.seq)("REPORTED EARLY", _1.NamespaceSimpleName), (0, combi_1.seq)("REPORTED LATE", _1.NamespaceSimpleName), (0, combi_1.seq)("REPORTED", _1.NamespaceSimpleName))), { also: combi_1.AlsoIn.OpenABAP });
|
|
14
|
+
const request = (0, combi_1.ver)(version_1.Release.v778, (0, combi_1.seq)("REQUEST FOR", (0, combi_1.alt)("CHANGE", "DELETE"), _1.NamespaceSimpleName), { also: combi_1.AlsoIn.OpenABAP });
|
|
15
15
|
return (0, combi_1.seq)("TYPE", (0, combi_1.altPrio)(structure, response, request), (0, combi_1.optPrio)("VALUE IS INITIAL"));
|
|
16
16
|
}
|
|
17
17
|
}
|
|
@@ -70,6 +70,12 @@ class CDSParser {
|
|
|
70
70
|
if (res === undefined || !(res[0] instanceof nodes_1.ExpressionNode)) {
|
|
71
71
|
res = combi_1.Combi.run(new Expressions.CDSDefineHierarchy(), tokens, version_1.defaultRelease);
|
|
72
72
|
}
|
|
73
|
+
if (res === undefined || !(res[0] instanceof nodes_1.ExpressionNode)) {
|
|
74
|
+
res = combi_1.Combi.run(new Expressions.CDSDefineExternalEntity(), tokens, version_1.defaultRelease);
|
|
75
|
+
}
|
|
76
|
+
if (res === undefined || !(res[0] instanceof nodes_1.ExpressionNode)) {
|
|
77
|
+
res = combi_1.Combi.run(new Expressions.CDSDefineTableEntity(), tokens, version_1.defaultRelease);
|
|
78
|
+
}
|
|
73
79
|
if (res === undefined || !(res[0] instanceof nodes_1.ExpressionNode)) {
|
|
74
80
|
return undefined;
|
|
75
81
|
}
|
|
@@ -5,12 +5,10 @@ const _1 = require(".");
|
|
|
5
5
|
const combi_1 = require("../../abap/2_statements/combi");
|
|
6
6
|
class CDSAggregate extends combi_1.Expression {
|
|
7
7
|
getRunnable() {
|
|
8
|
-
// CDSPrefixedName handles dotted paths with path filters e.g. a._Assoc[filter].Field
|
|
9
|
-
// CDSArithmetics handles expressions like sum(A + B), max(A * 100)
|
|
10
|
-
// fieldAsType handles avg(field AS type) / sum(field AS type) — SAP inline type coercion
|
|
11
8
|
const fieldAsType = (0, combi_1.seq)(_1.CDSPrefixedName, "AS", _1.CDSType);
|
|
12
|
-
const
|
|
13
|
-
|
|
9
|
+
const funcAsType = (0, combi_1.seq)(_1.CDSFunction, "AS", _1.CDSType);
|
|
10
|
+
const value = (0, combi_1.altPrio)(_1.CDSArithmetics, _1.CDSCast, _1.CDSCase, funcAsType, _1.CDSFunction, fieldAsType, _1.CDSPrefixedName, _1.CDSString, "*");
|
|
11
|
+
return (0, combi_1.seq)((0, combi_1.altPrio)("MAX", "MIN", "SUM", "AVG", "COUNT"), "(", (0, combi_1.optPrio)((0, combi_1.altPrio)("DISTINCT", "ALL")), value, (0, combi_1.opt)((0, combi_1.seq)("AS", _1.CDSType)), ")");
|
|
14
12
|
}
|
|
15
13
|
}
|
|
16
14
|
exports.CDSAggregate = CDSAggregate;
|
|
@@ -8,7 +8,7 @@ class CDSDefineAbstract extends combi_1.Expression {
|
|
|
8
8
|
getRunnable() {
|
|
9
9
|
const field = (0, combi_1.seq)((0, combi_1.star)(_1.CDSAnnotation), (0, combi_1.optPrio)((0, combi_1.str)("KEY")), cds_name_1.CDSName, ":", _1.CDSType, ";");
|
|
10
10
|
const compsiOrAssoci = (0, combi_1.seq)((0, combi_1.star)(_1.CDSAnnotation), cds_name_1.CDSName, ":", (0, combi_1.alt)(_1.CDSComposition, _1.CDSAssociation), ";");
|
|
11
|
-
return (0, combi_1.seq)((0, combi_1.star)(_1.CDSAnnotation), "DEFINE", (0, combi_1.opt)("ROOT"), "ABSTRACT", "ENTITY", cds_name_1.CDSName, (0, combi_1.str)("{"), (0, combi_1.plus)((0, combi_1.alt)(field, compsiOrAssoci)), (0, combi_1.str)("}"), (0, combi_1.opt)(";"));
|
|
11
|
+
return (0, combi_1.seq)((0, combi_1.star)(_1.CDSAnnotation), "DEFINE", (0, combi_1.opt)("ROOT"), "ABSTRACT", "ENTITY", cds_name_1.CDSName, (0, combi_1.opt)(_1.CDSWithParameters), (0, combi_1.str)("{"), (0, combi_1.plus)((0, combi_1.alt)(field, compsiOrAssoci)), (0, combi_1.str)("}"), (0, combi_1.opt)(";"));
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
14
|
exports.CDSDefineAbstract = CDSDefineAbstract;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CDSDefineExternalEntity = void 0;
|
|
4
|
+
const _1 = require(".");
|
|
5
|
+
const combi_1 = require("../../abap/2_statements/combi");
|
|
6
|
+
class CDSDefineExternalEntity extends combi_1.Expression {
|
|
7
|
+
getRunnable() {
|
|
8
|
+
const extNameValue = (0, combi_1.alt)(_1.CDSName, (0, combi_1.regex)(/^"[^"]*"$/));
|
|
9
|
+
const externalName = (0, combi_1.seq)("EXTERNAL", "NAME", extNameValue);
|
|
10
|
+
const nullability = (0, combi_1.optPrio)((0, combi_1.alt)("NOT NULL", "NULL"));
|
|
11
|
+
const field = (0, combi_1.seq)((0, combi_1.star)(_1.CDSAnnotation), (0, combi_1.optPrio)((0, combi_1.str)("KEY")), _1.CDSName, ":", _1.CDSType, nullability, (0, combi_1.optPrio)(externalName), ";");
|
|
12
|
+
const assocOrComp = (0, combi_1.seq)((0, combi_1.star)(_1.CDSAnnotation), _1.CDSName, ":", (0, combi_1.alt)(_1.CDSComposition, _1.CDSAssociation), ";");
|
|
13
|
+
const body = (0, combi_1.plus)((0, combi_1.alt)(field, assocOrComp));
|
|
14
|
+
const externalEntity = (0, combi_1.seq)((0, combi_1.opt)("WRITABLE"), "EXTERNAL", "ENTITY", _1.CDSName, (0, combi_1.opt)(externalName), (0, combi_1.opt)(_1.CDSWithParameters));
|
|
15
|
+
const staticEntity = (0, combi_1.seq)("STATIC", "ENTITY", _1.CDSName, (0, combi_1.opt)(externalName));
|
|
16
|
+
return (0, combi_1.seq)((0, combi_1.star)(_1.CDSAnnotation), "DEFINE", (0, combi_1.alt)(externalEntity, staticEntity), (0, combi_1.str)("{"), body, (0, combi_1.str)("}"), (0, combi_1.opt)((0, combi_1.seq)("WITH", "FEDERATED", "DATA", (0, combi_1.optPrio)((0, combi_1.alt)((0, combi_1.seq)("PROVIDED", "AT", "RUNTIME"), (0, combi_1.seq)("PROVIDED", "BY", _1.CDSName))))), (0, combi_1.opt)(";"));
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.CDSDefineExternalEntity = CDSDefineExternalEntity;
|
|
20
|
+
//# sourceMappingURL=cds_define_external_entity.js.map
|
|
@@ -10,7 +10,13 @@ class CDSDefineHierarchy extends combi_1.Expression {
|
|
|
10
10
|
const siblingsOrderField = (0, combi_1.seq)(_1.CDSPrefixedName, (0, combi_1.optPrio)(sortDirection));
|
|
11
11
|
const siblingsOrder = (0, combi_1.seq)("SIBLINGS", "ORDER", "BY", siblingsOrderField, (0, combi_1.star)((0, combi_1.seq)(",", siblingsOrderField)));
|
|
12
12
|
const directory = (0, combi_1.seq)("DIRECTORY", _1.CDSName, "FILTER", "BY", _1.CDSCondition);
|
|
13
|
-
|
|
13
|
+
// DATE PERIOD: period from <field> to <field> [valid from :p to :p]
|
|
14
|
+
const datePeriod = (0, combi_1.seq)("PERIOD", "FROM", _1.CDSName, "TO", _1.CDSName, (0, combi_1.opt)((0, combi_1.seq)("VALID", "FROM", _1.CDSPrefixedName, "TO", _1.CDSPrefixedName)));
|
|
15
|
+
// DEPTH accepts an integer literal or a parameter reference (:param)
|
|
16
|
+
const depthValue = (0, combi_1.altPrio)(_1.CDSInteger, _1.CDSPrefixedName);
|
|
17
|
+
// LOAD mode: BULK, INCREMENTAL, or a parameter reference ($parameters.p_load)
|
|
18
|
+
const loadMode = (0, combi_1.altPrio)("BULK", "INCREMENTAL", _1.CDSPrefixedName);
|
|
19
|
+
const hierarchyBody = (0, combi_1.seq)("SOURCE", _1.CDSName, (0, combi_1.opt)(_1.CDSParametersSelect), "CHILD", "TO", "PARENT", "ASSOCIATION", _1.CDSName, (0, combi_1.opt)(directory), (0, combi_1.opt)(datePeriod), (0, combi_1.opt)((0, combi_1.seq)("START", "WHERE", _1.CDSCondition)), (0, combi_1.opt)(siblingsOrder), (0, combi_1.opt)((0, combi_1.seq)("LOAD", loadMode)), (0, combi_1.opt)((0, combi_1.seq)("NODETYPE", _1.CDSName)), (0, combi_1.opt)((0, combi_1.seq)("DEPTH", depthValue)), (0, combi_1.opt)((0, combi_1.seq)("MULTIPLE", "PARENTS", (0, combi_1.altPrio)("NOT ALLOWED", "ALLOWED", (0, combi_1.seq)("LEAVES", (0, combi_1.optPrio)("ONLY"))))), (0, combi_1.opt)((0, combi_1.seq)("ORPHANS", (0, combi_1.altPrio)("IGNORE", "ROOT", "ERROR"))), (0, combi_1.opt)((0, combi_1.seq)("CYCLES", (0, combi_1.altPrio)("BREAKUP", "ERROR"))), (0, combi_1.opt)((0, combi_1.seq)("GENERATE", "SPANTREE")), (0, combi_1.opt)((0, combi_1.seq)("CACHE", (0, combi_1.altPrio)("ON", "OFF", "FORCE"))));
|
|
14
20
|
return (0, combi_1.seq)((0, combi_1.star)(_1.CDSAnnotation), "DEFINE", "HIERARCHY", _1.CDSName, (0, combi_1.opt)(_1.CDSWithParameters), "AS", "PARENT", "CHILD", "HIERARCHY", "(", hierarchyBody, ")", "{", (0, combi_1.seq)(field, (0, combi_1.star)((0, combi_1.seq)(",", field))), "}", (0, combi_1.opt)(";"));
|
|
15
21
|
}
|
|
16
22
|
}
|
|
@@ -6,7 +6,9 @@ const __1 = require("../..");
|
|
|
6
6
|
const combi_1 = require("../../abap/2_statements/combi");
|
|
7
7
|
class CDSDefineProjection extends combi_1.Expression {
|
|
8
8
|
getRunnable() {
|
|
9
|
-
|
|
9
|
+
// redefine association _Assoc redirected to [composition child | parent] Entity
|
|
10
|
+
const redefineAssoc = (0, combi_1.seq)("REDEFINE", "ASSOCIATION", _1.CDSName, "REDIRECTED", "TO", (0, combi_1.optPrio)((0, combi_1.altPrio)((0, combi_1.seq)("COMPOSITION", "CHILD"), "PARENT")), _1.CDSName);
|
|
11
|
+
return (0, combi_1.seq)((0, combi_1.star)(_1.CDSAnnotation), "DEFINE", (0, combi_1.opt)("ROOT"), (0, combi_1.opt)("TRANSIENT"), "VIEW", (0, combi_1.ver)(__1.Release.v755, (0, combi_1.opt)("ENTITY")), _1.CDSName, (0, combi_1.opt)(_1.CDSProviderContract), (0, combi_1.opt)(_1.CDSWithParameters), "AS PROJECTION ON", _1.CDSName, (0, combi_1.opt)(_1.CDSParametersSelect), (0, combi_1.opt)(_1.CDSAs), (0, combi_1.star)((0, combi_1.altPrio)(_1.CDSAssociation, redefineAssoc)), (0, combi_1.str)("{"), (0, combi_1.seq)(_1.CDSElement, (0, combi_1.star)((0, combi_1.seq)(",", _1.CDSElement)), (0, combi_1.opt)(",")), (0, combi_1.str)("}"), (0, combi_1.opt)(_1.CDSWhere), (0, combi_1.opt)(";"));
|
|
10
12
|
}
|
|
11
13
|
}
|
|
12
14
|
exports.CDSDefineProjection = CDSDefineProjection;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CDSDefineTableEntity = void 0;
|
|
4
|
+
const _1 = require(".");
|
|
5
|
+
const combi_1 = require("../../abap/2_statements/combi");
|
|
6
|
+
class CDSDefineTableEntity extends combi_1.Expression {
|
|
7
|
+
getRunnable() {
|
|
8
|
+
const nullability = (0, combi_1.optPrio)((0, combi_1.alt)("NOT NULL", "NULL"));
|
|
9
|
+
const field = (0, combi_1.seq)((0, combi_1.star)(_1.CDSAnnotation), (0, combi_1.optPrio)((0, combi_1.str)("KEY")), _1.CDSName, ":", _1.CDSType, nullability, ";");
|
|
10
|
+
const assocOrComp = (0, combi_1.seq)((0, combi_1.star)(_1.CDSAnnotation), _1.CDSName, ":", (0, combi_1.alt)(_1.CDSComposition, _1.CDSAssociation), ";");
|
|
11
|
+
const inlineBody = (0, combi_1.plus)((0, combi_1.alt)(field, assocOrComp));
|
|
12
|
+
const elementList = (0, combi_1.seq)(_1.CDSElement, (0, combi_1.star)((0, combi_1.seq)(",", _1.CDSElement)), (0, combi_1.opt)(","));
|
|
13
|
+
const elements = (0, combi_1.seq)((0, combi_1.str)("{"), (0, combi_1.altPrio)("*", elementList), (0, combi_1.str)("}"));
|
|
14
|
+
const selectBody = (0, combi_1.seq)("AS", "SELECT", "FROM", _1.CDSSource, (0, combi_1.star)(_1.CDSJoin), (0, combi_1.star)((0, combi_1.altPrio)(_1.CDSComposition, _1.CDSAssociation)), (0, combi_1.opt)(elements), (0, combi_1.optPrio)(_1.CDSWhere));
|
|
15
|
+
return (0, combi_1.seq)((0, combi_1.star)(_1.CDSAnnotation), "DEFINE", (0, combi_1.opt)("ROOT"), "TABLE", "ENTITY", _1.CDSName, (0, combi_1.opt)(_1.CDSWithParameters), (0, combi_1.altPrio)((0, combi_1.seq)((0, combi_1.str)("{"), inlineBody, (0, combi_1.str)("}")), selectBody), (0, combi_1.opt)(";"));
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.CDSDefineTableEntity = CDSDefineTableEntity;
|
|
19
|
+
//# sourceMappingURL=cds_define_table_entity.js.map
|
|
@@ -10,7 +10,8 @@ const cds_with_parameters_1 = require("./cds_with_parameters");
|
|
|
10
10
|
class CDSDefineView extends combi_1.Expression {
|
|
11
11
|
getRunnable() {
|
|
12
12
|
const columnAlias = (0, combi_1.seq)("(", cds_name_1.CDSName, (0, combi_1.star)((0, combi_1.seq)(",", cds_name_1.CDSName)), ")");
|
|
13
|
-
return (0, combi_1.seq)((0, combi_1.star)(_1.CDSAnnotation), (0, combi_1.opt)("DEFINE"), (0, combi_1.opt)("ROOT"), "VIEW", (0, combi_1.ver)(__1.Release.v755, (0, combi_1.opt)("ENTITY")), cds_name_1.CDSName, (0, combi_1.opt)(columnAlias), (0, combi_1.opt)(cds_with_parameters_1.CDSWithParameters), "AS", cds_select_1.CDSSelect, (0, combi_1.opt)("
|
|
13
|
+
return (0, combi_1.seq)((0, combi_1.star)(_1.CDSAnnotation), (0, combi_1.opt)("DEFINE"), (0, combi_1.opt)("ROOT"), (0, combi_1.opt)("WRITABLE"), "VIEW", (0, combi_1.ver)(__1.Release.v755, (0, combi_1.opt)("ENTITY")), cds_name_1.CDSName, (0, combi_1.opt)(columnAlias), (0, combi_1.opt)(cds_with_parameters_1.CDSWithParameters), "AS", cds_select_1.CDSSelect, (0, combi_1.opt)((0, combi_1.seq)("WITH", "HIERARCHY", cds_name_1.CDSName)), // post-select WITH HIERARCHY clause
|
|
14
|
+
(0, combi_1.opt)(";"));
|
|
14
15
|
}
|
|
15
16
|
}
|
|
16
17
|
exports.CDSDefineView = CDSDefineView;
|
|
@@ -9,14 +9,11 @@ class CDSElement extends combi_1.Expression {
|
|
|
9
9
|
getRunnable() {
|
|
10
10
|
const redirected = (0, combi_1.seq)(": REDIRECTED TO", (0, combi_1.optPrio)((0, combi_1.altPrio)("PARENT", "COMPOSITION CHILD")), _1.CDSName);
|
|
11
11
|
const colonThing = (0, combi_1.seq)(":", (0, combi_1.altPrio)(_1.CDSType, _1.CDSName, "LOCALIZED"));
|
|
12
|
-
// $extension.* — extension field wildcard
|
|
13
12
|
const extensionWildcard = (0, combi_1.seq)("$extension", ".", "*");
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
// - This gives exactly 1 state in all cases (no exponential blowup from opt()).
|
|
19
|
-
const elementBody = (0, combi_1.altPrio)((0, combi_1.seq)((0, combi_1.altPrio)("KEY", "VIRTUAL"), body), body);
|
|
13
|
+
const includeElement = (0, combi_1.seq)("INCLUDE", _1.CDSPrefixedName);
|
|
14
|
+
const typedVirtual = (0, combi_1.seq)("VIRTUAL", _1.CDSName, ":", _1.CDSType);
|
|
15
|
+
const body = (0, combi_1.altPrio)(extensionWildcard, includeElement, _1.CDSArithmetics, _1.CDSAggregate, _1.CDSString, _1.CDSArithParen, _1.CDSFunction, cds_cast_1.CDSCast, _1.CDSCase, (0, combi_1.seq)("(", _1.CDSCase, ")"), (0, combi_1.seq)(_1.CDSPrefixedName, (0, combi_1.optPrio)(cds_as_1.CDSAs), (0, combi_1.optPrio)((0, combi_1.altPrio)(redirected, colonThing))), _1.CDSInteger);
|
|
16
|
+
const elementBody = (0, combi_1.altPrio)(typedVirtual, (0, combi_1.seq)((0, combi_1.altPrio)("KEY", "VIRTUAL"), body), body);
|
|
20
17
|
return (0, combi_1.seq)((0, combi_1.starPrio)(_1.CDSAnnotation), elementBody, (0, combi_1.optPrio)(cds_as_1.CDSAs));
|
|
21
18
|
}
|
|
22
19
|
}
|
|
@@ -3,12 +3,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.CDSExtendView = void 0;
|
|
4
4
|
const _1 = require(".");
|
|
5
5
|
const combi_1 = require("../../abap/2_statements/combi");
|
|
6
|
-
const cds_name_1 = require("./cds_name");
|
|
7
6
|
class CDSExtendView extends combi_1.Expression {
|
|
8
7
|
getRunnable() {
|
|
9
|
-
const namedot = (0, combi_1.seq)(
|
|
8
|
+
const namedot = (0, combi_1.seq)(_1.CDSName, (0, combi_1.optPrio)((0, combi_1.seq)(".", _1.CDSName)), (0, combi_1.optPrio)(_1.CDSAs));
|
|
10
9
|
const valueNested = (0, combi_1.seq)("{", namedot, (0, combi_1.star)((0, combi_1.seq)(",", namedot)), "}");
|
|
11
|
-
|
|
10
|
+
const redefineAssoc = (0, combi_1.seq)("REDEFINE", "ASSOCIATION", _1.CDSPrefixedName, (0, combi_1.optPrio)((0, combi_1.seq)("[", _1.CDSCondition, "]")), (0, combi_1.opt)(_1.CDSAs), "REDIRECTED", "TO", (0, combi_1.optPrio)((0, combi_1.altPrio)((0, combi_1.seq)("COMPOSITION", "CHILD"), "PARENT")), _1.CDSName);
|
|
11
|
+
const extendView = (0, combi_1.seq)((0, combi_1.star)(_1.CDSAnnotation), (0, combi_1.str)("EXTEND VIEW"), (0, combi_1.opt)((0, combi_1.str)("ENTITY")), _1.CDSName, (0, combi_1.str)("WITH"), (0, combi_1.opt)(_1.CDSName), (0, combi_1.star)(redefineAssoc), valueNested, (0, combi_1.opt)(";"));
|
|
12
|
+
const field = (0, combi_1.seq)((0, combi_1.star)(_1.CDSAnnotation), (0, combi_1.optPrio)((0, combi_1.str)("KEY")), _1.CDSName, ":", _1.CDSType, ";");
|
|
13
|
+
const assocOrComp = (0, combi_1.seq)((0, combi_1.star)(_1.CDSAnnotation), _1.CDSName, ":", (0, combi_1.alt)(_1.CDSComposition, _1.CDSAssociation), ";");
|
|
14
|
+
const entityBody = (0, combi_1.seq)("{", (0, combi_1.plus)((0, combi_1.alt)(field, assocOrComp)), "}");
|
|
15
|
+
const extendAbstractOrCustom = (0, combi_1.seq)((0, combi_1.star)(_1.CDSAnnotation), "EXTEND", (0, combi_1.alt)("ABSTRACT", "CUSTOM"), "ENTITY", _1.CDSName, (0, combi_1.opt)(_1.CDSWithParameters), "WITH", entityBody, (0, combi_1.opt)(";"));
|
|
16
|
+
return (0, combi_1.alt)(extendAbstractOrCustom, extendView);
|
|
12
17
|
}
|
|
13
18
|
}
|
|
14
19
|
exports.CDSExtendView = CDSExtendView;
|
|
@@ -58,12 +58,13 @@ class CDSFunction extends combi_1.Expression {
|
|
|
58
58
|
const occurrencesRegexpr = (0, combi_1.seq)("OCCURRENCES_REGEXPR", "(", conversionInputs, ")");
|
|
59
59
|
const substrRegexpr = (0, combi_1.seq)("SUBSTR_REGEXPR", "(", conversionInputs, ")");
|
|
60
60
|
const locateRegexpr = (0, combi_1.seq)("LOCATE_REGEXPR", "(", conversionInputs, ")");
|
|
61
|
-
// Generic fallback: user-defined/extension functions like GET_NUMERIC_VALUE(arg).
|
|
62
|
-
// Use a regex that excludes CDS keywords that would otherwise be matched by CDSName.
|
|
63
|
-
// Must contain at least one underscore to distinguish from keywords (e.g. GET_NUMERIC_VALUE).
|
|
64
61
|
const extFuncName = (0, combi_1.regex)(/^[A-Z][A-Z0-9]*(?:_[A-Z0-9]+)+$/i);
|
|
65
62
|
const genericArgs = (0, combi_1.seq)(_1.CDSFunctionInput, (0, combi_1.starPrio)((0, combi_1.seq)(",", _1.CDSFunctionInput)));
|
|
66
|
-
const
|
|
63
|
+
const namedArgValue = (0, combi_1.altPrio)((0, combi_1.seq)("INTERVAL", _1.CDSFunctionInput, _1.CDSName), _1.CDSFunctionInput, _1.CDSName);
|
|
64
|
+
const namedArgArrow = (0, combi_1.seq)(_1.CDSName, "=", ">", namedArgValue);
|
|
65
|
+
const namedArgColon = (0, combi_1.seq)(_1.CDSName, ":", namedArgValue);
|
|
66
|
+
const namedArgs = (0, combi_1.seq)((0, combi_1.altPrio)(namedArgArrow, namedArgColon), (0, combi_1.starPrio)((0, combi_1.seq)(",", (0, combi_1.altPrio)(namedArgArrow, namedArgColon))));
|
|
67
|
+
const genericFunc = (0, combi_1.seq)(extFuncName, "(", (0, combi_1.optPrio)((0, combi_1.altPrio)(namedArgs, genericArgs)), ")");
|
|
67
68
|
return (0, combi_1.altPrio)(substring, coalesce, tstmp_to_dats, concat, tstmp_to_tims, upper, lower, abs, ceil, floor, round, div, division, concat_with_space, dats_is_valid, tims_is_valid, dats_days_between, tstmp_add_seconds, tstmp_seconds_between, tstmp_current_utctimestamp, tstmp_is_valid, utcl_current, abap_system_timezone, abap_user_timezone, bintohex, hextobin, dats_add_days, dats_add_months, tstmp_to_dst, dats_tims_to_tstmp, mod, left, right, lpad, rpad, instr, length, ltrim, rtrim, replace, unitConversion, currencyConversion, decimalShift, fltp_to_dec, ratioOf, replaceRegexpr, matchesRegexpr, occurrencesRegexpr, substrRegexpr, locateRegexpr, curr_to_decfloat_amount, genericFunc);
|
|
68
69
|
}
|
|
69
70
|
}
|
|
@@ -10,31 +10,18 @@ const cds_integer_1 = require("./cds_integer");
|
|
|
10
10
|
const cds_string_1 = require("./cds_string");
|
|
11
11
|
class CDSPrefixedName extends combi_1.Expression {
|
|
12
12
|
getRunnable() {
|
|
13
|
-
// Path filter variants:
|
|
14
|
-
// [inner], [left outer], [cross] — join-type redirect
|
|
15
|
-
// [1:left outer], [1:inner] — cardinality + join-type
|
|
16
|
-
// [1: condition] — cardinality + filter condition
|
|
17
|
-
// [condition] — filter condition only
|
|
18
13
|
const joinType = (0, combi_1.altPrio)("LEFT OUTER", "INNER", "CROSS");
|
|
19
14
|
const joinRedirect = (0, combi_1.seq)("[", joinType, "]");
|
|
20
|
-
// Cardinality spec: integer or * (e.g. [*:inner], [1:inner])
|
|
21
15
|
const cardSpec = (0, combi_1.altPrio)(cds_integer_1.CDSInteger, "*");
|
|
22
16
|
const cardinalityJoin = (0, combi_1.seq)("[", cardSpec, ":", joinType, "]");
|
|
23
|
-
// [1: left outer where condition] — cardinality + join-type + WHERE filter
|
|
24
17
|
const cardinalityJoinWhere = (0, combi_1.seq)("[", cardSpec, ":", joinType, "WHERE", cds_condition_1.CDSCondition, "]");
|
|
25
|
-
// [left outer where condition] — join-type + WHERE filter (no cardinality prefix)
|
|
26
18
|
const joinWhere = (0, combi_1.seq)("[", joinType, "WHERE", cds_condition_1.CDSCondition, "]");
|
|
27
|
-
|
|
28
|
-
const
|
|
29
|
-
const textCardFilter = (0, combi_1.seq)("[", textCard, ":", cds_condition_1.CDSCondition, "]");
|
|
30
|
-
// Numeric range cardinality: [0..1: cond], [1..1: cond], [0..*: cond], [n..m: cond]
|
|
19
|
+
const textCard = (0, combi_1.altPrio)("TO EXACT ONE", "TO ONE", "TO MANY");
|
|
20
|
+
const textCardFilter = (0, combi_1.seq)("[", textCard, (0, combi_1.optPrio)((0, combi_1.seq)(":", (0, combi_1.altPrio)((0, combi_1.seq)(joinType, "WHERE", cds_condition_1.CDSCondition), joinType, cds_condition_1.CDSCondition))), "]");
|
|
31
21
|
const cardNum = (0, combi_1.altPrio)(cds_integer_1.CDSInteger, "*");
|
|
32
22
|
const rangeCard = (0, combi_1.seq)(cds_integer_1.CDSInteger, ".", ".", cardNum);
|
|
33
23
|
const rangeCardFilter = (0, combi_1.seq)("[", rangeCard, ":", cds_condition_1.CDSCondition, "]");
|
|
34
24
|
const pathFilter = (0, combi_1.altPrio)(cardinalityJoinWhere, joinWhere, cardinalityJoin, joinRedirect, textCardFilter, rangeCardFilter, (0, combi_1.seq)("[", cardSpec, ":", cds_condition_1.CDSCondition, "]"), (0, combi_1.seq)("[", cds_condition_1.CDSCondition, "]"));
|
|
35
|
-
// Each dotted segment may have its own path filter: A[cond].B[cond].C
|
|
36
|
-
// The final segment may also be a string literal: #enum.'value'
|
|
37
|
-
// A segment may have a parameterized call: _Assoc( P_Key : value ) or _Assoc[filter]
|
|
38
25
|
const segment = (0, combi_1.seq)(".", (0, combi_1.altPrio)(cds_string_1.CDSString, cds_name_1.CDSName), (0, combi_1.optPrio)((0, combi_1.altPrio)(cds_parameters_select_1.CDSParametersSelect, cds_parameters_1.CDSParameters)), (0, combi_1.optPrio)(pathFilter));
|
|
39
26
|
return (0, combi_1.seq)(cds_name_1.CDSName, (0, combi_1.optPrio)((0, combi_1.altPrio)(cds_parameters_1.CDSParameters, cds_parameters_select_1.CDSParametersSelect)), (0, combi_1.optPrio)(pathFilter), (0, combi_1.star)(segment));
|
|
40
27
|
}
|
|
@@ -4,7 +4,7 @@ exports.CDSProviderContract = void 0;
|
|
|
4
4
|
const combi_1 = require("../../abap/2_statements/combi");
|
|
5
5
|
class CDSProviderContract extends combi_1.Expression {
|
|
6
6
|
getRunnable() {
|
|
7
|
-
return (0, combi_1.seq)("PROVIDER CONTRACT", (0, combi_1.alt)("TRANSACTIONAL_QUERY", "TRANSACTIONAL_INTERFACE", "ANALYTICAL_QUERY"));
|
|
7
|
+
return (0, combi_1.seq)("PROVIDER CONTRACT", (0, combi_1.alt)("TRANSACTIONAL_QUERY", "TRANSACTIONAL_INTERFACE", "ANALYTICAL_QUERY", "SQL_QUERY", "STRUCTURED_QUERY"));
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
10
|
exports.CDSProviderContract = CDSProviderContract;
|
|
@@ -9,10 +9,13 @@ class CDSSelect extends combi_1.Expression {
|
|
|
9
9
|
getRunnable() {
|
|
10
10
|
const fields = (0, combi_1.seq)((0, combi_1.star)((0, combi_1.seq)(_1.CDSElement, ",")), _1.CDSElement);
|
|
11
11
|
const distinct = (0, combi_1.str)("DISTINCT");
|
|
12
|
-
// elem (,elem)* [,] — handles separator commas and optional trailing comma
|
|
13
12
|
const elementList = (0, combi_1.seq)(_1.CDSElement, (0, combi_1.star)((0, combi_1.seq)(",", _1.CDSElement)), (0, combi_1.opt)(","));
|
|
14
13
|
const elements = (0, combi_1.seq)((0, combi_1.str)("{"), (0, combi_1.altPrio)("*", elementList), (0, combi_1.str)("}"));
|
|
15
|
-
|
|
14
|
+
const aspectBinding = (0, combi_1.seq)(_1.CDSPrefixedName, "=", ">", _1.CDSPrefixedName);
|
|
15
|
+
const bindAspect = (0, combi_1.seq)("BIND", "ASPECT", _1.CDSName, "(", aspectBinding, (0, combi_1.starPrio)((0, combi_1.seq)(",", aspectBinding)), ")");
|
|
16
|
+
const parenSelect = (0, combi_1.seq)("(", CDSSelect, ")");
|
|
17
|
+
const unionBranch = (0, combi_1.altPrio)(parenSelect, CDSSelect);
|
|
18
|
+
return (0, combi_1.seq)("SELECT", (0, combi_1.optPrio)(distinct), (0, combi_1.opt)((0, combi_1.altPrio)("*", fields)), "FROM", _1.CDSSource, (0, combi_1.star)(cds_join_1.CDSJoin), (0, combi_1.star)((0, combi_1.altPrio)(_1.CDSComposition, cds_association_1.CDSAssociation)), (0, combi_1.optPrio)(bindAspect), (0, combi_1.opt)(elements), (0, combi_1.optPrio)(_1.CDSWhere), (0, combi_1.optPrio)(_1.CDSGroupBy), (0, combi_1.optPrio)(_1.CDSHaving), (0, combi_1.optPrio)((0, combi_1.altPrio)((0, combi_1.seq)("UNION", (0, combi_1.optPrio)("ALL"), unionBranch), (0, combi_1.seq)("EXCEPT", unionBranch), (0, combi_1.seq)("INTERSECT", unionBranch))));
|
|
16
19
|
}
|
|
17
20
|
}
|
|
18
21
|
exports.CDSSelect = CDSSelect;
|
|
@@ -5,13 +5,14 @@ const _1 = require(".");
|
|
|
5
5
|
const combi_1 = require("../../abap/2_statements/combi");
|
|
6
6
|
class CDSSource extends combi_1.Expression {
|
|
7
7
|
getRunnable() {
|
|
8
|
-
// Static where filter in FROM: SomeTable [Field = 'Value']
|
|
9
8
|
const staticFilter = (0, combi_1.seq)("[", _1.CDSCondition, "]");
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
// Dotted path: T._Assoc — association path as FROM source
|
|
10
|
+
const dottedName = (0, combi_1.seq)(_1.CDSName, ".", _1.CDSName);
|
|
11
|
+
const namedSource = (0, combi_1.altPrio)(dottedName, _1.CDSName);
|
|
12
|
+
const singleSource = (0, combi_1.seq)(namedSource, (0, combi_1.optPrio)(_1.CDSParametersSelect), (0, combi_1.optPrio)(staticFilter), (0, combi_1.opt)((0, combi_1.altPrio)(_1.CDSAs, _1.CDSName)));
|
|
13
|
+
const funcSingleSource = (0, combi_1.seq)(_1.CDSFunction, (0, combi_1.opt)((0, combi_1.altPrio)(_1.CDSAs, _1.CDSName)));
|
|
13
14
|
const parenSource = (0, combi_1.seq)("(", (0, combi_1.altPrio)(CDSSource, singleSource), (0, combi_1.star)(_1.CDSJoin), ")");
|
|
14
|
-
return (0, combi_1.altPrio)(parenSource, singleSource);
|
|
15
|
+
return (0, combi_1.altPrio)(parenSource, funcSingleSource, singleSource);
|
|
15
16
|
}
|
|
16
17
|
}
|
|
17
18
|
exports.CDSSource = CDSSource;
|
|
@@ -4,15 +4,8 @@ exports.CDSString = void 0;
|
|
|
4
4
|
const combi_1 = require("../../abap/2_statements/combi");
|
|
5
5
|
class CDSString extends combi_1.Expression {
|
|
6
6
|
getRunnable() {
|
|
7
|
-
// Allow any character except unescaped single quote; escape sequences:
|
|
8
|
-
// '' — escaped single quote (doubling)
|
|
9
|
-
// \' — escaped single quote (backslash form)
|
|
10
|
-
// \\ — escaped backslash (e.g. '\\' in ltrim/rtrim calls)
|
|
11
|
-
// \x — other backslash sequences not followed by '
|
|
12
7
|
const reg = (0, combi_1.regex)(/^'(?:[^'\\]|''|\\'|\\\\|\\(?!'))*'$/);
|
|
13
|
-
|
|
14
|
-
// Lexed as tokens: abap, ., typename, 'value'
|
|
15
|
-
const abapTypeName = (0, combi_1.regex)(/^(?:int[1-9]|sstring|char|numc|dats|tims|fltp|decfloat\d+|dec|string|raw|xstring|clnt|lang|unit|cuky|curr|quan|d|t|p|n|c|x|f)$/i);
|
|
8
|
+
const abapTypeName = (0, combi_1.regex)(/^(?:int[1-9]|int8|sstring|char|numc|dats|datn|tims|timn|utcl|utclong|fltp|decfloat\d+|dec|string|rawstring|rstr|raw|xstring|clnt|lang|unit|cuky|curr|quan|geom_ewkb|d34n|d16n|d34d|d16d|d34s|d16s|d34r|d16r|d|t|p|n|c|x|f)$/i);
|
|
16
9
|
const abap = (0, combi_1.seq)("abap", ".", abapTypeName, (0, combi_1.optPrio)((0, combi_1.seq)("(", (0, combi_1.regex)(/^\d+$/), ")")), reg);
|
|
17
10
|
return (0, combi_1.altPrio)(abap, reg);
|
|
18
11
|
}
|
|
@@ -31,8 +31,10 @@ __exportStar(require("./cds_composition"), exports);
|
|
|
31
31
|
__exportStar(require("./cds_condition"), exports);
|
|
32
32
|
__exportStar(require("./cds_define_abstract"), exports);
|
|
33
33
|
__exportStar(require("./cds_define_custom"), exports);
|
|
34
|
+
__exportStar(require("./cds_define_external_entity"), exports);
|
|
34
35
|
__exportStar(require("./cds_define_hierarchy"), exports);
|
|
35
36
|
__exportStar(require("./cds_define_projection"), exports);
|
|
37
|
+
__exportStar(require("./cds_define_table_entity"), exports);
|
|
36
38
|
__exportStar(require("./cds_define_table_function"), exports);
|
|
37
39
|
__exportStar(require("./cds_define_view"), exports);
|
|
38
40
|
__exportStar(require("./cds_element"), exports);
|
package/build/src/config.js
CHANGED
|
@@ -47,7 +47,10 @@ class Config {
|
|
|
47
47
|
for (const rule of sorted) {
|
|
48
48
|
rules[rule.getMetadata().key] = rule.getConfig();
|
|
49
49
|
}
|
|
50
|
-
const version = ver
|
|
50
|
+
const version = ver !== null && ver !== void 0 ? ver : {
|
|
51
|
+
release: version_1.Release.Newest.name,
|
|
52
|
+
language: langVer !== null && langVer !== void 0 ? langVer : version_1.LanguageVersion.Normal,
|
|
53
|
+
};
|
|
51
54
|
// defaults: dont skip anything, report everything. The user can decide to skip stuff
|
|
52
55
|
// its difficult to debug errors not being reported
|
|
53
56
|
const config = {
|
|
@@ -174,12 +177,14 @@ class Config {
|
|
|
174
177
|
return v;
|
|
175
178
|
}
|
|
176
179
|
getLanguageVersion() {
|
|
177
|
-
|
|
180
|
+
if (this.config.syntax.languageVersion !== undefined) {
|
|
181
|
+
return this.config.syntax.languageVersion;
|
|
182
|
+
}
|
|
178
183
|
const v = this.config.syntax.version;
|
|
179
184
|
if (v !== undefined && typeof v !== "string") {
|
|
180
185
|
return v.language;
|
|
181
186
|
}
|
|
182
|
-
return
|
|
187
|
+
return version_1.LanguageVersion.Normal;
|
|
183
188
|
}
|
|
184
189
|
checkVersion() {
|
|
185
190
|
const version = this.config.syntax.version;
|
|
@@ -34,61 +34,126 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.DDLParser = exports.DDLKind = void 0;
|
|
37
|
+
const tokens_1 = require("../abap/1_lexer/tokens");
|
|
37
38
|
const combi_1 = require("../abap/2_statements/combi");
|
|
38
39
|
const nodes_1 = require("../abap/nodes");
|
|
39
40
|
const version_1 = require("../version");
|
|
40
|
-
const
|
|
41
|
+
const cds_lexer_1 = require("../cds/cds_lexer");
|
|
41
42
|
const Expressions = __importStar(require("./expressions"));
|
|
42
43
|
var DDLKind;
|
|
43
44
|
(function (DDLKind) {
|
|
44
45
|
DDLKind["Structure"] = "structure";
|
|
45
46
|
DDLKind["Table"] = "table";
|
|
47
|
+
DDLKind["Aspect"] = "aspect";
|
|
48
|
+
DDLKind["ExtendType"] = "extend-type";
|
|
46
49
|
})(DDLKind || (exports.DDLKind = DDLKind = {}));
|
|
47
50
|
class DDLParser {
|
|
48
51
|
parse(file) {
|
|
49
|
-
|
|
52
|
+
let tokens = cds_lexer_1.CDSLexer.run(file);
|
|
53
|
+
tokens = tokens.filter(t => !(t instanceof tokens_1.Comment));
|
|
50
54
|
let res = combi_1.Combi.run(new Expressions.DDLStructure(), tokens, version_1.defaultRelease);
|
|
51
55
|
if (res === undefined) {
|
|
52
56
|
res = combi_1.Combi.run(new Expressions.DDLTable(), tokens, version_1.defaultRelease);
|
|
53
57
|
}
|
|
58
|
+
if (res === undefined) {
|
|
59
|
+
res = combi_1.Combi.run(new Expressions.DDLAspect(), tokens, version_1.defaultRelease);
|
|
60
|
+
}
|
|
61
|
+
if (res === undefined) {
|
|
62
|
+
res = combi_1.Combi.run(new Expressions.DDLExtendType(), tokens, version_1.defaultRelease);
|
|
63
|
+
}
|
|
54
64
|
if (res === undefined || !(res[0] instanceof nodes_1.ExpressionNode)) {
|
|
55
65
|
return undefined;
|
|
56
66
|
}
|
|
57
67
|
return this.parsedToResult(res[0]);
|
|
58
68
|
}
|
|
59
69
|
parsedToResult(node) {
|
|
60
|
-
var _a, _b;
|
|
61
70
|
const fields = [];
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
const
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
71
|
+
for (const child of node.getChildren()) {
|
|
72
|
+
if (!(child instanceof nodes_1.ExpressionNode)) {
|
|
73
|
+
continue;
|
|
74
|
+
}
|
|
75
|
+
const expr = child.get();
|
|
76
|
+
const isField = expr instanceof Expressions.DDLStructureField
|
|
77
|
+
|| expr instanceof Expressions.DDLTableField
|
|
78
|
+
|| expr instanceof Expressions.DDLInclude
|
|
79
|
+
|| expr instanceof Expressions.DDLNamedInclude;
|
|
80
|
+
if (!isField) {
|
|
81
|
+
continue;
|
|
82
|
+
}
|
|
83
|
+
const key = this.hasKey(child);
|
|
84
|
+
const notNull = this.hasNotNull(child);
|
|
85
|
+
if (expr instanceof Expressions.DDLInclude) {
|
|
86
|
+
const target = this.compactTokens(child.findDirectExpression(Expressions.DDLName));
|
|
87
|
+
fields.push({ name: ".INCLUDE", type: target, key, notNull });
|
|
88
|
+
}
|
|
89
|
+
else if (expr instanceof Expressions.DDLNamedInclude) {
|
|
90
|
+
const names = child.findDirectExpressions(Expressions.DDLName);
|
|
91
|
+
const alias = this.compactTokens(names[0]);
|
|
92
|
+
const target = this.compactTokens(names[1]);
|
|
93
|
+
fields.push({ name: alias, type: target, key, notNull });
|
|
74
94
|
}
|
|
75
95
|
else {
|
|
76
|
-
const
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
type,
|
|
80
|
-
key: false,
|
|
81
|
-
notNull: false,
|
|
82
|
-
});
|
|
96
|
+
const name = this.compactTokens(child.findDirectExpression(Expressions.DDLName));
|
|
97
|
+
const type = this.compactTokens(child.findDirectExpression(Expressions.DDLType));
|
|
98
|
+
fields.push({ name, type, key, notNull });
|
|
83
99
|
}
|
|
84
100
|
}
|
|
85
101
|
const result = {
|
|
86
|
-
name: node.findDirectExpression(Expressions.DDLName)
|
|
87
|
-
kind:
|
|
102
|
+
name: this.compactTokens(node.findDirectExpression(Expressions.DDLName)),
|
|
103
|
+
kind: this.kindOf(node),
|
|
88
104
|
fields,
|
|
89
105
|
};
|
|
90
106
|
return result;
|
|
91
107
|
}
|
|
108
|
+
compactTokens(node) {
|
|
109
|
+
if (node === undefined) {
|
|
110
|
+
return "";
|
|
111
|
+
}
|
|
112
|
+
return node.concatTokens().replace(/\s+/g, "");
|
|
113
|
+
}
|
|
114
|
+
hasKey(node) {
|
|
115
|
+
var _a, _b, _c;
|
|
116
|
+
for (const c of node.getChildren()) {
|
|
117
|
+
const expr = (_b = (_a = c).get) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
118
|
+
const ctor = (_c = expr === null || expr === void 0 ? void 0 : expr.constructor) === null || _c === void 0 ? void 0 : _c.name;
|
|
119
|
+
if (ctor === "CDSAnnotation") {
|
|
120
|
+
continue;
|
|
121
|
+
}
|
|
122
|
+
const tok = c.concatTokens().toUpperCase().trim();
|
|
123
|
+
if (tok === "KEY") {
|
|
124
|
+
return true;
|
|
125
|
+
}
|
|
126
|
+
if (tok !== "") {
|
|
127
|
+
return false;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
return false;
|
|
131
|
+
}
|
|
132
|
+
hasNotNull(node) {
|
|
133
|
+
var _a, _b, _c, _d;
|
|
134
|
+
const children = node.getChildren();
|
|
135
|
+
for (let i = 0; i < children.length - 1; i++) {
|
|
136
|
+
const a = (_b = (_a = children[i]).concatTokens) === null || _b === void 0 ? void 0 : _b.call(_a).toUpperCase().trim();
|
|
137
|
+
const b = (_d = (_c = children[i + 1]).concatTokens) === null || _d === void 0 ? void 0 : _d.call(_c).toUpperCase().trim();
|
|
138
|
+
if (a === "NOT" && b === "NULL") {
|
|
139
|
+
return true;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
return false;
|
|
143
|
+
}
|
|
144
|
+
kindOf(node) {
|
|
145
|
+
const expr = node.get();
|
|
146
|
+
if (expr instanceof Expressions.DDLStructure) {
|
|
147
|
+
return DDLKind.Structure;
|
|
148
|
+
}
|
|
149
|
+
if (expr instanceof Expressions.DDLAspect) {
|
|
150
|
+
return DDLKind.Aspect;
|
|
151
|
+
}
|
|
152
|
+
if (expr instanceof Expressions.DDLExtendType) {
|
|
153
|
+
return DDLKind.ExtendType;
|
|
154
|
+
}
|
|
155
|
+
return DDLKind.Table;
|
|
156
|
+
}
|
|
92
157
|
}
|
|
93
158
|
exports.DDLParser = DDLParser;
|
|
94
159
|
//# sourceMappingURL=ddl_parser.js.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DDLAspect = void 0;
|
|
4
|
+
const combi_1 = require("../../abap/2_statements/combi");
|
|
5
|
+
const expressions_1 = require("../../cds/expressions");
|
|
6
|
+
const ddl_extend_1 = require("./ddl_extend");
|
|
7
|
+
const ddl_include_1 = require("./ddl_include");
|
|
8
|
+
const ddl_name_1 = require("./ddl_name");
|
|
9
|
+
const ddl_named_include_1 = require("./ddl_named_include");
|
|
10
|
+
const ddl_table_field_1 = require("./ddl_table_field");
|
|
11
|
+
class DDLAspect extends combi_1.Expression {
|
|
12
|
+
getRunnable() {
|
|
13
|
+
const entry = (0, combi_1.altPrio)(ddl_named_include_1.DDLNamedInclude, ddl_include_1.DDLInclude, ddl_table_field_1.DDLTableField, ddl_extend_1.DDLExtend);
|
|
14
|
+
return (0, combi_1.seq)((0, combi_1.star)(expressions_1.CDSAnnotation), "DEFINE", "ASPECT", ddl_name_1.DDLName, "{", (0, combi_1.plusPrio)(entry), "}", (0, combi_1.optPrio)(";"));
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.DDLAspect = DDLAspect;
|
|
18
|
+
//# sourceMappingURL=ddl_aspect.js.map
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DDLValueHelp = exports.DDLForeignKey = exports.DDLForeignKeyTarget = void 0;
|
|
4
|
+
const combi_1 = require("../../abap/2_statements/combi");
|
|
5
|
+
const ddl_literal_1 = require("./ddl_literal");
|
|
6
|
+
const ddl_name_1 = require("./ddl_name");
|
|
7
|
+
const ddl_where_1 = require("./ddl_where");
|
|
8
|
+
class DDLForeignKeyTarget extends combi_1.Expression {
|
|
9
|
+
getRunnable() {
|
|
10
|
+
const cardinality = (0, combi_1.seq)("[", ddl_literal_1.DDLCardinalityValue, ".", ".", ddl_literal_1.DDLCardinalityValue, (0, combi_1.optPrio)((0, combi_1.seq)(",", ddl_literal_1.DDLCardinalityValue)), "]");
|
|
11
|
+
return (0, combi_1.seq)((0, combi_1.optPrio)(cardinality), ddl_name_1.DDLName);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.DDLForeignKeyTarget = DDLForeignKeyTarget;
|
|
15
|
+
class DDLForeignKey extends combi_1.Expression {
|
|
16
|
+
getRunnable() {
|
|
17
|
+
return (0, combi_1.seq)("WITH", "FOREIGN", "KEY", DDLForeignKeyTarget, (0, combi_1.optPrio)(ddl_where_1.DDLWhere));
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.DDLForeignKey = DDLForeignKey;
|
|
21
|
+
class DDLValueHelp extends combi_1.Expression {
|
|
22
|
+
getRunnable() {
|
|
23
|
+
return (0, combi_1.seq)("WITH", "VALUE", "HELP", ddl_name_1.DDLName, (0, combi_1.optPrio)(ddl_where_1.DDLWhere));
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.DDLValueHelp = DDLValueHelp;
|
|
27
|
+
//# sourceMappingURL=ddl_clauses.js.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DDLExtend = void 0;
|
|
4
|
+
const combi_1 = require("../../abap/2_statements/combi");
|
|
5
|
+
const expressions_1 = require("../../cds/expressions");
|
|
6
|
+
const ddl_clauses_1 = require("./ddl_clauses");
|
|
7
|
+
const ddl_name_1 = require("./ddl_name");
|
|
8
|
+
class DDLExtend extends combi_1.Expression {
|
|
9
|
+
getRunnable() {
|
|
10
|
+
const clause = (0, combi_1.alt)(ddl_clauses_1.DDLForeignKey, ddl_clauses_1.DDLValueHelp);
|
|
11
|
+
return (0, combi_1.seq)((0, combi_1.star)(expressions_1.CDSAnnotation), "EXTEND", ddl_name_1.DDLName, ":", (0, combi_1.plus)(clause), ";");
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.DDLExtend = DDLExtend;
|
|
15
|
+
//# sourceMappingURL=ddl_extend.js.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DDLExtendType = void 0;
|
|
4
|
+
const combi_1 = require("../../abap/2_statements/combi");
|
|
5
|
+
const expressions_1 = require("../../cds/expressions");
|
|
6
|
+
const ddl_include_1 = require("./ddl_include");
|
|
7
|
+
const ddl_name_1 = require("./ddl_name");
|
|
8
|
+
const ddl_named_include_1 = require("./ddl_named_include");
|
|
9
|
+
const ddl_structure_field_1 = require("./ddl_structure_field");
|
|
10
|
+
const ddl_table_field_1 = require("./ddl_table_field");
|
|
11
|
+
class DDLExtendType extends combi_1.Expression {
|
|
12
|
+
getRunnable() {
|
|
13
|
+
const entry = (0, combi_1.altPrio)(ddl_named_include_1.DDLNamedInclude, ddl_include_1.DDLInclude, ddl_table_field_1.DDLTableField, ddl_structure_field_1.DDLStructureField);
|
|
14
|
+
return (0, combi_1.seq)((0, combi_1.star)(expressions_1.CDSAnnotation), "EXTEND", "TYPE", ddl_name_1.DDLName, "WITH", ddl_name_1.DDLName, "{", (0, combi_1.plusPrio)(entry), "}", (0, combi_1.optPrio)(";"));
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.DDLExtendType = DDLExtendType;
|
|
18
|
+
//# sourceMappingURL=ddl_extend_type.js.map
|
|
@@ -2,10 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DDLInclude = void 0;
|
|
4
4
|
const combi_1 = require("../../abap/2_statements/combi");
|
|
5
|
+
const expressions_1 = require("../../cds/expressions");
|
|
6
|
+
const ddl_clauses_1 = require("./ddl_clauses");
|
|
5
7
|
const ddl_name_1 = require("./ddl_name");
|
|
6
8
|
class DDLInclude extends combi_1.Expression {
|
|
7
9
|
getRunnable() {
|
|
8
|
-
|
|
10
|
+
const trailingClause = (0, combi_1.alt)(ddl_clauses_1.DDLForeignKey, ddl_clauses_1.DDLValueHelp);
|
|
11
|
+
return (0, combi_1.seq)((0, combi_1.star)(expressions_1.CDSAnnotation), (0, combi_1.optPrio)("KEY"), "INCLUDE", ddl_name_1.DDLName, (0, combi_1.optPrio)((0, combi_1.seq)("WITH", "SUFFIX", ddl_name_1.DDLName)), (0, combi_1.optPrio)("NOT NULL"), (0, combi_1.star)(trailingClause), ";");
|
|
9
12
|
}
|
|
10
13
|
}
|
|
11
14
|
exports.DDLInclude = DDLInclude;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DDLStringLiteral = exports.DDLCardinalityValue = void 0;
|
|
4
|
+
const combi_1 = require("../../abap/2_statements/combi");
|
|
5
|
+
const cds_integer_1 = require("../../cds/expressions/cds_integer");
|
|
6
|
+
class DDLCardinalityValue extends combi_1.Expression {
|
|
7
|
+
getRunnable() {
|
|
8
|
+
return (0, combi_1.altPrio)(cds_integer_1.CDSInteger, "*");
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.DDLCardinalityValue = DDLCardinalityValue;
|
|
12
|
+
class DDLStringLiteral extends combi_1.Expression {
|
|
13
|
+
getRunnable() {
|
|
14
|
+
return (0, combi_1.regex)(/^'[^']*'$/);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.DDLStringLiteral = DDLStringLiteral;
|
|
18
|
+
//# sourceMappingURL=ddl_literal.js.map
|
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DDLName = void 0;
|
|
4
4
|
const combi_1 = require("../../abap/2_statements/combi");
|
|
5
|
+
const cds_name_1 = require("../../cds/expressions/cds_name");
|
|
5
6
|
class DDLName extends combi_1.Expression {
|
|
6
7
|
getRunnable() {
|
|
7
|
-
return (0, combi_1.regex)(
|
|
8
|
+
return (0, combi_1.alt)(cds_name_1.CDSName, (0, combi_1.regex)(/^"[^"]*"$/));
|
|
8
9
|
}
|
|
9
10
|
}
|
|
10
11
|
exports.DDLName = DDLName;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DDLNamedInclude = void 0;
|
|
4
|
+
const combi_1 = require("../../abap/2_statements/combi");
|
|
5
|
+
const expressions_1 = require("../../cds/expressions");
|
|
6
|
+
const ddl_clauses_1 = require("./ddl_clauses");
|
|
7
|
+
const ddl_name_1 = require("./ddl_name");
|
|
8
|
+
class DDLNamedInclude extends combi_1.Expression {
|
|
9
|
+
getRunnable() {
|
|
10
|
+
const trailingClause = (0, combi_1.alt)(ddl_clauses_1.DDLForeignKey, ddl_clauses_1.DDLValueHelp);
|
|
11
|
+
return (0, combi_1.seq)((0, combi_1.star)(expressions_1.CDSAnnotation), (0, combi_1.optPrio)("KEY"), ddl_name_1.DDLName, ":", "INCLUDE", ddl_name_1.DDLName, (0, combi_1.optPrio)((0, combi_1.seq)("WITH", "SUFFIX", ddl_name_1.DDLName)), (0, combi_1.optPrio)("NOT NULL"), (0, combi_1.star)(trailingClause), ";");
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.DDLNamedInclude = DDLNamedInclude;
|
|
15
|
+
//# sourceMappingURL=ddl_named_include.js.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DDLQualifiedName = void 0;
|
|
4
|
+
const combi_1 = require("../../abap/2_statements/combi");
|
|
5
|
+
const ddl_name_1 = require("./ddl_name");
|
|
6
|
+
class DDLQualifiedName extends combi_1.Expression {
|
|
7
|
+
getRunnable() {
|
|
8
|
+
return (0, combi_1.seq)(ddl_name_1.DDLName, (0, combi_1.optPrio)((0, combi_1.seq)(".", ddl_name_1.DDLName)));
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.DDLQualifiedName = DDLQualifiedName;
|
|
12
|
+
//# sourceMappingURL=ddl_qualified_name.js.map
|
|
@@ -2,12 +2,15 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DDLStructure = void 0;
|
|
4
4
|
const combi_1 = require("../../abap/2_statements/combi");
|
|
5
|
-
const
|
|
6
|
-
const ddl_name_1 = require("./ddl_name");
|
|
5
|
+
const expressions_1 = require("../../cds/expressions");
|
|
7
6
|
const ddl_include_1 = require("./ddl_include");
|
|
7
|
+
const ddl_name_1 = require("./ddl_name");
|
|
8
|
+
const ddl_named_include_1 = require("./ddl_named_include");
|
|
9
|
+
const ddl_structure_field_1 = require("./ddl_structure_field");
|
|
8
10
|
class DDLStructure extends combi_1.Expression {
|
|
9
11
|
getRunnable() {
|
|
10
|
-
|
|
12
|
+
const entry = (0, combi_1.altPrio)(ddl_named_include_1.DDLNamedInclude, ddl_include_1.DDLInclude, ddl_structure_field_1.DDLStructureField);
|
|
13
|
+
return (0, combi_1.seq)((0, combi_1.star)(expressions_1.CDSAnnotation), "DEFINE", "STRUCTURE", ddl_name_1.DDLName, "{", (0, combi_1.plusPrio)(entry), "}", (0, combi_1.optPrio)(";"));
|
|
11
14
|
}
|
|
12
15
|
}
|
|
13
16
|
exports.DDLStructure = DDLStructure;
|
|
@@ -2,11 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DDLStructureField = void 0;
|
|
4
4
|
const combi_1 = require("../../abap/2_statements/combi");
|
|
5
|
+
const expressions_1 = require("../../cds/expressions");
|
|
5
6
|
const ddl_name_1 = require("./ddl_name");
|
|
6
7
|
const ddl_type_1 = require("./ddl_type");
|
|
7
8
|
class DDLStructureField extends combi_1.Expression {
|
|
8
9
|
getRunnable() {
|
|
9
|
-
return (0, combi_1.seq)(ddl_name_1.DDLName, ":", ddl_type_1.DDLType, ";");
|
|
10
|
+
return (0, combi_1.seq)((0, combi_1.star)(expressions_1.CDSAnnotation), ddl_name_1.DDLName, ":", ddl_type_1.DDLType, (0, combi_1.optPrio)("NOT NULL"), ";");
|
|
10
11
|
}
|
|
11
12
|
}
|
|
12
13
|
exports.DDLStructureField = DDLStructureField;
|
|
@@ -2,12 +2,16 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DDLTable = void 0;
|
|
4
4
|
const combi_1 = require("../../abap/2_statements/combi");
|
|
5
|
+
const expressions_1 = require("../../cds/expressions");
|
|
6
|
+
const ddl_extend_1 = require("./ddl_extend");
|
|
5
7
|
const ddl_include_1 = require("./ddl_include");
|
|
6
8
|
const ddl_name_1 = require("./ddl_name");
|
|
9
|
+
const ddl_named_include_1 = require("./ddl_named_include");
|
|
7
10
|
const ddl_table_field_1 = require("./ddl_table_field");
|
|
8
11
|
class DDLTable extends combi_1.Expression {
|
|
9
12
|
getRunnable() {
|
|
10
|
-
|
|
13
|
+
const entry = (0, combi_1.altPrio)(ddl_named_include_1.DDLNamedInclude, ddl_include_1.DDLInclude, ddl_table_field_1.DDLTableField, ddl_extend_1.DDLExtend);
|
|
14
|
+
return (0, combi_1.seq)((0, combi_1.star)(expressions_1.CDSAnnotation), "DEFINE", "TABLE", ddl_name_1.DDLName, "{", (0, combi_1.plusPrio)(entry), "}", (0, combi_1.optPrio)(";"));
|
|
11
15
|
}
|
|
12
16
|
}
|
|
13
17
|
exports.DDLTable = DDLTable;
|
|
@@ -2,11 +2,14 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DDLTableField = void 0;
|
|
4
4
|
const combi_1 = require("../../abap/2_statements/combi");
|
|
5
|
+
const expressions_1 = require("../../cds/expressions");
|
|
6
|
+
const ddl_clauses_1 = require("./ddl_clauses");
|
|
5
7
|
const ddl_name_1 = require("./ddl_name");
|
|
6
8
|
const ddl_type_1 = require("./ddl_type");
|
|
7
9
|
class DDLTableField extends combi_1.Expression {
|
|
8
10
|
getRunnable() {
|
|
9
|
-
|
|
11
|
+
const trailingClause = (0, combi_1.alt)(ddl_clauses_1.DDLForeignKey, ddl_clauses_1.DDLValueHelp);
|
|
12
|
+
return (0, combi_1.seq)((0, combi_1.star)(expressions_1.CDSAnnotation), (0, combi_1.optPrio)("KEY"), ddl_name_1.DDLName, ":", ddl_type_1.DDLType, (0, combi_1.optPrio)("NOT NULL"), (0, combi_1.star)(trailingClause), ";");
|
|
10
13
|
}
|
|
11
14
|
}
|
|
12
15
|
exports.DDLTableField = DDLTableField;
|
|
@@ -2,9 +2,15 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DDLType = void 0;
|
|
4
4
|
const combi_1 = require("../../abap/2_statements/combi");
|
|
5
|
+
const cds_integer_1 = require("../../cds/expressions/cds_integer");
|
|
6
|
+
const ddl_name_1 = require("./ddl_name");
|
|
5
7
|
class DDLType extends combi_1.Expression {
|
|
6
8
|
getRunnable() {
|
|
7
|
-
|
|
9
|
+
const decimals = (0, combi_1.seq)(",", cds_integer_1.CDSInteger);
|
|
10
|
+
const lenSpec = (0, combi_1.seq)("(", cds_integer_1.CDSInteger, (0, combi_1.optPrio)(decimals), ")");
|
|
11
|
+
const dotted = (0, combi_1.seq)(ddl_name_1.DDLName, ".", ddl_name_1.DDLName, (0, combi_1.optPrio)(lenSpec));
|
|
12
|
+
const plain = (0, combi_1.seq)(ddl_name_1.DDLName, (0, combi_1.optPrio)(lenSpec));
|
|
13
|
+
return (0, combi_1.altPrio)(dotted, plain);
|
|
8
14
|
}
|
|
9
15
|
}
|
|
10
16
|
exports.DDLType = DDLType;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DDLWhere = void 0;
|
|
4
|
+
const combi_1 = require("../../abap/2_statements/combi");
|
|
5
|
+
const ddl_qualified_name_1 = require("./ddl_qualified_name");
|
|
6
|
+
const ddl_literal_1 = require("./ddl_literal");
|
|
7
|
+
class DDLWhere extends combi_1.Expression {
|
|
8
|
+
getRunnable() {
|
|
9
|
+
const value = (0, combi_1.alt)(ddl_qualified_name_1.DDLQualifiedName, ddl_literal_1.DDLStringLiteral);
|
|
10
|
+
const condition = (0, combi_1.seq)(ddl_qualified_name_1.DDLQualifiedName, "=", value);
|
|
11
|
+
return (0, combi_1.seq)("WHERE", condition, (0, combi_1.star)((0, combi_1.seq)("AND", condition)));
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.DDLWhere = DDLWhere;
|
|
15
|
+
//# sourceMappingURL=ddl_where.js.map
|
|
@@ -14,11 +14,19 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./ddl_aspect"), exports);
|
|
18
|
+
__exportStar(require("./ddl_clauses"), exports);
|
|
19
|
+
__exportStar(require("./ddl_extend"), exports);
|
|
20
|
+
__exportStar(require("./ddl_extend_type"), exports);
|
|
17
21
|
__exportStar(require("./ddl_include"), exports);
|
|
22
|
+
__exportStar(require("./ddl_literal"), exports);
|
|
18
23
|
__exportStar(require("./ddl_name"), exports);
|
|
24
|
+
__exportStar(require("./ddl_named_include"), exports);
|
|
25
|
+
__exportStar(require("./ddl_qualified_name"), exports);
|
|
19
26
|
__exportStar(require("./ddl_structure_field"), exports);
|
|
20
27
|
__exportStar(require("./ddl_structure"), exports);
|
|
21
28
|
__exportStar(require("./ddl_table_field"), exports);
|
|
22
29
|
__exportStar(require("./ddl_table"), exports);
|
|
23
30
|
__exportStar(require("./ddl_type"), exports);
|
|
31
|
+
__exportStar(require("./ddl_where"), exports);
|
|
24
32
|
//# sourceMappingURL=index.js.map
|
package/build/src/index.js
CHANGED
|
@@ -33,8 +33,8 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.
|
|
37
|
-
exports.LSPEdit = exports.RuleTag = exports.Severity = exports.Visibility = exports.Info = exports.Diagnostics = exports.Rename = exports.PrettyPrinter = exports.Position = exports.CurrentScope = exports.RulesRunner = exports.SpaghettiScope = void 0;
|
|
36
|
+
exports.ABAPObject = exports.Tokens = exports.ExpressionsCDS = exports.CDSParser = exports.LanguageServerTypes = exports.DDLKind = exports.DDLParser = exports.AbstractFile = exports.ABAPFile = exports.MemoryFile = exports.Edits = exports.ReferenceType = exports.NativeSQL = exports.MacroContent = exports.MacroCall = exports.SpaghettiScopeNode = exports.Token = exports.ScopeType = exports.BasicTypes = exports.TypedIdentifier = exports.AbstractType = exports.VirtualPosition = exports.Comment = exports.Unknown = exports.Empty = exports.Identifier = exports.Nodes = exports.Types = exports.Expressions = exports.Statements = exports.Structures = exports.SkipLogic = exports.Objects = exports.ArtifactsRules = exports.ArtifactsObjects = exports.ArtifactsABAP = exports.BuiltIn = exports.FormLengthStats = exports.FunctionLengthStats = exports.MethodLengthStats = exports.LanguageServer = exports.Registry = exports.CyclomaticComplexityStats = exports.versionToABAPRelease = exports.releaseAtLeast = exports.Release = exports.LanguageVersion = exports.Version = exports.Config = exports.Issue = void 0;
|
|
37
|
+
exports.LSPEdit = exports.RuleTag = exports.Severity = exports.Visibility = exports.Info = exports.Diagnostics = exports.Rename = exports.PrettyPrinter = exports.Position = exports.CurrentScope = exports.RulesRunner = exports.SpaghettiScope = exports.SyntaxLogic = void 0;
|
|
38
38
|
const issue_1 = require("./issue");
|
|
39
39
|
Object.defineProperty(exports, "Issue", { enumerable: true, get: function () { return issue_1.Issue; } });
|
|
40
40
|
const config_1 = require("./config");
|
|
@@ -128,6 +128,7 @@ const severity_1 = require("./severity");
|
|
|
128
128
|
Object.defineProperty(exports, "Severity", { enumerable: true, get: function () { return severity_1.Severity; } });
|
|
129
129
|
const ddl_parser_1 = require("./ddl/ddl_parser");
|
|
130
130
|
Object.defineProperty(exports, "DDLParser", { enumerable: true, get: function () { return ddl_parser_1.DDLParser; } });
|
|
131
|
+
Object.defineProperty(exports, "DDLKind", { enumerable: true, get: function () { return ddl_parser_1.DDLKind; } });
|
|
131
132
|
const cds_parser_1 = require("./cds/cds_parser");
|
|
132
133
|
Object.defineProperty(exports, "CDSParser", { enumerable: true, get: function () { return cds_parser_1.CDSParser; } });
|
|
133
134
|
const rules_runner_1 = require("./rules_runner");
|
|
@@ -153,6 +153,13 @@ class DataDefinition extends _abstract_object_1.AbstractObject {
|
|
|
153
153
|
}
|
|
154
154
|
}
|
|
155
155
|
}
|
|
156
|
+
if (found === undefined) {
|
|
157
|
+
// typed virtual element: VIRTUAL <name> : <type>
|
|
158
|
+
const names = e.findAllExpressions(expressions_1.CDSName);
|
|
159
|
+
if (e.findDirectTokenByText("VIRTUAL") !== undefined && names.length > 0) {
|
|
160
|
+
found = names[0];
|
|
161
|
+
}
|
|
162
|
+
}
|
|
156
163
|
if (found === undefined) {
|
|
157
164
|
continue;
|
|
158
165
|
}
|
package/build/src/registry.js
CHANGED