@abaplint/core 2.91.32 → 2.91.33

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.
@@ -975,6 +975,10 @@ declare class ComponentCond extends Expression {
975
975
  getRunnable(): IStatementRunnable;
976
976
  }
977
977
 
978
+ declare class ComponentCondSub extends Expression {
979
+ getRunnable(): IStatementRunnable;
980
+ }
981
+
978
982
  declare class ComponentName extends Expression {
979
983
  getRunnable(): IStatementRunnable;
980
984
  }
@@ -1815,6 +1819,7 @@ declare namespace Expressions {
1815
1819
  ComponentCompareSimple,
1816
1820
  ComponentCompare,
1817
1821
  ComponentCond,
1822
+ ComponentCondSub,
1818
1823
  ComponentName,
1819
1824
  ConcatenatedConstant,
1820
1825
  CondBody,
@@ -2623,7 +2628,7 @@ export declare interface IConfig {
2623
2628
  rules: any;
2624
2629
  }
2625
2630
 
2626
- declare interface IConfiguration {
2631
+ export declare interface IConfiguration {
2627
2632
  getEnabledRules(): IRule[];
2628
2633
  get(): IConfig;
2629
2634
  getGlobal(): IGlobalConfig;
@@ -2,13 +2,11 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ComponentCond = void 0;
4
4
  const combi_1 = require("../combi");
5
- const tokens_1 = require("../../1_lexer/tokens");
6
5
  const _1 = require(".");
7
6
  class ComponentCond extends combi_1.Expression {
8
7
  getRunnable() {
9
8
  const operator = (0, combi_1.alt)("AND", "OR");
10
- const another = (0, combi_1.seq)((0, combi_1.opt)("NOT"), (0, combi_1.tok)(tokens_1.WParenLeftW), ComponentCond, (0, combi_1.altPrio)((0, combi_1.tok)(tokens_1.WParenRightW), (0, combi_1.tok)(tokens_1.ParenRightW)));
11
- const cnd = (0, combi_1.alt)(_1.ComponentCompare, another);
9
+ const cnd = (0, combi_1.alt)(_1.ComponentCompare, _1.ComponentCondSub);
12
10
  const ret = (0, combi_1.seq)(cnd, (0, combi_1.star)((0, combi_1.seq)(operator, cnd)));
13
11
  return ret;
14
12
  }
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ComponentCondSub = void 0;
4
+ const combi_1 = require("../combi");
5
+ const tokens_1 = require("../../1_lexer/tokens");
6
+ const _1 = require(".");
7
+ class ComponentCondSub extends combi_1.Expression {
8
+ getRunnable() {
9
+ const another = (0, combi_1.seq)((0, combi_1.opt)("NOT"), (0, combi_1.tok)(tokens_1.WParenLeftW), _1.ComponentCond, (0, combi_1.altPrio)((0, combi_1.tok)(tokens_1.WParenRightW), (0, combi_1.tok)(tokens_1.ParenRightW)));
10
+ return another;
11
+ }
12
+ }
13
+ exports.ComponentCondSub = ComponentCondSub;
14
+ //# sourceMappingURL=component_cond_sub.js.map
@@ -40,6 +40,7 @@ __exportStar(require("./component_chain"), exports);
40
40
  __exportStar(require("./component_compare_simple"), exports);
41
41
  __exportStar(require("./component_compare"), exports);
42
42
  __exportStar(require("./component_cond"), exports);
43
+ __exportStar(require("./component_cond_sub"), exports);
43
44
  __exportStar(require("./component_name"), exports);
44
45
  __exportStar(require("./concatenated_constant"), exports);
45
46
  __exportStar(require("./cond_body"), exports);
@@ -6,8 +6,7 @@ const combi_1 = require("../combi");
6
6
  const sql_source_simple_1 = require("./sql_source_simple");
7
7
  class SQLClient extends combi_1.Expression {
8
8
  getRunnable() {
9
- // todo, client specified and connection not possible in Cloud
10
- const client = (0, combi_1.alt)("CLIENT SPECIFIED", (0, combi_1.seq)("USING", (0, combi_1.alt)((0, combi_1.ver)(version_1.Version.v740sp05, (0, combi_1.seq)("CLIENT", sql_source_simple_1.SQLSourceSimple)), (0, combi_1.ver)(version_1.Version.v754, (0, combi_1.seq)("CLIENTS IN", (0, combi_1.alt)(sql_source_simple_1.SQLSourceSimple, "T000"))), (0, combi_1.ver)(version_1.Version.v754, "ALL CLIENTS"))));
9
+ const client = (0, combi_1.alt)((0, combi_1.verNot)(version_1.Version.Cloud, "CLIENT SPECIFIED"), (0, combi_1.seq)("USING", (0, combi_1.alt)((0, combi_1.ver)(version_1.Version.v740sp05, (0, combi_1.seq)("CLIENT", sql_source_simple_1.SQLSourceSimple)), (0, combi_1.ver)(version_1.Version.v754, (0, combi_1.seq)("CLIENTS IN", (0, combi_1.alt)(sql_source_simple_1.SQLSourceSimple, "T000"))), (0, combi_1.ver)(version_1.Version.v754, "ALL CLIENTS"))));
11
10
  return client;
12
11
  }
13
12
  }
@@ -11,11 +11,12 @@ class InsertInternal {
11
11
  const ref = (0, combi_1.seq)("REFERENCE INTO", expressions_1.Target);
12
12
  const index = (0, combi_1.seq)("INDEX", expressions_1.Source);
13
13
  const initial = (0, combi_1.str)("INITIAL LINE");
14
- const into = (0, combi_1.seq)("INTO", (0, combi_1.opt)("TABLE"), expressions_1.Target);
14
+ const into = (0, combi_1.seq)("INTO", expressions_1.Target);
15
+ const intoTable = (0, combi_1.seq)("INTO TABLE", expressions_1.Target, (0, combi_1.opt)((0, combi_1.alt)(ref, assigning)));
15
16
  const to = (0, combi_1.seq)("TO", expressions_1.Source);
16
17
  const from = (0, combi_1.seq)("FROM", expressions_1.Source);
17
- const fromTo = (0, combi_1.seq)((0, combi_1.optPrio)(from), (0, combi_1.optPrio)(to));
18
- const foo = (0, combi_1.per)(into, ref, index, assigning);
18
+ const fromTo = (0, combi_1.opt)((0, combi_1.per)(from, to));
19
+ const foo = (0, combi_1.alt)(intoTable, (0, combi_1.seq)(into, (0, combi_1.opt)((0, combi_1.per)(index, (0, combi_1.alt)(ref, assigning)))), (0, combi_1.per)(index, (0, combi_1.alt)(ref, assigning)));
19
20
  const lines = (0, combi_1.seq)("LINES OF", target, (0, combi_1.opt)(fromTo));
20
21
  const src = (0, combi_1.alt)(expressions_1.SimpleSource4, (0, combi_1.ver)(version_1.Version.v740sp02, expressions_1.Source));
21
22
  const tab = (0, combi_1.seq)("TABLE", expressions_1.Source);
@@ -5,8 +5,11 @@ const Expressions = require("../../2_statements/expressions");
5
5
  const component_compare_1 = require("./component_compare");
6
6
  class ComponentCond {
7
7
  runSyntax(node, scope, filename) {
8
- for (const t of node.findDirectExpressions(Expressions.ComponentCond)) {
9
- new ComponentCond().runSyntax(t, scope, filename);
8
+ for (const t of node.findDirectExpressions(Expressions.ComponentCondSub)) {
9
+ const c = t.findDirectExpression(Expressions.ComponentCond);
10
+ if (c) {
11
+ new ComponentCond().runSyntax(c, scope, filename);
12
+ }
10
13
  }
11
14
  for (const t of node.findDirectExpressions(Expressions.ComponentCompare)) {
12
15
  new component_compare_1.ComponentCompare().runSyntax(t, scope, filename);
@@ -30,9 +30,9 @@ class Append {
30
30
  const rowType = targetType instanceof basic_1.TableType ? targetType.getRowType() : targetType;
31
31
  new inline_data_1.InlineData().runSyntax(dataTarget, scope, filename, new basic_1.DataReference(rowType));
32
32
  }
33
- let source = node.findDirectExpression(Expressions.Source);
33
+ let source = node.findDirectExpression(Expressions.SimpleSource4);
34
34
  if (source === undefined) {
35
- source = node.findDirectExpression(Expressions.SimpleSource4);
35
+ source = node.findDirectExpression(Expressions.Source);
36
36
  }
37
37
  if (source) {
38
38
  if (targetType !== undefined
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.InsertFieldGroup = void 0;
4
+ const Expressions = require("../../2_statements/expressions");
5
+ const source_1 = require("../expressions/source");
6
+ const target_1 = require("../expressions/target");
7
+ class InsertFieldGroup {
8
+ runSyntax(node, scope, filename) {
9
+ for (const s of node.findAllExpressions(Expressions.Source)) {
10
+ new source_1.Source().runSyntax(s, scope, filename);
11
+ }
12
+ for (const s of node.findAllExpressions(Expressions.SimpleSource1)) {
13
+ new source_1.Source().runSyntax(s, scope, filename);
14
+ }
15
+ for (const t of node.findDirectExpressions(Expressions.Target)) {
16
+ new target_1.Target().runSyntax(t, scope, filename);
17
+ }
18
+ }
19
+ }
20
+ exports.InsertFieldGroup = InsertFieldGroup;
21
+ //# sourceMappingURL=insert_field_group.js.map
@@ -131,6 +131,7 @@ const unassign_1 = require("./statements/unassign");
131
131
  const insert_textpool_1 = require("./statements/insert_textpool");
132
132
  const get_cursor_1 = require("./statements/get_cursor");
133
133
  const loop_at_screen_1 = require("./statements/loop_at_screen");
134
+ const insert_field_group_1 = require("./statements/insert_field_group");
134
135
  // -----------------------------------
135
136
  const map = {};
136
137
  function addToMap(handler) {
@@ -203,6 +204,7 @@ if (Object.keys(map).length === 0) {
203
204
  addToMap(new find_1.Find());
204
205
  addToMap(new message_1.Message());
205
206
  addToMap(new system_call_1.SystemCall());
207
+ addToMap(new insert_field_group_1.InsertFieldGroup());
206
208
  addToMap(new get_time_1.GetTime());
207
209
  addToMap(new unassign_1.Unassign());
208
210
  addToMap(new get_parameter_1.GetParameter());
@@ -68,7 +68,7 @@ class Registry {
68
68
  }
69
69
  static abaplintVersion() {
70
70
  // magic, see build script "version.sh"
71
- return "2.91.32";
71
+ return "2.91.33";
72
72
  }
73
73
  getDDICReferences() {
74
74
  return this.references;
@@ -49,11 +49,17 @@ ENDIF.
49
49
  if (structure === undefined) {
50
50
  return [];
51
51
  }
52
- for (const cond of structure.findAllExpressions(Expressions.Cond)) {
52
+ for (const cond of structure.findAllExpressionsMulti([Expressions.Cond, Expressions.ComponentCond])) {
53
53
  issues.push(...this.analyze(file, cond));
54
54
  }
55
- for (const sub of structure.findAllExpressions(Expressions.CondSub)) {
56
- const cond = sub.findDirectExpressions(Expressions.Cond);
55
+ for (const sub of structure.findAllExpressionsMulti([Expressions.CondSub, Expressions.ComponentCondSub])) {
56
+ let cond = [];
57
+ if (sub.get() instanceof Expressions.CondSub) {
58
+ cond = sub.findDirectExpressions(Expressions.Cond);
59
+ }
60
+ else {
61
+ cond = sub.findDirectExpressions(Expressions.ComponentCond);
62
+ }
57
63
  if (cond.length !== 1) {
58
64
  continue;
59
65
  }
@@ -106,29 +112,37 @@ ENDIF.
106
112
  analyze(file, cond) {
107
113
  const issues = [];
108
114
  let comparator = "";
115
+ let found = false;
109
116
  for (const c of cond.getChildren()) {
110
117
  let current = "";
111
118
  if (c instanceof nodes_1.TokenNode) {
112
119
  current = c.get().getStr().toUpperCase();
113
120
  }
114
- else if (c instanceof nodes_1.ExpressionNode && c.get() instanceof Expressions.CondSub) {
121
+ else if (c instanceof nodes_1.ExpressionNode
122
+ && (c.get() instanceof Expressions.CondSub || c.get() instanceof Expressions.ComponentCondSub)) {
115
123
  if (c.getFirstToken().getStr().toUpperCase() === "NOT") {
116
124
  return [];
117
125
  }
118
- const i = c.findDirectExpression(Expressions.Cond);
126
+ let i = c.findDirectExpression(Expressions.Cond);
127
+ if (i === undefined) {
128
+ i = c.findDirectExpression(Expressions.ComponentCond);
129
+ }
119
130
  if (i === undefined) {
120
131
  return [];
121
132
  }
122
133
  current = this.findComparator(i);
134
+ if (current !== "") {
135
+ found = true; // dont report for the simple case that contains quick fixes
136
+ }
123
137
  }
124
138
  if (comparator === "") {
125
139
  comparator = current;
126
140
  }
127
- else if (comparator !== current) {
141
+ else if (comparator !== "" && current !== "" && comparator !== current) {
128
142
  return [];
129
143
  }
130
144
  }
131
- if (comparator !== "" && comparator !== "MIXED") {
145
+ if (comparator !== "" && comparator !== "MIXED" && found === true) {
132
146
  const message = "Too many parentheses, complex";
133
147
  const issue = issue_1.Issue.atToken(file, cond.getFirstToken(), message, this.getMetadata().key, this.conf.severity);
134
148
  issues.push(issue);
@@ -51,25 +51,28 @@ This rule makes sure the spaces are consistently required across the language.`,
51
51
  missingSpace(statement) {
52
52
  const found = statement.findAllExpressionsMulti([Expressions.CondSub, Expressions.SQLCond,
53
53
  Expressions.ValueBody, Expressions.NewObject, Expressions.Cond,
54
- Expressions.ComponentCond, Expressions.MethodCallParam], true);
54
+ Expressions.ComponentCond, Expressions.ComponentCondSub, Expressions.MethodCallParam], true);
55
55
  let pos = undefined;
56
56
  for (const f of found) {
57
57
  const type = f.get();
58
- if (type instanceof Expressions.CondSub) {
59
- pos = this.checkCondSub(f);
60
- }
61
- else if (type instanceof Expressions.ValueBody) {
62
- pos = this.checkValueBody(f);
63
- }
64
- else if (type instanceof Expressions.Cond) {
58
+ if (type instanceof Expressions.Cond) {
65
59
  pos = this.checkCond(f);
66
60
  }
61
+ else if (type instanceof Expressions.CondSub) {
62
+ pos = this.checkCondSub(f);
63
+ }
67
64
  else if (type instanceof Expressions.ComponentCond) {
68
65
  pos = this.checkComponentCond(f);
69
66
  }
67
+ else if (type instanceof Expressions.ComponentCondSub) {
68
+ pos = this.checkComponentCondSub(f);
69
+ }
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);
75
+ }
73
76
  else if (type instanceof Expressions.NewObject) {
74
77
  pos = this.checkNewObject(f);
75
78
  }
@@ -136,7 +139,7 @@ This rule makes sure the spaces are consistently required across the language.`,
136
139
  }
137
140
  return undefined;
138
141
  }
139
- checkComponentCond(cond) {
142
+ checkComponentCondSub(cond) {
140
143
  const children = cond.getChildren();
141
144
  for (let i = 0; i < children.length; i++) {
142
145
  if (children[i].get() instanceof Expressions.ComponentCond) {
@@ -157,6 +160,19 @@ This rule makes sure the spaces are consistently required across the language.`,
157
160
  }
158
161
  return undefined;
159
162
  }
163
+ checkComponentCond(cond) {
164
+ const children = cond.getAllTokens();
165
+ for (let i = 0; i < children.length - 1; i++) {
166
+ const current = children[i];
167
+ const next = children[i + 1];
168
+ if (next.getStr().startsWith("'")
169
+ && next.getRow() === current.getRow()
170
+ && next.getCol() === current.getEnd().getCol()) {
171
+ return current.getEnd();
172
+ }
173
+ }
174
+ return undefined;
175
+ }
160
176
  checkValueBody(vb) {
161
177
  var _a, _b;
162
178
  const children = vb.getChildren();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/core",
3
- "version": "2.91.32",
3
+ "version": "2.91.33",
4
4
  "description": "abaplint - Core API",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/abaplint.d.ts",
@@ -45,10 +45,10 @@
45
45
  },
46
46
  "homepage": "https://abaplint.org",
47
47
  "devDependencies": {
48
- "@microsoft/api-extractor": "^7.29.2",
48
+ "@microsoft/api-extractor": "^7.29.3",
49
49
  "@types/chai": "^4.3.3",
50
50
  "@types/mocha": "^9.1.1",
51
- "@types/node": "^18.7.3",
51
+ "@types/node": "^18.7.9",
52
52
  "chai": "^4.3.6",
53
53
  "eslint": "^8.22.0",
54
54
  "mocha": "^10.0.0",