@abaplint/core 2.113.224 → 2.113.225

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
@@ -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;
@@ -138,6 +140,18 @@ class Data {
138
140
  input.scope.addType(found);
139
141
  }
140
142
  }
143
+ else if (c instanceof nodes_1.StatementNode && ctyp instanceof Statements.Constant) {
144
+ const found = new constant_1.Constant().runSyntax(c, input);
145
+ if (found) {
146
+ input.scope.addIdentifier(found);
147
+ }
148
+ }
149
+ else if (c instanceof nodes_1.StructureNode && ctyp instanceof Structures.Constants) {
150
+ const { type: found, values: _ } = new constants_1.Constants().runSyntax(c, input);
151
+ if (found) {
152
+ input.scope.addIdentifier(found);
153
+ }
154
+ }
141
155
  }
142
156
  }
143
157
  }
@@ -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.225";
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.225",
4
4
  "description": "abaplint - Core API",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/abaplint.d.ts",