@abaplint/core 2.92.1 → 2.92.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.
@@ -2002,6 +2002,7 @@ declare namespace Expressions {
2002
2002
  TypeTableKey,
2003
2003
  TypeTable,
2004
2004
  Type_2 as Type,
2005
+ ValueBodyLine,
2005
2006
  ValueBodyLines,
2006
2007
  ValueBody,
2007
2008
  Value,
@@ -6106,6 +6107,10 @@ declare class ValueBody extends Expression {
6106
6107
  getRunnable(): IStatementRunnable;
6107
6108
  }
6108
6109
 
6110
+ declare class ValueBodyLine extends Expression {
6111
+ getRunnable(): IStatementRunnable;
6112
+ }
6113
+
6109
6114
  declare class ValueBodyLines extends Expression {
6110
6115
  getRunnable(): IStatementRunnable;
6111
6116
  }
@@ -210,6 +210,7 @@ __exportStar(require("./type_param"), exports);
210
210
  __exportStar(require("./type_table_key"), exports);
211
211
  __exportStar(require("./type_table"), exports);
212
212
  __exportStar(require("./type"), exports);
213
+ __exportStar(require("./value_body_line"), exports);
213
214
  __exportStar(require("./value_body_lines"), exports);
214
215
  __exportStar(require("./value_body"), exports);
215
216
  __exportStar(require("./value"), exports);
@@ -2,16 +2,12 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ValueBody = void 0;
4
4
  const combi_1 = require("../combi");
5
- const tokens_1 = require("../../1_lexer/tokens");
6
5
  const _1 = require(".");
7
6
  const version_1 = require("../../../version");
8
- const value_body_lines_1 = require("./value_body_lines");
9
7
  class ValueBody extends combi_1.Expression {
10
8
  getRunnable() {
11
9
  const base = (0, combi_1.seq)("BASE", _1.Source);
12
- // missing spaces caught by rule "parser_missing_space"
13
- const foo = (0, combi_1.seq)((0, combi_1.altPrio)((0, combi_1.tok)(tokens_1.WParenLeftW), (0, combi_1.tok)(tokens_1.WParenLeft)), (0, combi_1.optPrio)((0, combi_1.altPrio)((0, combi_1.plusPrio)(_1.FieldAssignment), value_body_lines_1.ValueBodyLines, _1.Source)), (0, combi_1.altPrio)((0, combi_1.tok)(tokens_1.WParenRightW), (0, combi_1.tok)(tokens_1.ParenRightW)));
14
- const strucOrTab = (0, combi_1.seq)((0, combi_1.optPrio)(_1.Let), (0, combi_1.optPrio)(base), (0, combi_1.star)(_1.For), (0, combi_1.plusPrio)((0, combi_1.altPrio)(_1.FieldAssignment, foo)));
10
+ const strucOrTab = (0, combi_1.seq)((0, combi_1.optPrio)(_1.Let), (0, combi_1.optPrio)(base), (0, combi_1.star)(_1.For), (0, combi_1.plusPrio)((0, combi_1.altPrio)(_1.FieldAssignment, _1.ValueBodyLine)));
15
11
  const tabdef = (0, combi_1.ver)(version_1.Version.v740sp08, (0, combi_1.altPrio)("OPTIONAL", (0, combi_1.seq)("DEFAULT", _1.Source)));
16
12
  return (0, combi_1.optPrio)((0, combi_1.altPrio)(strucOrTab, (0, combi_1.seq)(_1.Source, (0, combi_1.optPrio)(tabdef))));
17
13
  }
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ValueBodyLine = void 0;
4
+ const combi_1 = require("../combi");
5
+ const tokens_1 = require("../../1_lexer/tokens");
6
+ const _1 = require(".");
7
+ const value_body_lines_1 = require("./value_body_lines");
8
+ class ValueBodyLine extends combi_1.Expression {
9
+ getRunnable() {
10
+ // missing spaces caught by rule "parser_missing_space"
11
+ const ret = (0, combi_1.seq)((0, combi_1.altPrio)((0, combi_1.tok)(tokens_1.WParenLeftW), (0, combi_1.tok)(tokens_1.WParenLeft)), (0, combi_1.optPrio)((0, combi_1.altPrio)((0, combi_1.plusPrio)(_1.FieldAssignment), value_body_lines_1.ValueBodyLines, _1.Source)), (0, combi_1.altPrio)((0, combi_1.tok)(tokens_1.WParenRightW), (0, combi_1.tok)(tokens_1.ParenRightW)));
12
+ return ret;
13
+ }
14
+ }
15
+ exports.ValueBodyLine = ValueBodyLine;
16
+ //# sourceMappingURL=value_body_line.js.map
@@ -27,8 +27,16 @@ class ValueBody {
27
27
  for (const s of node.findDirectExpressions(Expressions.Source)) {
28
28
  type = new source_1.Source().runSyntax(s, scope, filename);
29
29
  }
30
- for (const l of node.findDirectExpressions(Expressions.ValueBodyLines)) {
31
- for (const s of l.findDirectExpressions(Expressions.Source)) {
30
+ for (const foo of node.findDirectExpressions(Expressions.ValueBodyLine)) {
31
+ for (const l of foo.findDirectExpressions(Expressions.ValueBodyLines)) {
32
+ for (const s of l.findDirectExpressions(Expressions.Source)) {
33
+ new source_1.Source().runSyntax(s, scope, filename);
34
+ }
35
+ }
36
+ for (const s of foo.findDirectExpressions(Expressions.FieldAssignment)) {
37
+ new field_assignment_1.FieldAssignment().runSyntax(s, scope, filename, targetType);
38
+ }
39
+ for (const s of foo.findDirectExpressions(Expressions.Source)) {
32
40
  new source_1.Source().runSyntax(s, scope, filename);
33
41
  }
34
42
  }
@@ -67,7 +67,7 @@ class Registry {
67
67
  }
68
68
  static abaplintVersion() {
69
69
  // magic, see build script "version.sh"
70
- return "2.92.1";
70
+ return "2.92.2";
71
71
  }
72
72
  getDDICReferences() {
73
73
  return this.references;
@@ -56,7 +56,13 @@ foobar( moo = 1
56
56
 
57
57
  foo = VALUE #(
58
58
  foo = bar
59
- moo = 2 ).`,
59
+ moo = 2 ).
60
+
61
+ DATA(sdf) = VALUE type(
62
+ common_val = 2
63
+ another_common = 5
64
+ ( row_value = 4
65
+ value_foo = 5 ) ).`,
60
66
  };
61
67
  }
62
68
  getConfig() {
@@ -169,6 +175,27 @@ foo = VALUE #(
169
175
  candidates.push({ parameters });
170
176
  }
171
177
  }
178
+ for (const vb of stru.findAllExpressionsRecursive(Expressions.ValueBodyLine)) {
179
+ const parameters = [];
180
+ const fieldAssignments = vb.findDirectExpressions(Expressions.FieldAssignment);
181
+ if (fieldAssignments.length <= 1) {
182
+ continue;
183
+ }
184
+ for (const fs of fieldAssignments) {
185
+ const children = fs.getChildren();
186
+ if (children.length < 3) {
187
+ continue; // unexpected
188
+ }
189
+ parameters.push({
190
+ left: children[0],
191
+ eq: children[1].getFirstToken().getStart(),
192
+ right: children[2],
193
+ });
194
+ }
195
+ if (parameters.length > 0) {
196
+ candidates.push({ parameters });
197
+ }
198
+ }
172
199
  return candidates;
173
200
  }
174
201
  raiseAndCreateCandidates(stru) {
@@ -1500,54 +1500,65 @@ ${indentation} output = ${topTarget}.`;
1500
1500
  let end = "";
1501
1501
  let structureName = uniqueName;
1502
1502
  let added = false;
1503
- let skip = false;
1504
1503
  let data = "";
1505
1504
  let previous = undefined;
1506
- for (const b of (valueBody === null || valueBody === void 0 ? void 0 : valueBody.getChildren()) || []) {
1507
- if (b.concatTokens() === "(" && added === false) {
1508
- structureName = this.uniqueName(firstToken.getStart(), lowFile.getFilename(), highSyntax);
1509
- data = indentation + `DATA ${structureName} LIKE LINE OF ${uniqueName}.\n`;
1510
- }
1511
- if (b.get() instanceof Expressions.FieldAssignment) {
1505
+ for (const a of (valueBody === null || valueBody === void 0 ? void 0 : valueBody.getChildren()) || []) {
1506
+ if (a.get() instanceof Expressions.FieldAssignment) {
1512
1507
  if (added === false) {
1513
1508
  body += data;
1514
1509
  added = true;
1515
1510
  }
1516
- body += indentation + structureName + "-" + b.concatTokens() + ".\n";
1511
+ body += indentation + structureName + "-" + a.concatTokens() + ".\n";
1517
1512
  }
1518
- else if (b instanceof nodes_1.ExpressionNode && b.get() instanceof Expressions.For) {
1519
- const outlineFor = this.outlineFor(b, indentation, lowFile, highSyntax);
1513
+ else if (a instanceof nodes_1.ExpressionNode && a.get() instanceof Expressions.For) {
1514
+ const outlineFor = this.outlineFor(a, indentation, lowFile, highSyntax);
1520
1515
  body += outlineFor.body;
1521
1516
  end = outlineFor.end + `.\n` + end;
1522
1517
  indentation += " ";
1523
1518
  }
1524
- else if (b.get() instanceof Expressions.Source) {
1519
+ else if (a instanceof nodes_1.ExpressionNode && a.get() instanceof Expressions.Source) {
1520
+ // special handling for superflous value expression
1525
1521
  if ((valueBody === null || valueBody === void 0 ? void 0 : valueBody.getChildren().length) === 1) {
1526
- body += indentation + uniqueName + " = " + b.concatTokens() + `.\n`;
1527
- }
1528
- structureName = b.concatTokens();
1529
- if (base && (valueBody === null || valueBody === void 0 ? void 0 : valueBody.findDirectTokenByText("(")) === undefined) {
1530
- structureName = uniqueName;
1522
+ body += indentation + uniqueName + " = " + a.concatTokens() + `.\n`;
1531
1523
  }
1532
1524
  }
1533
- else if (b.get() instanceof Expressions.ValueBodyLines) {
1534
- body += indentation + "APPEND " + b.concatTokens() + ` TO ${uniqueName}.\n`;
1535
- skip = true;
1536
- }
1537
- else if (b instanceof nodes_1.ExpressionNode && b.get() instanceof Expressions.Let) {
1538
- body += this.outlineLet(b, indentation, highSyntax, lowFile);
1525
+ else if (a instanceof nodes_1.ExpressionNode && a.get() instanceof Expressions.Let) {
1526
+ body += this.outlineLet(a, indentation, highSyntax, lowFile);
1539
1527
  }
1540
- else if (b.concatTokens() === ")") {
1541
- if (added === false && (previous === null || previous === void 0 ? void 0 : previous.concatTokens()) === "(") {
1542
- body += data;
1543
- added = true;
1544
- }
1545
- if (skip === false) {
1546
- body += indentation + `APPEND ${structureName} TO ${uniqueName}.\n`;
1528
+ if (a instanceof nodes_1.ExpressionNode && a.get() instanceof Expressions.ValueBodyLine) {
1529
+ let skip = false;
1530
+ for (const b of (a === null || a === void 0 ? void 0 : a.getChildren()) || []) {
1531
+ if (b.concatTokens() === "(" && added === false) {
1532
+ structureName = this.uniqueName(firstToken.getStart(), lowFile.getFilename(), highSyntax);
1533
+ data = indentation + `DATA ${structureName} LIKE LINE OF ${uniqueName}.\n`;
1534
+ }
1535
+ if (b.get() instanceof Expressions.FieldAssignment) {
1536
+ if (added === false) {
1537
+ body += data;
1538
+ added = true;
1539
+ }
1540
+ body += indentation + structureName + "-" + b.concatTokens() + ".\n";
1541
+ }
1542
+ else if (b.get() instanceof Expressions.Source) {
1543
+ body += indentation + "APPEND " + b.concatTokens() + ` TO ${uniqueName}.\n`;
1544
+ skip = true;
1545
+ }
1546
+ else if (b.get() instanceof Expressions.ValueBodyLines) {
1547
+ body += indentation + "APPEND " + b.concatTokens() + ` TO ${uniqueName}.\n`;
1548
+ skip = true;
1549
+ }
1550
+ else if (b.concatTokens() === ")") {
1551
+ if (added === false && (previous === null || previous === void 0 ? void 0 : previous.concatTokens()) === "(") {
1552
+ body += data;
1553
+ added = true;
1554
+ }
1555
+ if (skip === false) {
1556
+ body += indentation + `APPEND ${structureName} TO ${uniqueName}.\n`;
1557
+ }
1558
+ }
1559
+ previous = b;
1547
1560
  }
1548
- skip = false;
1549
1561
  }
1550
- previous = b;
1551
1562
  }
1552
1563
  if (body === "" && ((_b = valueBody === null || valueBody === void 0 ? void 0 : valueBody.getLastChild()) === null || _b === void 0 ? void 0 : _b.getFirstToken().getStr().toUpperCase()) === "OPTIONAL") {
1553
1564
  const fieldChain = valueBody.findFirstExpression(Expressions.FieldChain);
@@ -50,7 +50,7 @@ This rule makes sure the spaces are consistently required across the language.`,
50
50
  }
51
51
  missingSpace(statement) {
52
52
  const found = statement.findAllExpressionsMulti([Expressions.CondSub, Expressions.SQLCond,
53
- Expressions.ValueBody, Expressions.NewObject, Expressions.Cond,
53
+ Expressions.ValueBodyLine, Expressions.NewObject, Expressions.Cond,
54
54
  Expressions.ComponentCond, Expressions.ComponentCondSub, Expressions.MethodCallParam], true);
55
55
  let pos = undefined;
56
56
  for (const f of found) {
@@ -70,8 +70,8 @@ This rule makes sure the spaces are consistently required across the language.`,
70
70
  else if (type instanceof Expressions.SQLCond) {
71
71
  pos = this.checkSQLCond(f);
72
72
  }
73
- else if (type instanceof Expressions.ValueBody) {
74
- pos = this.checkValueBody(f);
73
+ else if (type instanceof Expressions.ValueBodyLine) {
74
+ pos = this.checkValueBodyLine(f);
75
75
  }
76
76
  else if (type instanceof Expressions.NewObject) {
77
77
  pos = this.checkNewObject(f);
@@ -173,7 +173,7 @@ This rule makes sure the spaces are consistently required across the language.`,
173
173
  }
174
174
  return undefined;
175
175
  }
176
- checkValueBody(vb) {
176
+ checkValueBodyLine(vb) {
177
177
  var _a, _b;
178
178
  const children = vb.getChildren();
179
179
  for (let i = 0; i < children.length; i++) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/core",
3
- "version": "2.92.1",
3
+ "version": "2.92.2",
4
4
  "description": "abaplint - Core API",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/abaplint.d.ts",