@abaplint/core 2.113.224 → 2.113.226

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.
@@ -2462,6 +2462,7 @@ declare namespace Expressions {
2462
2462
  SQLArithmetics,
2463
2463
  SQLAsName,
2464
2464
  SQLCase,
2465
+ SQLCast,
2465
2466
  SQLCDSParameters,
2466
2467
  SQLClient,
2467
2468
  SQLCompareOperator,
@@ -6175,6 +6176,10 @@ declare class SQLCase extends Expression {
6175
6176
  getRunnable(): IStatementRunnable;
6176
6177
  }
6177
6178
 
6179
+ declare class SQLCast extends Expression {
6180
+ getRunnable(): IStatementRunnable;
6181
+ }
6182
+
6178
6183
  declare class SQLCDSParameters extends Expression {
6179
6184
  getRunnable(): IStatementRunnable;
6180
6185
  }
@@ -179,6 +179,7 @@ __exportStar(require("./sql_arithmetic_operator"), exports);
179
179
  __exportStar(require("./sql_arithmetics"), exports);
180
180
  __exportStar(require("./sql_as_name"), exports);
181
181
  __exportStar(require("./sql_case"), exports);
182
+ __exportStar(require("./sql_cast"), exports);
182
183
  __exportStar(require("./sql_cds_parameters"), exports);
183
184
  __exportStar(require("./sql_client"), exports);
184
185
  __exportStar(require("./sql_compare_operator"), exports);
@@ -14,7 +14,7 @@ class SQLCase extends combi_1.Expression {
14
14
  const abap = (0, combi_1.seq)((0, combi_1.tok)(tokens_1.WAt), _1.SimpleFieldChain2);
15
15
  const field = (0, combi_1.altPrio)(_1.SQLAggregation, SQLCase, _1.SQLFunction, _1.SQLPath, sql_field_name_1.SQLFieldName, constant_1.Constant);
16
16
  const sub = (0, combi_1.seq)((0, combi_1.altPrio)("+", "-", "*", "/", "&&"), (0, combi_1.optPrio)((0, combi_1.tok)(tokens_1.WParenLeftW)), field, (0, combi_1.optPrio)((0, combi_1.tok)(tokens_1.WParenRightW)));
17
- const sourc = (0, combi_1.altPrio)(SQLCase, _1.SQLAggregation, _1.SQLFunction, sql_source_1.SQLSource, constant_1.Constant);
17
+ const sourc = (0, combi_1.altPrio)(SQLCase, _1.SQLAggregation, _1.SQLFunction, sql_field_name_1.SQLFieldName, sql_source_1.SQLSource, constant_1.Constant);
18
18
  const val = (0, combi_1.altPrio)(sql_cond_1.SQLCond, constant_1.Constant, abap);
19
19
  const when = (0, combi_1.seq)("WHEN", val, "THEN", sourc, (0, combi_1.starPrio)(sub));
20
20
  const els = (0, combi_1.seq)("ELSE", sourc);
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SQLCast = void 0;
4
+ const _1 = require(".");
5
+ const version_1 = require("../../../version");
6
+ const tokens_1 = require("../../1_lexer/tokens");
7
+ const combi_1 = require("../combi");
8
+ const sql_field_name_1 = require("./sql_field_name");
9
+ class SQLCast extends combi_1.Expression {
10
+ getRunnable() {
11
+ const abap = (0, combi_1.ver)(version_1.Version.v740sp05, (0, combi_1.seq)((0, combi_1.tok)(tokens_1.WAt), _1.SimpleFieldChain2), version_1.Version.OpenABAP);
12
+ // todo: from version something
13
+ return (0, combi_1.seq)("CAST", "(", (0, combi_1.opt)((0, combi_1.altPrio)(sql_field_name_1.SQLFieldName, abap)), "AS", sql_field_name_1.SQLFieldName, ")");
14
+ }
15
+ }
16
+ exports.SQLCast = SQLCast;
17
+ //# sourceMappingURL=sql_cast.js.map
@@ -11,7 +11,8 @@ class SQLField extends combi_1.Expression {
11
11
  getRunnable() {
12
12
  const abap = (0, combi_1.ver)(version_1.Version.v740sp05, (0, combi_1.seq)((0, combi_1.tok)(tokens_1.WAt), _1.SimpleFieldChain2), version_1.Version.OpenABAP);
13
13
  const as = (0, combi_1.seq)("AS", _1.SQLAsName);
14
- const field = (0, combi_1.altPrio)(_1.SQLAggregation, _1.SQLCase, sql_function_1.SQLFunction, sql_path_1.SQLPath, _1.SQLFieldName, abap, _1.Constant);
14
+ const paren = (0, combi_1.seq)((0, combi_1.tok)(tokens_1.WParenLeftW), _1.SQLFieldName, (0, combi_1.altPrio)((0, combi_1.tok)(tokens_1.WParenRightW), (0, combi_1.tok)(tokens_1.WParenRight)));
15
+ const field = (0, combi_1.altPrio)(_1.SQLAggregation, _1.SQLCase, _1.SQLCast, sql_function_1.SQLFunction, sql_path_1.SQLPath, _1.SQLFieldName, abap, _1.Constant, paren);
15
16
  const sub = (0, combi_1.plusPrio)((0, combi_1.seq)((0, combi_1.altPrio)("+", "-", "*", "/", "&&"), (0, combi_1.optPrio)((0, combi_1.tok)(tokens_1.WParenLeftW)), field, (0, combi_1.optPrio)((0, combi_1.tok)(tokens_1.WParenRightW))));
16
17
  const arith = (0, combi_1.ver)(version_1.Version.v740sp05, sub);
17
18
  return (0, combi_1.seq)(field, (0, combi_1.optPrio)(arith), (0, combi_1.optPrio)(as));
@@ -4,13 +4,11 @@ exports.SQLFieldList = void 0;
4
4
  const combi_1 = require("../combi");
5
5
  const _1 = require(".");
6
6
  const version_1 = require("../../../version");
7
- const tokens_1 = require("../../1_lexer/tokens");
8
7
  class SQLFieldList extends combi_1.Expression {
9
8
  getRunnable() {
10
- const paren = (0, combi_1.seq)((0, combi_1.tok)(tokens_1.WParenLeftW), _1.SQLFieldName, (0, combi_1.tok)(tokens_1.WParenRightW));
11
9
  const nev = (0, combi_1.ver)(version_1.Version.v740sp05, (0, combi_1.starPrio)((0, combi_1.seq)(",", _1.SQLField)), version_1.Version.OpenABAP);
12
10
  const old = (0, combi_1.starPrio)(_1.SQLField);
13
- return (0, combi_1.altPrio)("*", _1.Dynamic, (0, combi_1.seq)(_1.SQLField, (0, combi_1.alt)(nev, old)), paren);
11
+ return (0, combi_1.altPrio)("*", _1.Dynamic, (0, combi_1.seq)(_1.SQLField, (0, combi_1.alt)(nev, old)));
14
12
  }
15
13
  }
16
14
  exports.SQLFieldList = SQLFieldList;
@@ -10,7 +10,10 @@ class Field {
10
10
  const module = (0, combi_1.seq)("MODULE", expressions_1.FormName, (0, combi_1.opt)((0, combi_1.alt)("ON INPUT", "ON REQUEST", "ON CHAIN-REQUEST")));
11
11
  const values = (0, combi_1.seq)("VALUES", (0, combi_1.tok)(tokens_1.WParenLeft), "BETWEEN", expressions_1.Constant, "AND", expressions_1.Constant, (0, combi_1.tok)(tokens_1.ParenRightW));
12
12
  const wit = (0, combi_1.seq)("WITH", expressions_1.FieldChain);
13
- const ret = (0, combi_1.seq)("FIELD", expressions_1.FieldChain, (0, combi_1.opt)((0, combi_1.altPrio)(module, values, wit)));
13
+ const cond = (0, combi_1.seq)(expressions_1.FieldChain, "=", expressions_1.FieldChain);
14
+ const where = (0, combi_1.seq)(cond, (0, combi_1.starPrio)((0, combi_1.seq)("AND", cond)));
15
+ const select = (0, combi_1.seq)("SELECT * FROM", expressions_1.FieldChain, "WHERE", where, "INTO RESULT WHENEVER NOT FOUND SEND ERRORMESSAGE");
16
+ const ret = (0, combi_1.seq)("FIELD", expressions_1.FieldChain, (0, combi_1.opt)((0, combi_1.altPrio)(module, values, wit, select)));
14
17
  return (0, combi_1.verNot)(version_1.Version.Cloud, ret);
15
18
  }
16
19
  }
@@ -506,10 +506,10 @@ class BasicTypes {
506
506
  sub = node.findFirstExpression(Expressions.TypeParam);
507
507
  }
508
508
  if (sub === undefined) {
509
- sub = node.findFirstExpression(Expressions.FieldChain);
509
+ sub = node.findFirstExpression(Expressions.TypeName);
510
510
  }
511
511
  if (sub === undefined) {
512
- sub = node.findFirstExpression(Expressions.TypeName);
512
+ sub = node.findFirstExpression(Expressions.FieldChain);
513
513
  }
514
514
  found = this.resolveLikeName(sub);
515
515
  if (found && this.isOccurs(node)) {
@@ -29,14 +29,17 @@ class ValueBody {
29
29
  const fields = new Set();
30
30
  for (const s of node.findDirectExpressions(Expressions.FieldAssignment)) {
31
31
  field_assignment_1.FieldAssignment.runSyntax(s, input, targetType);
32
- const fieldname = (_a = s.findDirectExpression(Expressions.FieldSub)) === null || _a === void 0 ? void 0 : _a.concatTokens().toUpperCase();
33
- if (fieldname) {
34
- if (fields.has(fieldname)) {
35
- const message = "Duplicate field assignment";
36
- input.issues.push((0, _syntax_input_1.syntaxIssue)(input, s.getFirstToken(), message));
37
- return basic_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
32
+ if (node.findDirectExpression(Expressions.ValueBodyLine) === undefined) {
33
+ // todo: refine, still needs to be checked when there are table lines
34
+ const fieldname = (_a = s.findDirectExpression(Expressions.FieldSub)) === null || _a === void 0 ? void 0 : _a.concatTokens().toUpperCase();
35
+ if (fieldname) {
36
+ if (fields.has(fieldname)) {
37
+ const message = "Duplicate field assignment";
38
+ input.issues.push((0, _syntax_input_1.syntaxIssue)(input, s.getFirstToken(), message));
39
+ return basic_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
40
+ }
41
+ fields.add(fieldname);
38
42
  }
39
- fields.add(fieldname);
40
43
  }
41
44
  }
42
45
  let type = undefined; // todo, this is only correct if there is a single source in the body
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FieldGroup = void 0;
4
+ const Expressions = require("../../2_statements/expressions");
5
+ const _typed_identifier_1 = require("../../types/_typed_identifier");
6
+ const basic_1 = require("../../types/basic");
7
+ class FieldGroup {
8
+ runSyntax(node, input) {
9
+ const nameExpression = node.findFirstExpression(Expressions.Field);
10
+ if (nameExpression === undefined) {
11
+ return;
12
+ }
13
+ const name = nameExpression === null || nameExpression === void 0 ? void 0 : nameExpression.concatTokens();
14
+ if (name === undefined) {
15
+ return;
16
+ }
17
+ const id = new _typed_identifier_1.TypedIdentifier(nameExpression === null || nameExpression === void 0 ? void 0 : nameExpression.getFirstToken(), input.filename, basic_1.VoidType.get("FIELD-GROUP"));
18
+ input.scope.addIdentifier(id);
19
+ }
20
+ }
21
+ exports.FieldGroup = FieldGroup;
22
+ //# sourceMappingURL=field_group.js.map
@@ -35,7 +35,7 @@ class IncludeType {
35
35
  else if (ityp instanceof basic_1.TableType && isStructure) {
36
36
  ityp = ityp.getRowType();
37
37
  }
38
- else if (ityp instanceof basic_1.VoidType) {
38
+ if (ityp instanceof basic_1.VoidType) {
39
39
  return ityp;
40
40
  }
41
41
  if (!(ityp instanceof basic_1.StructureType)) {
@@ -33,7 +33,7 @@ class Parameter {
33
33
  }
34
34
  const magicName = "%_" + nameToken.getStr() + "_%_app_%";
35
35
  const magicToken = new tokens_1.Identifier(nameToken.getStart(), magicName);
36
- input.scope.addIdentifier(new _typed_identifier_1.TypedIdentifier(magicToken, input.filename, basic_1.VoidType.get("PARAMETER magic")));
36
+ input.scope.addIdentifier(new _typed_identifier_1.TypedIdentifier(magicToken, input.filename, basic_1.VoidType.get("PARAMETER-MAGIC")));
37
37
  }
38
38
  }
39
39
  exports.Parameter = Parameter;
@@ -11,6 +11,8 @@ const Expressions = require("../../2_statements/expressions");
11
11
  const Statements = require("../../2_statements/statements");
12
12
  const Structures = require("../../3_structures/structures");
13
13
  const include_type_1 = require("../statements/include_type");
14
+ const constant_1 = require("../statements/constant");
15
+ const constants_1 = require("./constants");
14
16
  class Data {
15
17
  static runSyntax(node, input) {
16
18
  var _a;
@@ -48,46 +50,6 @@ class Data {
48
50
  }
49
51
  else if (c instanceof nodes_1.StatementNode && ctyp instanceof Statements.IncludeType) {
50
52
  // INCLUDES
51
- /*
52
- const typeToken = c.findFirstExpression(Expressions.TypeName)?.getFirstToken();
53
- const typeName = typeToken?.getStr();
54
-
55
- let foundId = input.scope.findType(typeName);
56
- if (foundId === undefined) {
57
- foundId = input.scope.findVariable(typeName);
58
- }
59
-
60
- let found = foundId?.getType();
61
- if (found === undefined) {
62
- const f = input.scope.getDDIC().lookupTableOrView(typeName).type;
63
- if (f instanceof TypedIdentifier) {
64
- found = f.getType();
65
- } else {
66
- found = f;
67
- }
68
- } else {
69
- input.scope.addReference(typeToken, foundId, ReferenceType.TypeReference, input.filename);
70
- }
71
- if (found instanceof Basic.VoidType) {
72
- if (table === true) {
73
- const ttyp = new Basic.TableType(found, {withHeader: true, keyType: Basic.TableKeyType.default});
74
- return new TypedIdentifier(name, input.filename, ttyp);
75
- } else {
76
- return new TypedIdentifier(name, input.filename, found);
77
- }
78
- }
79
- if (found instanceof Basic.UnknownType) {
80
- return new TypedIdentifier(name, input.filename, new Basic.UnknownType("unknown type, " + typeName));
81
- }
82
- if (found instanceof Basic.TableType && found.isWithHeader()) {
83
- found = found.getRowType();
84
- }
85
- if (!(found instanceof Basic.StructureType)) {
86
- const message = "not structured, " + typeName;
87
- input.issues.push(syntaxIssue(input, typeToken!, message));
88
- return new TypedIdentifier(name, input.filename, Basic.VoidType.get(CheckSyntaxKey));
89
- }
90
- */
91
53
  const found = new include_type_1.IncludeType().runSyntax(c, input);
92
54
  if (found instanceof Basic.VoidType) {
93
55
  if (table === true) {
@@ -138,6 +100,18 @@ class Data {
138
100
  input.scope.addType(found);
139
101
  }
140
102
  }
103
+ else if (c instanceof nodes_1.StatementNode && ctyp instanceof Statements.Constant) {
104
+ const found = new constant_1.Constant().runSyntax(c, input);
105
+ if (found) {
106
+ input.scope.addIdentifier(found);
107
+ }
108
+ }
109
+ else if (c instanceof nodes_1.StructureNode && ctyp instanceof Structures.Constants) {
110
+ const { type: found, values: _ } = new constants_1.Constants().runSyntax(c, input);
111
+ if (found) {
112
+ input.scope.addIdentifier(found);
113
+ }
114
+ }
141
115
  }
142
116
  }
143
117
  }
@@ -148,6 +148,7 @@ const modify_entities_1 = require("./statements/modify_entities");
148
148
  const commit_entities_1 = require("./statements/commit_entities");
149
149
  const _syntax_input_1 = require("./_syntax_input");
150
150
  const assert_error_1 = require("./assert_error");
151
+ const field_group_1 = require("./statements/field_group");
151
152
  // -----------------------------------
152
153
  const map = {};
153
154
  function addToMap(handler) {
@@ -278,6 +279,7 @@ if (Object.keys(map).length === 0) {
278
279
  addToMap(new translate_1.Translate());
279
280
  addToMap(new modify_internal_1.ModifyInternal());
280
281
  addToMap(new read_textpool_1.ReadTextpool());
282
+ addToMap(new field_group_1.FieldGroup());
281
283
  addToMap(new editor_call_1.EditorCall());
282
284
  addToMap(new delete_memory_1.DeleteMemory());
283
285
  }
@@ -67,7 +67,7 @@ class Registry {
67
67
  }
68
68
  static abaplintVersion() {
69
69
  // magic, see build script "version.sh"
70
- return "2.113.224";
70
+ return "2.113.226";
71
71
  }
72
72
  getDDICReferences() {
73
73
  return this.ddicReferences;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/core",
3
- "version": "2.113.224",
3
+ "version": "2.113.226",
4
4
  "description": "abaplint - Core API",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/abaplint.d.ts",