@abaplint/core 2.113.39 → 2.113.41

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.
@@ -2334,6 +2334,7 @@ declare namespace Expressions {
2334
2334
  SQLFromSource,
2335
2335
  SQLFrom,
2336
2336
  SQLFunction,
2337
+ SQLFunctionInput,
2337
2338
  SQLGroupBy,
2338
2339
  SQLHaving,
2339
2340
  SQLHints,
@@ -6012,6 +6013,10 @@ declare class SQLFunction extends Expression {
6012
6013
  getRunnable(): IStatementRunnable;
6013
6014
  }
6014
6015
 
6016
+ declare class SQLFunctionInput extends Expression {
6017
+ getRunnable(): IStatementRunnable;
6018
+ }
6019
+
6015
6020
  declare class SQLGroupBy extends Expression {
6016
6021
  getRunnable(): IStatementRunnable;
6017
6022
  }
@@ -189,6 +189,7 @@ __exportStar(require("./sql_for_all_entries"), exports);
189
189
  __exportStar(require("./sql_from_source"), exports);
190
190
  __exportStar(require("./sql_from"), exports);
191
191
  __exportStar(require("./sql_function"), exports);
192
+ __exportStar(require("./sql_function_input"), exports);
192
193
  __exportStar(require("./sql_group_by"), exports);
193
194
  __exportStar(require("./sql_having"), exports);
194
195
  __exportStar(require("./sql_hints"), exports);
@@ -1,37 +1,29 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SQLFunction = void 0;
4
- const constant_1 = require("./constant");
5
4
  const version_1 = require("../../../version");
6
5
  const tokens_1 = require("../../1_lexer/tokens");
7
6
  const combi_1 = require("../combi");
8
7
  const integer_1 = require("./integer");
9
- const sql_alias_field_1 = require("./sql_alias_field");
10
- const sql_field_name_1 = require("./sql_field_name");
11
- const simple_source3_1 = require("./simple_source3");
12
- const source_1 = require("./source");
13
- const sql_aggregation_1 = require("./sql_aggregation");
8
+ const sql_function_input_1 = require("./sql_function_input");
14
9
  class SQLFunction extends combi_1.Expression {
15
10
  getRunnable() {
16
- const paren = (0, combi_1.seq)((0, combi_1.tok)(tokens_1.ParenLeftW), source_1.Source, (0, combi_1.tok)(tokens_1.WParenRightW));
17
- const at = (0, combi_1.ver)(version_1.Version.v740sp05, (0, combi_1.seq)((0, combi_1.tok)(tokens_1.WAt), (0, combi_1.altPrio)(simple_source3_1.SimpleSource3, paren)));
18
- const param = (0, combi_1.altPrio)(SQLFunction, sql_aggregation_1.SQLAggregation, sql_field_name_1.SQLFieldName, sql_alias_field_1.SQLAliasField, constant_1.Constant, at);
19
11
  const castTypes = (0, combi_1.altPrio)((0, combi_1.seq)("CHAR", (0, combi_1.tok)(tokens_1.ParenLeftW), integer_1.Integer, (0, combi_1.tok)(tokens_1.WParenRightW)), (0, combi_1.seq)("DEC", (0, combi_1.tok)(tokens_1.ParenLeftW), integer_1.Integer, ",", integer_1.Integer, (0, combi_1.tok)(tokens_1.WParenRightW)), "FLTP", "NUMC", "INT8");
20
- const commaParam = (0, combi_1.seq)(",", param);
12
+ const commaParam = (0, combi_1.seq)(",", sql_function_input_1.SQLFunctionInput);
21
13
  // note: the function names are not keywords, they are usually in lower case
22
- const abs = (0, combi_1.ver)(version_1.Version.v740sp05, (0, combi_1.seq)((0, combi_1.regex)(/^abs$/i), (0, combi_1.tok)(tokens_1.ParenLeftW), param, (0, combi_1.tok)(tokens_1.WParenRightW)));
23
- const cast = (0, combi_1.ver)(version_1.Version.v750, (0, combi_1.seq)((0, combi_1.regex)(/^cast$/i), (0, combi_1.tok)(tokens_1.ParenLeftW), param, "AS", castTypes, (0, combi_1.tok)(tokens_1.WParenRightW)));
24
- const ceil = (0, combi_1.ver)(version_1.Version.v740sp05, (0, combi_1.seq)((0, combi_1.regex)(/^ceil$/i), (0, combi_1.tok)(tokens_1.ParenLeftW), param, (0, combi_1.tok)(tokens_1.WParenRightW)));
25
- const coalesce = (0, combi_1.ver)(version_1.Version.v740sp05, (0, combi_1.seq)((0, combi_1.regex)(/^coalesce$/i), (0, combi_1.tok)(tokens_1.ParenLeftW), param, commaParam, (0, combi_1.optPrio)(commaParam), (0, combi_1.tok)(tokens_1.WParenRightW)));
26
- const concat = (0, combi_1.ver)(version_1.Version.v750, (0, combi_1.seq)((0, combi_1.regex)(/^concat$/i), (0, combi_1.tok)(tokens_1.ParenLeftW), param, commaParam, (0, combi_1.tok)(tokens_1.WParenRightW)));
27
- const div = (0, combi_1.ver)(version_1.Version.v740sp05, (0, combi_1.seq)((0, combi_1.regex)(/^div$/i), (0, combi_1.tok)(tokens_1.ParenLeftW), param, commaParam, (0, combi_1.tok)(tokens_1.WParenRightW)));
28
- const floor = (0, combi_1.ver)(version_1.Version.v740sp05, (0, combi_1.seq)((0, combi_1.regex)(/^floor$/i), (0, combi_1.tok)(tokens_1.ParenLeftW), param, (0, combi_1.tok)(tokens_1.WParenRightW)));
29
- const length = (0, combi_1.ver)(version_1.Version.v750, (0, combi_1.seq)((0, combi_1.regex)(/^length$/i), (0, combi_1.tok)(tokens_1.ParenLeftW), param, (0, combi_1.tok)(tokens_1.WParenRightW)));
30
- const lower = (0, combi_1.ver)(version_1.Version.v751, (0, combi_1.seq)((0, combi_1.regex)(/^lower$/i), (0, combi_1.tok)(tokens_1.ParenLeftW), param, (0, combi_1.tok)(tokens_1.WParenRightW)));
31
- const mod = (0, combi_1.ver)(version_1.Version.v740sp05, (0, combi_1.seq)((0, combi_1.regex)(/^mod$/i), (0, combi_1.tok)(tokens_1.ParenLeftW), param, commaParam, (0, combi_1.tok)(tokens_1.WParenRightW)));
32
- const replace = (0, combi_1.ver)(version_1.Version.v750, (0, combi_1.seq)((0, combi_1.regex)(/^replace$/i), (0, combi_1.tok)(tokens_1.ParenLeftW), param, commaParam, commaParam, (0, combi_1.tok)(tokens_1.WParenRightW)));
33
- const round = (0, combi_1.ver)(version_1.Version.v750, (0, combi_1.seq)((0, combi_1.regex)(/^round$/i), (0, combi_1.tok)(tokens_1.ParenLeftW), param, commaParam, (0, combi_1.tok)(tokens_1.WParenRightW)));
34
- const upper = (0, combi_1.ver)(version_1.Version.v751, (0, combi_1.seq)((0, combi_1.regex)(/^upper$/i), (0, combi_1.tok)(tokens_1.ParenLeftW), param, (0, combi_1.tok)(tokens_1.WParenRightW)));
14
+ const abs = (0, combi_1.ver)(version_1.Version.v740sp05, (0, combi_1.seq)((0, combi_1.regex)(/^abs$/i), (0, combi_1.tok)(tokens_1.ParenLeftW), sql_function_input_1.SQLFunctionInput, (0, combi_1.tok)(tokens_1.WParenRightW)));
15
+ const cast = (0, combi_1.ver)(version_1.Version.v750, (0, combi_1.seq)((0, combi_1.regex)(/^cast$/i), (0, combi_1.tok)(tokens_1.ParenLeftW), sql_function_input_1.SQLFunctionInput, "AS", castTypes, (0, combi_1.tok)(tokens_1.WParenRightW)));
16
+ const ceil = (0, combi_1.ver)(version_1.Version.v740sp05, (0, combi_1.seq)((0, combi_1.regex)(/^ceil$/i), (0, combi_1.tok)(tokens_1.ParenLeftW), sql_function_input_1.SQLFunctionInput, (0, combi_1.tok)(tokens_1.WParenRightW)));
17
+ const coalesce = (0, combi_1.ver)(version_1.Version.v740sp05, (0, combi_1.seq)((0, combi_1.regex)(/^coalesce$/i), (0, combi_1.tok)(tokens_1.ParenLeftW), sql_function_input_1.SQLFunctionInput, commaParam, (0, combi_1.optPrio)(commaParam), (0, combi_1.tok)(tokens_1.WParenRightW)));
18
+ const concat = (0, combi_1.ver)(version_1.Version.v750, (0, combi_1.seq)((0, combi_1.regex)(/^concat$/i), (0, combi_1.tok)(tokens_1.ParenLeftW), sql_function_input_1.SQLFunctionInput, commaParam, (0, combi_1.tok)(tokens_1.WParenRightW)));
19
+ const div = (0, combi_1.ver)(version_1.Version.v740sp05, (0, combi_1.seq)((0, combi_1.regex)(/^div$/i), (0, combi_1.tok)(tokens_1.ParenLeftW), sql_function_input_1.SQLFunctionInput, commaParam, (0, combi_1.tok)(tokens_1.WParenRightW)));
20
+ const floor = (0, combi_1.ver)(version_1.Version.v740sp05, (0, combi_1.seq)((0, combi_1.regex)(/^floor$/i), (0, combi_1.tok)(tokens_1.ParenLeftW), sql_function_input_1.SQLFunctionInput, (0, combi_1.tok)(tokens_1.WParenRightW)));
21
+ const length = (0, combi_1.ver)(version_1.Version.v750, (0, combi_1.seq)((0, combi_1.regex)(/^length$/i), (0, combi_1.tok)(tokens_1.ParenLeftW), sql_function_input_1.SQLFunctionInput, (0, combi_1.tok)(tokens_1.WParenRightW)));
22
+ const lower = (0, combi_1.ver)(version_1.Version.v751, (0, combi_1.seq)((0, combi_1.regex)(/^lower$/i), (0, combi_1.tok)(tokens_1.ParenLeftW), sql_function_input_1.SQLFunctionInput, (0, combi_1.tok)(tokens_1.WParenRightW)));
23
+ const mod = (0, combi_1.ver)(version_1.Version.v740sp05, (0, combi_1.seq)((0, combi_1.regex)(/^mod$/i), (0, combi_1.tok)(tokens_1.ParenLeftW), sql_function_input_1.SQLFunctionInput, commaParam, (0, combi_1.tok)(tokens_1.WParenRightW)));
24
+ const replace = (0, combi_1.ver)(version_1.Version.v750, (0, combi_1.seq)((0, combi_1.regex)(/^replace$/i), (0, combi_1.tok)(tokens_1.ParenLeftW), sql_function_input_1.SQLFunctionInput, commaParam, commaParam, (0, combi_1.tok)(tokens_1.WParenRightW)));
25
+ const round = (0, combi_1.ver)(version_1.Version.v750, (0, combi_1.seq)((0, combi_1.regex)(/^round$/i), (0, combi_1.tok)(tokens_1.ParenLeftW), sql_function_input_1.SQLFunctionInput, commaParam, (0, combi_1.tok)(tokens_1.WParenRightW)));
26
+ const upper = (0, combi_1.ver)(version_1.Version.v751, (0, combi_1.seq)((0, combi_1.regex)(/^upper$/i), (0, combi_1.tok)(tokens_1.ParenLeftW), sql_function_input_1.SQLFunctionInput, (0, combi_1.tok)(tokens_1.WParenRightW)));
35
27
  const uuid = (0, combi_1.ver)(version_1.Version.v754, (0, combi_1.seq)((0, combi_1.regex)(/^uuid$/i), (0, combi_1.tok)(tokens_1.ParenLeftW), (0, combi_1.tok)(tokens_1.WParenRightW)));
36
28
  return (0, combi_1.altPrio)(uuid, abs, ceil, floor, cast, div, mod, coalesce, concat, replace, length, lower, upper, round);
37
29
  }
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SQLFunctionInput = void 0;
4
+ const constant_1 = require("./constant");
5
+ const version_1 = require("../../../version");
6
+ const tokens_1 = require("../../1_lexer/tokens");
7
+ const combi_1 = require("../combi");
8
+ const sql_alias_field_1 = require("./sql_alias_field");
9
+ const sql_field_name_1 = require("./sql_field_name");
10
+ const simple_source3_1 = require("./simple_source3");
11
+ const source_1 = require("./source");
12
+ const sql_aggregation_1 = require("./sql_aggregation");
13
+ const sql_function_1 = require("./sql_function");
14
+ class SQLFunctionInput extends combi_1.Expression {
15
+ getRunnable() {
16
+ const paren = (0, combi_1.seq)((0, combi_1.tok)(tokens_1.ParenLeftW), source_1.Source, (0, combi_1.tok)(tokens_1.WParenRightW));
17
+ const at = (0, combi_1.ver)(version_1.Version.v740sp05, (0, combi_1.seq)((0, combi_1.tok)(tokens_1.WAt), (0, combi_1.altPrio)(simple_source3_1.SimpleSource3, paren)));
18
+ const param = (0, combi_1.altPrio)(sql_function_1.SQLFunction, sql_aggregation_1.SQLAggregation, sql_field_name_1.SQLFieldName, sql_alias_field_1.SQLAliasField, constant_1.Constant, at);
19
+ const operator = (0, combi_1.altPrio)("+", "-", "*", "/", "&&");
20
+ return (0, combi_1.seq)(param, (0, combi_1.starPrio)((0, combi_1.seq)(operator, param)));
21
+ }
22
+ }
23
+ exports.SQLFunctionInput = SQLFunctionInput;
24
+ //# sourceMappingURL=sql_function_input.js.map
@@ -6,7 +6,8 @@ const expressions_1 = require("../expressions");
6
6
  class DataBegin {
7
7
  getMatcher() {
8
8
  const occurs = (0, combi_1.seq)("OCCURS", expressions_1.Integer);
9
- const structure = (0, combi_1.seq)("BEGIN OF", (0, combi_1.opt)("COMMON PART"), expressions_1.DefinitionName, (0, combi_1.opt)("READ-ONLY"), (0, combi_1.opt)(occurs));
9
+ const common = (0, combi_1.altPrio)((0, combi_1.seq)("COMMON PART", expressions_1.DefinitionName), "COMMON PART");
10
+ const structure = (0, combi_1.seq)("BEGIN OF", (0, combi_1.altPrio)(common, (0, combi_1.seq)(expressions_1.DefinitionName, (0, combi_1.opt)("READ-ONLY"), (0, combi_1.opt)(occurs))));
10
11
  return (0, combi_1.seq)("DATA", structure);
11
12
  }
12
13
  }
@@ -19,17 +19,18 @@ class MethodImplementation {
19
19
  return;
20
20
  }
21
21
  const { method: methodDefinition } = helper.searchMethodName(classDefinition, methodName);
22
- if (methodDefinition === undefined) {
23
- const message = "Method definition \"" + methodName + "\" not found";
24
- input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
25
- return;
26
- }
27
22
  const start = node.getFirstToken().getStart();
28
- if (methodDefinition.isStatic() === false) {
23
+ if ((methodDefinition === null || methodDefinition === void 0 ? void 0 : methodDefinition.isStatic()) === false) {
29
24
  input.scope.push(_scope_type_1.ScopeType.MethodInstance, methodName, start, input.filename);
30
25
  input.scope.addList(classDefinition.getAttributes().getInstance());
31
26
  }
32
27
  input.scope.push(_scope_type_1.ScopeType.Method, methodName, start, input.filename);
28
+ // note: the scope must be pushed before returning
29
+ if (methodDefinition === undefined) {
30
+ const message = "Method definition \"" + methodName + "\" not found";
31
+ input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
32
+ return;
33
+ }
33
34
  input.scope.addReference(methodToken, methodDefinition, _reference_1.ReferenceType.MethodImplementationReference, input.filename);
34
35
  input.scope.addList(methodDefinition.getParameters().getAll());
35
36
  for (const i of helper.findInterfaces(classDefinition)) {
@@ -41,7 +41,7 @@ class ReadTable {
41
41
  if (indexSource) {
42
42
  const indexType = new source_1.Source().runSyntax(indexSource, input);
43
43
  if (new _type_utils_1.TypeUtils(input.scope).isAssignable(indexType, basic_1.IntegerType.get()) === false) {
44
- const message = "READ TABLE, INDEX must be simple";
44
+ const message = "READ TABLE, INDEX must be simple, got " + (indexType === null || indexType === void 0 ? void 0 : indexType.constructor.name);
45
45
  input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
46
46
  return;
47
47
  }
@@ -8,6 +8,7 @@ const Expressions = require("../2_statements/expressions");
8
8
  const flow_graph_1 = require("./flow_graph");
9
9
  const objects_1 = require("../../objects");
10
10
  const selection_events_1 = require("./selection_events");
11
+ const virtual_position_1 = require("../../virtual_position");
11
12
  class StatementFlow {
12
13
  constructor() {
13
14
  this.counter = 0;
@@ -96,6 +97,7 @@ class StatementFlow {
96
97
  var _a;
97
98
  return ((_a = f.findDirectStructure(Structures.Body)) === null || _a === void 0 ? void 0 : _a.getChildren()) || [];
98
99
  }
100
+ // note: it must handle macros and chained statements
99
101
  buildName(statement) {
100
102
  let token = undefined;
101
103
  const colon = statement.getColon();
@@ -110,12 +112,18 @@ class StatementFlow {
110
112
  }
111
113
  }
112
114
  }
115
+ let extra = "";
116
+ const tStart = token === null || token === void 0 ? void 0 : token.getStart();
117
+ if (tStart instanceof virtual_position_1.VirtualPosition) {
118
+ extra += "$" + tStart.vrow;
119
+ extra += "," + tStart.vcol;
120
+ }
113
121
  if (token === undefined) {
114
122
  return "tokenError";
115
123
  }
116
124
  return statement.get().constructor.name +
117
125
  ":" + token.getRow() +
118
- "," + token.getCol();
126
+ "," + token.getCol() + extra;
119
127
  }
120
128
  traverseBody(children, context) {
121
129
  const graph = new flow_graph_1.FlowGraph(this.counter++);
@@ -13,9 +13,19 @@ class CDSDetermineTypes {
13
13
  const components = [];
14
14
  for (const f of (parsedData === null || parsedData === void 0 ? void 0 : parsedData.fields) || []) {
15
15
  if (f.prefix !== "") {
16
- let source = parsedData.sources.find((s) => { var _a; return ((_a = s.as) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === f.prefix.toUpperCase(); });
16
+ const prefixUpper = f.prefix.toUpperCase();
17
+ let source = parsedData.sources.find((s) => { var _a; return ((_a = s.as) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === prefixUpper; });
17
18
  if ((source === null || source === void 0 ? void 0 : source.name) === undefined) {
18
- source = parsedData.sources.find((s) => s.name.toUpperCase() === f.prefix.toUpperCase());
19
+ source = parsedData.sources.find((s) => s.name.toUpperCase() === prefixUpper);
20
+ }
21
+ if ((source === null || source === void 0 ? void 0 : source.name) === undefined
22
+ && (parsedData.associations.find((s) => s.name.toUpperCase() === prefixUpper)
23
+ || parsedData.associations.find((s) => { var _a; return ((_a = s.as) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === prefixUpper; }))) {
24
+ components.push({
25
+ name: f.name,
26
+ type: new basic_1.VoidType("DDLS:association"),
27
+ });
28
+ continue;
19
29
  }
20
30
  if ((source === null || source === void 0 ? void 0 : source.name) === undefined) {
21
31
  components.push({
@@ -6,7 +6,7 @@ const combi_1 = require("../../abap/2_statements/combi");
6
6
  class CDSCast extends combi_1.Expression {
7
7
  getRunnable() {
8
8
  const name = (0, combi_1.seq)(_1.CDSName, (0, combi_1.opt)((0, combi_1.seq)(".", _1.CDSName)));
9
- return (0, combi_1.seq)("CAST", "(", (0, combi_1.alt)(name, _1.CDSFunction, _1.CDSCase, CDSCast, _1.CDSString, _1.CDSArithmetics), "AS", _1.CDSType, (0, combi_1.opt)((0, combi_1.seq)("PRESERVING", "TYPE")), ")");
9
+ return (0, combi_1.seq)("CAST", "(", (0, combi_1.alt)(name, _1.CDSFunction, _1.CDSCase, _1.CDSAggregate, CDSCast, _1.CDSString, _1.CDSArithmetics), "AS", _1.CDSType, (0, combi_1.opt)((0, combi_1.seq)("PRESERVING", "TYPE")), ")");
10
10
  }
11
11
  }
12
12
  exports.CDSCast = CDSCast;
@@ -6,6 +6,7 @@ const _lsp_utils_1 = require("./_lsp_utils");
6
6
  const syntax_1 = require("../abap/5_syntax/syntax");
7
7
  const _abap_object_1 = require("../objects/_abap_object");
8
8
  const dump_scope_1 = require("./dump_scope");
9
+ const virtual_position_1 = require("../virtual_position");
9
10
  class Help {
10
11
  static find(reg, textDocument, position) {
11
12
  const file = _lsp_utils_1.LSPUtils.getABAPFile(reg, textDocument.uri);
@@ -180,13 +181,24 @@ class Help {
180
181
  return ret + "</ul>";
181
182
  }
182
183
  static tokens(file) {
183
- let inner = "<table><tr><td><b>String</b></td><td><b>Type</b></td><td><b>Row</b></td><td><b>Column</b></td></tr>";
184
+ let inner = `<table><tr><td><b>String</b></td><td><b>Type</b></td>
185
+ <td><b>Row</b></td><td><b>Column</b></td>
186
+ <td><b>vRow</b></td><td><b>vColumn</b></td>
187
+ </tr>`;
184
188
  for (const token of file.getTokens()) {
185
- inner = inner + "<tr><td><tt>" +
189
+ const tStart = token.getStart();
190
+ inner += "<tr><td><tt>" +
186
191
  this.escape(token.getStr()) + "</tt></td><td>" +
187
192
  token.constructor.name + "</td><td align=\"right\">" +
188
- token.getRow() + "</td><td align=\"right\">" +
189
- token.getCol() + "</td></tr>";
193
+ tStart.getRow() + "</td><td align=\"right\">" +
194
+ tStart.getCol() + "</td>";
195
+ if (tStart instanceof virtual_position_1.VirtualPosition) {
196
+ inner += `<td>${tStart.vcol}</td><td>${tStart.vrow}</td>`;
197
+ }
198
+ else {
199
+ inner += "<td></td><td></td>";
200
+ }
201
+ inner += "</tr>";
190
202
  }
191
203
  inner = inner + "</table>";
192
204
  return inner;
@@ -67,7 +67,7 @@ class Registry {
67
67
  }
68
68
  static abaplintVersion() {
69
69
  // magic, see build script "version.sh"
70
- return "2.113.39";
70
+ return "2.113.41";
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.39",
3
+ "version": "2.113.41",
4
4
  "description": "abaplint - Core API",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/abaplint.d.ts",