@abaplint/cli 2.119.47 → 2.119.49

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.
Files changed (2) hide show
  1. package/build/cli.js +170 -25
  2. package/package.json +2 -2
package/build/cli.js CHANGED
@@ -2940,7 +2940,7 @@ class ExpandMacros {
2940
2940
  }
2941
2941
  }
2942
2942
  }
2943
- handleMacros(statements, file) {
2943
+ handleMacros(statements, file, seen = new Set()) {
2944
2944
  var _a;
2945
2945
  const result = [];
2946
2946
  let containsUnknown = false;
@@ -2958,13 +2958,20 @@ class ExpandMacros {
2958
2958
  });
2959
2959
  }
2960
2960
  result.push(new statement_node_1.StatementNode(new _statement_1.MacroCall(), statement.getColon()).setChildren(this.tokensToNodes(statement.getTokens())));
2961
- const expanded = this.expandContents(macroName, statement);
2962
- const handled = this.handleMacros(expanded, file);
2963
- for (const e of handled.statements) {
2964
- result.push(e);
2961
+ if (!seen.has(macroName.toUpperCase())) {
2962
+ const expanded = this.expandContents(macroName, statement);
2963
+ const nextSeen = new Set(seen).add(macroName.toUpperCase());
2964
+ const handled = this.handleMacros(expanded, file, nextSeen);
2965
+ for (const e of handled.statements) {
2966
+ result.push(e);
2967
+ }
2968
+ if (handled.containsUnknown === true) {
2969
+ containsUnknown = true;
2970
+ }
2965
2971
  }
2966
- if (handled.containsUnknown === true) {
2967
- containsUnknown = true;
2972
+ else {
2973
+ const node = new statement_node_1.StatementNode(new _statement_1.MacroRecursion(), statement.getColon());
2974
+ result.push(node.setChildren(this.tokensToNodes(statement.getTokens())));
2968
2975
  }
2969
2976
  continue;
2970
2977
  }
@@ -11321,7 +11328,7 @@ exports.StatementParser = StatementParser;
11321
11328
  "use strict";
11322
11329
 
11323
11330
  Object.defineProperty(exports, "__esModule", ({ value: true }));
11324
- exports.NativeSQL = exports.MacroContent = exports.MacroCall = exports.Empty = exports.Comment = exports.Unknown = void 0;
11331
+ exports.NativeSQL = exports.MacroRecursion = exports.MacroContent = exports.MacroCall = exports.Empty = exports.Comment = exports.Unknown = void 0;
11325
11332
  class Unknown {
11326
11333
  getMatcher() {
11327
11334
  throw new Error("Unknown Statement, get_matcher");
@@ -11352,6 +11359,12 @@ class MacroContent {
11352
11359
  }
11353
11360
  }
11354
11361
  exports.MacroContent = MacroContent;
11362
+ class MacroRecursion {
11363
+ getMatcher() {
11364
+ throw new Error("MacroRecursion Statement, get_matcher");
11365
+ }
11366
+ }
11367
+ exports.MacroRecursion = MacroRecursion;
11355
11368
  class NativeSQL {
11356
11369
  getMatcher() {
11357
11370
  throw new Error("NativeSQL Statement, get_matcher");
@@ -20424,7 +20437,7 @@ class SubStatement {
20424
20437
  }
20425
20438
  first() {
20426
20439
  const o = new this.obj();
20427
- if (o instanceof _statement_1.MacroCall || o instanceof _statement_1.NativeSQL) {
20440
+ if (o instanceof _statement_1.MacroCall || o instanceof _statement_1.MacroRecursion || o instanceof _statement_1.NativeSQL) {
20428
20441
  return [""];
20429
20442
  }
20430
20443
  return o.getMatcher().first();
@@ -22634,7 +22647,7 @@ const _statement_1 = __webpack_require__(/*! ../../2_statements/statements/_stat
22634
22647
  class Normal {
22635
22648
  getMatcher() {
22636
22649
  // note that the sequence of alternatives here influences performance
22637
- return (0, _combi_1.alt)((0, _combi_1.sta)(Statements.Move), (0, _combi_1.sta)(Statements.Call), (0, _combi_1.sta)(Statements.Data), (0, _combi_1.sub)(Structures.If), (0, _combi_1.sta)(Statements.Clear), (0, _combi_1.sta)(Statements.FieldSymbol), (0, _combi_1.sta)(Statements.CreateObject), (0, _combi_1.sta)(Statements.CallFunction), (0, _combi_1.sta)(_statement_1.MacroCall), (0, _combi_1.sub)(Structures.LoopAtScreen), (0, _combi_1.sub)(Structures.Loop), (0, _combi_1.sub)(Structures.LoopExtract), (0, _combi_1.sta)(Statements.Append), (0, _combi_1.sub)(Structures.Try), (0, _combi_1.sub)(Structures.OnChange), (0, _combi_1.sta)(Statements.ReadTable), (0, _combi_1.sta)(Statements.Assert), (0, _combi_1.sta)(Statements.Return), (0, _combi_1.sta)(Statements.Select), (0, _combi_1.sta)(Statements.Assign), (0, _combi_1.sta)(Statements.InsertInternal), (0, _combi_1.sta)(Statements.DeleteInternal), (0, _combi_1.sta)(Statements.Concatenate), (0, _combi_1.sub)(Structures.Case), (0, _combi_1.sub)(Structures.CaseType), (0, _combi_1.sub)(Structures.Enhancement), (0, _combi_1.sub)(Structures.EnhancementSection), (0, _combi_1.sta)(Statements.AddCorresponding), (0, _combi_1.sta)(Statements.Add), (0, _combi_1.sta)(Statements.AssignLocalCopy), (0, _combi_1.sta)(Statements.AuthorityCheck), (0, _combi_1.sta)(Statements.Back), (0, _combi_1.sta)(Statements.Break), (0, _combi_1.sta)(Statements.BreakId), (0, _combi_1.sta)(Statements.CallDatabase), (0, _combi_1.sta)(Statements.CallDialog), (0, _combi_1.sta)(Statements.CallKernel), (0, _combi_1.sta)(Statements.CallOLE), (0, _combi_1.sta)(Statements.CallScreen), (0, _combi_1.sta)(Statements.ModifyScreen), (0, _combi_1.sta)(Statements.CallSelectionScreen), (0, _combi_1.sta)(Statements.CallTransaction), (0, _combi_1.sta)(Statements.CallTransformation), (0, _combi_1.sta)(Statements.Check), (0, _combi_1.sta)(Statements.ClassDefinitionLoad), (0, _combi_1.sta)(Statements.CloseCursor), (0, _combi_1.sta)(Statements.CloseDataset), (0, _combi_1.sta)(Statements.Collect), (0, _combi_1.sta)(Statements.Commit), (0, _combi_1.sta)(Statements.Communication), (0, _combi_1.sta)(Statements.Compute), (0, _combi_1.sta)(Statements.CallBadi), (0, _combi_1.sta)(Statements.Condense), (0, _combi_1.sta)(Statements.Constant), (0, _combi_1.sta)(Statements.Contexts), (0, _combi_1.sta)(Statements.Continue), (0, _combi_1.sta)(Statements.ConvertText), (0, _combi_1.sta)(Statements.Convert), (0, _combi_1.sta)(Statements.CreateData), (0, _combi_1.sta)(Statements.CreateOLE), (0, _combi_1.sta)(Statements.DeleteCluster), (0, _combi_1.sta)(Statements.DeleteDatabase), (0, _combi_1.sta)(Statements.DeleteDataset), (0, _combi_1.sta)(Statements.DeleteDynpro), (0, _combi_1.sta)(Statements.DeleteMemory), (0, _combi_1.sta)(Statements.DeleteReport), (0, _combi_1.sta)(Statements.DeleteTextpool), (0, _combi_1.sta)(Statements.Demand), (0, _combi_1.sta)(Statements.Describe), (0, _combi_1.sta)(Statements.Detail), (0, _combi_1.sta)(Statements.Divide), (0, _combi_1.sta)(Statements.EditorCall), (0, _combi_1.sta)(Statements.EnhancementPoint), (0, _combi_1.sta)(Statements.Exit), (0, _combi_1.sta)(Statements.ExportDynpro), (0, _combi_1.sta)(Statements.Export), (0, _combi_1.sta)(Statements.Extract), (0, _combi_1.sta)(Statements.FetchNextCursor), (0, _combi_1.sta)(Statements.FieldGroup), (0, _combi_1.sta)(Statements.Fields), (0, _combi_1.sta)(Statements.Find), (0, _combi_1.sta)(Statements.Format), (0, _combi_1.sta)(Statements.FreeMemory), (0, _combi_1.sta)(Statements.FreeObject), (0, _combi_1.sta)(Statements.Free), (0, _combi_1.sta)(Statements.GenerateDynpro), (0, _combi_1.sta)(Statements.GenerateReport), (0, _combi_1.sta)(Statements.GenerateSubroutine), (0, _combi_1.sta)(Statements.GetBadi), (0, _combi_1.sta)(Statements.GetBit), (0, _combi_1.sta)(Statements.GetCursor), (0, _combi_1.sta)(Statements.GetDataset), (0, _combi_1.sta)(Statements.GetLocale), (0, _combi_1.sta)(Statements.GetParameter), (0, _combi_1.sta)(Statements.GetPFStatus), (0, _combi_1.sta)(Statements.GetProperty), (0, _combi_1.sta)(Statements.GetReference), (0, _combi_1.sta)(Statements.GetRunTime), (0, _combi_1.sta)(Statements.GetTime), (0, _combi_1.sta)(Statements.Hide), (0, _combi_1.sta)(Statements.Nodes), (0, _combi_1.sta)(Statements.ImportDynpro), (0, _combi_1.sta)(Statements.ImportNametab), (0, _combi_1.sta)(Statements.MoveCorresponding), (0, _combi_1.sta)(Statements.Import), (0, _combi_1.sta)(Statements.Infotypes), (0, _combi_1.sta)(Statements.Include), // include does not have to be at top level
22650
+ return (0, _combi_1.alt)((0, _combi_1.sta)(Statements.Move), (0, _combi_1.sta)(Statements.Call), (0, _combi_1.sta)(Statements.Data), (0, _combi_1.sub)(Structures.If), (0, _combi_1.sta)(Statements.Clear), (0, _combi_1.sta)(Statements.FieldSymbol), (0, _combi_1.sta)(Statements.CreateObject), (0, _combi_1.sta)(Statements.CallFunction), (0, _combi_1.sta)(_statement_1.MacroCall), (0, _combi_1.sta)(_statement_1.MacroRecursion), (0, _combi_1.sub)(Structures.LoopAtScreen), (0, _combi_1.sub)(Structures.Loop), (0, _combi_1.sub)(Structures.LoopExtract), (0, _combi_1.sta)(Statements.Append), (0, _combi_1.sub)(Structures.Try), (0, _combi_1.sub)(Structures.OnChange), (0, _combi_1.sta)(Statements.ReadTable), (0, _combi_1.sta)(Statements.Assert), (0, _combi_1.sta)(Statements.Return), (0, _combi_1.sta)(Statements.Select), (0, _combi_1.sta)(Statements.Assign), (0, _combi_1.sta)(Statements.InsertInternal), (0, _combi_1.sta)(Statements.DeleteInternal), (0, _combi_1.sta)(Statements.Concatenate), (0, _combi_1.sub)(Structures.Case), (0, _combi_1.sub)(Structures.CaseType), (0, _combi_1.sub)(Structures.Enhancement), (0, _combi_1.sub)(Structures.EnhancementSection), (0, _combi_1.sta)(Statements.AddCorresponding), (0, _combi_1.sta)(Statements.Add), (0, _combi_1.sta)(Statements.AssignLocalCopy), (0, _combi_1.sta)(Statements.AuthorityCheck), (0, _combi_1.sta)(Statements.Back), (0, _combi_1.sta)(Statements.Break), (0, _combi_1.sta)(Statements.BreakId), (0, _combi_1.sta)(Statements.CallDatabase), (0, _combi_1.sta)(Statements.CallDialog), (0, _combi_1.sta)(Statements.CallKernel), (0, _combi_1.sta)(Statements.CallOLE), (0, _combi_1.sta)(Statements.CallScreen), (0, _combi_1.sta)(Statements.ModifyScreen), (0, _combi_1.sta)(Statements.CallSelectionScreen), (0, _combi_1.sta)(Statements.CallTransaction), (0, _combi_1.sta)(Statements.CallTransformation), (0, _combi_1.sta)(Statements.Check), (0, _combi_1.sta)(Statements.ClassDefinitionLoad), (0, _combi_1.sta)(Statements.CloseCursor), (0, _combi_1.sta)(Statements.CloseDataset), (0, _combi_1.sta)(Statements.Collect), (0, _combi_1.sta)(Statements.Commit), (0, _combi_1.sta)(Statements.Communication), (0, _combi_1.sta)(Statements.Compute), (0, _combi_1.sta)(Statements.CallBadi), (0, _combi_1.sta)(Statements.Condense), (0, _combi_1.sta)(Statements.Constant), (0, _combi_1.sta)(Statements.Contexts), (0, _combi_1.sta)(Statements.Continue), (0, _combi_1.sta)(Statements.ConvertText), (0, _combi_1.sta)(Statements.Convert), (0, _combi_1.sta)(Statements.CreateData), (0, _combi_1.sta)(Statements.CreateOLE), (0, _combi_1.sta)(Statements.DeleteCluster), (0, _combi_1.sta)(Statements.DeleteDatabase), (0, _combi_1.sta)(Statements.DeleteDataset), (0, _combi_1.sta)(Statements.DeleteDynpro), (0, _combi_1.sta)(Statements.DeleteMemory), (0, _combi_1.sta)(Statements.DeleteReport), (0, _combi_1.sta)(Statements.DeleteTextpool), (0, _combi_1.sta)(Statements.Demand), (0, _combi_1.sta)(Statements.Describe), (0, _combi_1.sta)(Statements.Detail), (0, _combi_1.sta)(Statements.Divide), (0, _combi_1.sta)(Statements.EditorCall), (0, _combi_1.sta)(Statements.EnhancementPoint), (0, _combi_1.sta)(Statements.Exit), (0, _combi_1.sta)(Statements.ExportDynpro), (0, _combi_1.sta)(Statements.Export), (0, _combi_1.sta)(Statements.Extract), (0, _combi_1.sta)(Statements.FetchNextCursor), (0, _combi_1.sta)(Statements.FieldGroup), (0, _combi_1.sta)(Statements.Fields), (0, _combi_1.sta)(Statements.Find), (0, _combi_1.sta)(Statements.Format), (0, _combi_1.sta)(Statements.FreeMemory), (0, _combi_1.sta)(Statements.FreeObject), (0, _combi_1.sta)(Statements.Free), (0, _combi_1.sta)(Statements.GenerateDynpro), (0, _combi_1.sta)(Statements.GenerateReport), (0, _combi_1.sta)(Statements.GenerateSubroutine), (0, _combi_1.sta)(Statements.GetBadi), (0, _combi_1.sta)(Statements.GetBit), (0, _combi_1.sta)(Statements.GetCursor), (0, _combi_1.sta)(Statements.GetDataset), (0, _combi_1.sta)(Statements.GetLocale), (0, _combi_1.sta)(Statements.GetParameter), (0, _combi_1.sta)(Statements.GetPFStatus), (0, _combi_1.sta)(Statements.GetProperty), (0, _combi_1.sta)(Statements.GetReference), (0, _combi_1.sta)(Statements.GetRunTime), (0, _combi_1.sta)(Statements.GetTime), (0, _combi_1.sta)(Statements.Hide), (0, _combi_1.sta)(Statements.Nodes), (0, _combi_1.sta)(Statements.ImportDynpro), (0, _combi_1.sta)(Statements.ImportNametab), (0, _combi_1.sta)(Statements.MoveCorresponding), (0, _combi_1.sta)(Statements.Import), (0, _combi_1.sta)(Statements.Infotypes), (0, _combi_1.sta)(Statements.Include), // include does not have to be at top level
22638
22651
  (0, _combi_1.sta)(Statements.InsertDatabase), (0, _combi_1.sta)(Statements.InsertReport), (0, _combi_1.sta)(Statements.InsertTextpool), (0, _combi_1.sta)(Statements.InsertFieldGroup), (0, _combi_1.sta)(Statements.InterfaceLoad), (0, _combi_1.sta)(Statements.Leave), (0, _combi_1.sta)(Statements.LoadReport), (0, _combi_1.sta)(Statements.Local), (0, _combi_1.sta)(Statements.With), (0, _combi_1.sta)(Statements.LogPoint), (0, _combi_1.sta)(Statements.Message), (0, _combi_1.sta)(Statements.MergeDatabase), (0, _combi_1.sta)(Statements.ModifyLine), (0, _combi_1.sta)(Statements.ModifyDatabase), (0, _combi_1.sta)(Statements.ModifyInternal), (0, _combi_1.sta)(Statements.Multiply), (0, _combi_1.sta)(Statements.NewLine), (0, _combi_1.sta)(Statements.NewPage), (0, _combi_1.sta)(Statements.OpenCursor), (0, _combi_1.sta)(Statements.OpenDataset), (0, _combi_1.sta)(Statements.Overlay), (0, _combi_1.sta)(Statements.Pack), (0, _combi_1.sta)(Statements.Perform), (0, _combi_1.sta)(Statements.FormDefinition), (0, _combi_1.sta)(Statements.Position), (0, _combi_1.sta)(Statements.Put), (0, _combi_1.sta)(Statements.PrintControl), (0, _combi_1.sta)(Statements.RaiseEvent), (0, _combi_1.sta)(Statements.RaiseEntityEvent), (0, _combi_1.sta)(Statements.Raise), (0, _combi_1.sta)(Statements.Ranges), (0, _combi_1.sta)(Statements.ReadDataset), (0, _combi_1.sta)(Statements.ReadLine), (0, _combi_1.sta)(Statements.ReadReport), (0, _combi_1.sta)(Statements.ReadTextpool), (0, _combi_1.sta)(Statements.Receive), (0, _combi_1.sta)(Statements.RefreshControl), (0, _combi_1.sta)(Statements.Refresh), (0, _combi_1.sta)(Statements.Reject), (0, _combi_1.sta)(Statements.Replace), (0, _combi_1.sta)(Statements.Reserve), (0, _combi_1.sta)(Statements.Resume), (0, _combi_1.sta)(Statements.Retry), (0, _combi_1.sta)(Statements.Rollback), (0, _combi_1.sta)(Statements.Scan), (0, _combi_1.sta)(Statements.ScrollList), (0, _combi_1.sta)(Statements.Search), (0, _combi_1.sta)(Statements.SetBit), (0, _combi_1.sta)(Statements.SetBlank), (0, _combi_1.sta)(Statements.SetCountry), (0, _combi_1.sta)(Statements.SetCursor), (0, _combi_1.sta)(Statements.SetDataset), (0, _combi_1.sta)(Statements.SetExtendedCheck), (0, _combi_1.sta)(Statements.SetHandler), (0, _combi_1.sta)(Statements.SetLanguage), (0, _combi_1.sta)(Statements.SetLeft), (0, _combi_1.sta)(Statements.SetLocale), (0, _combi_1.sta)(Statements.SetMargin), (0, _combi_1.sta)(Statements.SetParameter), (0, _combi_1.sta)(Statements.SetPFStatus), (0, _combi_1.sta)(Statements.SetProperty), (0, _combi_1.sta)(Statements.SetRunTime), (0, _combi_1.sta)(Statements.SetScreen), (0, _combi_1.sta)(Statements.SetTitlebar), (0, _combi_1.sta)(Statements.SetUserCommand), (0, _combi_1.sta)(Statements.SetUpdateTask), (0, _combi_1.sta)(Statements.Shift), (0, _combi_1.sta)(Statements.Skip), (0, _combi_1.sta)(Statements.SortDataset), (0, _combi_1.sta)(Statements.Sort), (0, _combi_1.sta)(Statements.Static), (0, _combi_1.sta)(Statements.Split), (0, _combi_1.sta)(Statements.Stop), (0, _combi_1.sta)(Statements.Submit), (0, _combi_1.sta)(Statements.Summary), (0, _combi_1.sta)(Statements.SubtractCorresponding), (0, _combi_1.sta)(Statements.Subtract), (0, _combi_1.sta)(Statements.SuppressDialog), (0, _combi_1.sta)(Statements.Supply), (0, _combi_1.sta)(Statements.Sum), (0, _combi_1.sta)(Statements.SyntaxCheck), (0, _combi_1.sta)(Statements.SystemCall), (0, _combi_1.sta)(Statements.Tables), (0, _combi_1.sta)(Statements.Transfer), (0, _combi_1.sta)(Statements.Translate), (0, _combi_1.sta)(Statements.Type), (0, _combi_1.sta)(Statements.TypePools), (0, _combi_1.sta)(Statements.Uline), (0, _combi_1.sta)(Statements.Unassign), (0, _combi_1.sta)(Statements.Unpack), (0, _combi_1.sta)(Statements.UpdateDatabase), (0, _combi_1.sta)(Statements.Wait), (0, _combi_1.sta)(Statements.Window), (0, _combi_1.sta)(Statements.Write), (0, _combi_1.sta)(Statements.CommitEntities), (0, _combi_1.sta)(Statements.GetPermissions), (0, _combi_1.sta)(Statements.SetLocks), (0, _combi_1.sta)(Statements.ModifyEntities), (0, _combi_1.sta)(Statements.ReadEntities), (0, _combi_1.sta)(Statements.RollbackEntities), (0, _combi_1.sta)(Statements.Module), // todo, should be dynpro specific
22639
22652
  (0, _combi_1.sta)(Statements.Field), // todo, should be dynpro specific
22640
22653
  (0, _combi_1.sub)(Structures.Chain), // todo, should be dynpro specific
@@ -26964,8 +26977,8 @@ exports.syntaxIssue = syntaxIssue;
26964
26977
  const issue_1 = __webpack_require__(/*! ../../issue */ "../core/build/src/issue.js");
26965
26978
  const severity_1 = __webpack_require__(/*! ../../severity */ "../core/build/src/severity.js");
26966
26979
  exports.CheckSyntaxKey = "check_syntax";
26967
- function syntaxIssue(input, token, message) {
26968
- return issue_1.Issue.atTokenFilename(input.filename, token, message, exports.CheckSyntaxKey, severity_1.Severity.Error);
26980
+ function syntaxIssue(input, token, message, fix) {
26981
+ return issue_1.Issue.atTokenFilename(input.filename, token, message, exports.CheckSyntaxKey, severity_1.Severity.Error, fix);
26969
26982
  }
26970
26983
  //# sourceMappingURL=_syntax_input.js.map
26971
26984
 
@@ -33225,7 +33238,7 @@ class Select {
33225
33238
  && from.getFirstToken().getStart().isBefore(up.getFirstToken().getStart())
33226
33239
  && up.getFirstToken().getStart().isBefore(intoExpression.getFirstToken().getStart())) {
33227
33240
  const message = `The addition "UP TO n ROWS" must only be placed after the INTO/APPENDING clause.`;
33228
- input.issues.push((0, _syntax_input_1.syntaxIssue)(input, up.getFirstToken(), message));
33241
+ input.issues.push((0, _syntax_input_1.syntaxIssue)(input, up.getFirstToken(), message, this.buildUpToRowsFix(node, input, up, intoExpression)));
33229
33242
  }
33230
33243
  for (const s of up.findDirectExpressions(Expressions.SQLSource)) {
33231
33244
  sql_source_1.SQLSource.runSyntax(s, input);
@@ -33259,6 +33272,25 @@ class Select {
33259
33272
  input.scope.pop(node.getLastToken().getEnd());
33260
33273
  }
33261
33274
  }
33275
+ static buildUpToRowsFix(node, input, up, intoExpression) {
33276
+ const tokens = node.getTokens();
33277
+ const upLast = up.getLastToken();
33278
+ const next = tokens[tokens.findIndex(t => t === upLast) + 1];
33279
+ const deleteEnd = (next === null || next === void 0 ? void 0 : next.getStart()) || upLast.getEnd();
33280
+ const range = { start: up.getFirstToken().getStart(), end: deleteEnd };
33281
+ return {
33282
+ [input.filename]: [
33283
+ {
33284
+ range: { start: intoExpression.getLastToken().getEnd(), end: intoExpression.getLastToken().getEnd() },
33285
+ newText: " " + up.concatTokens(),
33286
+ },
33287
+ {
33288
+ range,
33289
+ newText: "",
33290
+ },
33291
+ ],
33292
+ };
33293
+ }
33262
33294
  // there are multiple rules, but gotta start somewhere
33263
33295
  static isStrictMode(node, input) {
33264
33296
  // strict OpenSQL is always required in the cloud language version
@@ -67911,7 +67943,7 @@ class Registry {
67911
67943
  }
67912
67944
  static abaplintVersion() {
67913
67945
  // magic, see build script "version.js"
67914
- return "2.119.47";
67946
+ return "2.119.49";
67915
67947
  }
67916
67948
  getDDICReferences() {
67917
67949
  return this.ddicReferences;
@@ -81412,6 +81444,7 @@ __exportStar(__webpack_require__(/*! ./no_chained_assignment */ "../core/build/s
81412
81444
  __exportStar(__webpack_require__(/*! ./no_comments_between_methods */ "../core/build/src/rules/no_comments_between_methods.js"), exports);
81413
81445
  __exportStar(__webpack_require__(/*! ./no_external_form_calls */ "../core/build/src/rules/no_external_form_calls.js"), exports);
81414
81446
  __exportStar(__webpack_require__(/*! ./no_inline_in_optional_branches */ "../core/build/src/rules/no_inline_in_optional_branches.js"), exports);
81447
+ __exportStar(__webpack_require__(/*! ./no_macros */ "../core/build/src/rules/no_macros.js"), exports);
81415
81448
  __exportStar(__webpack_require__(/*! ./no_prefixes */ "../core/build/src/rules/no_prefixes.js"), exports);
81416
81449
  __exportStar(__webpack_require__(/*! ./no_public_attributes */ "../core/build/src/rules/no_public_attributes.js"), exports);
81417
81450
  __exportStar(__webpack_require__(/*! ./no_yoda_conditions */ "../core/build/src/rules/no_yoda_conditions.js"), exports);
@@ -85769,6 +85802,98 @@ exports.NoInlineInOptionalBranches = NoInlineInOptionalBranches;
85769
85802
 
85770
85803
  /***/ },
85771
85804
 
85805
+ /***/ "../core/build/src/rules/no_macros.js"
85806
+ /*!********************************************!*\
85807
+ !*** ../core/build/src/rules/no_macros.js ***!
85808
+ \********************************************/
85809
+ (__unused_webpack_module, exports, __webpack_require__) {
85810
+
85811
+ "use strict";
85812
+
85813
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
85814
+ if (k2 === undefined) k2 = k;
85815
+ var desc = Object.getOwnPropertyDescriptor(m, k);
85816
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
85817
+ desc = { enumerable: true, get: function() { return m[k]; } };
85818
+ }
85819
+ Object.defineProperty(o, k2, desc);
85820
+ }) : (function(o, m, k, k2) {
85821
+ if (k2 === undefined) k2 = k;
85822
+ o[k2] = m[k];
85823
+ }));
85824
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
85825
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
85826
+ }) : function(o, v) {
85827
+ o["default"] = v;
85828
+ });
85829
+ var __importStar = (this && this.__importStar) || (function () {
85830
+ var ownKeys = function(o) {
85831
+ ownKeys = Object.getOwnPropertyNames || function (o) {
85832
+ var ar = [];
85833
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
85834
+ return ar;
85835
+ };
85836
+ return ownKeys(o);
85837
+ };
85838
+ return function (mod) {
85839
+ if (mod && mod.__esModule) return mod;
85840
+ var result = {};
85841
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
85842
+ __setModuleDefault(result, mod);
85843
+ return result;
85844
+ };
85845
+ })();
85846
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
85847
+ exports.NoMacros = exports.NoMacrosConf = void 0;
85848
+ const issue_1 = __webpack_require__(/*! ../issue */ "../core/build/src/issue.js");
85849
+ const _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ "../core/build/src/rules/_abap_rule.js");
85850
+ const Statements = __importStar(__webpack_require__(/*! ../abap/2_statements/statements */ "../core/build/src/abap/2_statements/statements/index.js"));
85851
+ const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "../core/build/src/rules/_basic_rule_config.js");
85852
+ const _irule_1 = __webpack_require__(/*! ./_irule */ "../core/build/src/rules/_irule.js");
85853
+ class NoMacrosConf extends _basic_rule_config_1.BasicRuleConfig {
85854
+ }
85855
+ exports.NoMacrosConf = NoMacrosConf;
85856
+ class NoMacros extends _abap_rule_1.ABAPRule {
85857
+ constructor() {
85858
+ super(...arguments);
85859
+ this.conf = new NoMacrosConf();
85860
+ }
85861
+ getMetadata() {
85862
+ return {
85863
+ key: "no_macros",
85864
+ title: "No macros",
85865
+ shortDescription: `Checks that macros are not used`,
85866
+ extendedInformation: `Macros reduce readability and are difficult to debug, use methods or form routines instead.
85867
+
85868
+ https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/abenmacros_guidl.htm`,
85869
+ tags: [_irule_1.RuleTag.SingleFile],
85870
+ badExample: `DEFINE _macro.
85871
+ WRITE 'hello'.
85872
+ END-OF-DEFINITION.`,
85873
+ goodExample: `WRITE 'hello'.`,
85874
+ };
85875
+ }
85876
+ getConfig() {
85877
+ return this.conf;
85878
+ }
85879
+ setConfig(conf) {
85880
+ this.conf = conf;
85881
+ }
85882
+ runParsed(file) {
85883
+ const issues = [];
85884
+ for (const stat of file.getStatements()) {
85885
+ if (stat.get() instanceof Statements.Define) {
85886
+ issues.push(issue_1.Issue.atStatement(file, stat, "Do not define macros", this.getMetadata().key, this.conf.severity));
85887
+ }
85888
+ }
85889
+ return issues;
85890
+ }
85891
+ }
85892
+ exports.NoMacros = NoMacros;
85893
+ //# sourceMappingURL=no_macros.js.map
85894
+
85895
+ /***/ },
85896
+
85772
85897
  /***/ "../core/build/src/rules/no_prefixes.js"
85773
85898
  /*!**********************************************!*\
85774
85899
  !*** ../core/build/src/rules/no_prefixes.js ***!
@@ -87731,19 +87856,23 @@ See recognized syntax at https://syntax.abaplint.org`,
87731
87856
  if (obj instanceof _abap_object_1.ABAPObject) {
87732
87857
  for (const file of obj.getABAPFiles()) {
87733
87858
  for (const statement of file.getStatements()) {
87734
- if (!(statement.get() instanceof _statement_1.Unknown)) {
87735
- continue;
87736
- }
87737
- if (statement.getTokens().length > statement_parser_1.STATEMENT_MAX_TOKENS) {
87738
- const message = "Statement too long, refactor statement";
87739
- const issue = issue_1.Issue.atToken(file, statement.getTokens()[0], message, this.getMetadata().key, this.conf.severity);
87740
- issues.push(issue);
87859
+ if (statement.get() instanceof _statement_1.Unknown) {
87860
+ if (statement.getTokens().length > statement_parser_1.STATEMENT_MAX_TOKENS) {
87861
+ const message = "Statement too long, refactor statement";
87862
+ const issue = issue_1.Issue.atToken(file, statement.getTokens()[0], message, this.getMetadata().key, this.conf.severity);
87863
+ issues.push(issue);
87864
+ }
87865
+ else {
87866
+ const tok = statement.getFirstToken();
87867
+ const message = "Statement does not exist in ABAP " + this.reg.getConfig().getRelease().name + " (or a parser error), \"" + tok.getStr() + "\"";
87868
+ const issue = issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity);
87869
+ issues.push(issue);
87870
+ }
87741
87871
  }
87742
- else {
87872
+ else if (statement.get() instanceof _statement_1.MacroRecursion) {
87743
87873
  const tok = statement.getFirstToken();
87744
- const message = "Statement does not exist in ABAP" + this.reg.getConfig().getRelease().name + "(or a parser error), \"" + tok.getStr() + "\"";
87745
- const issue = issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity);
87746
- issues.push(issue);
87874
+ const message = "Macro recursion detected involving \"" + tok.getStr() + "\"";
87875
+ issues.push(issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity));
87747
87876
  }
87748
87877
  }
87749
87878
  if (this.reg.getConfig().getRelease() === version_1.Release.v700) {
@@ -99014,6 +99143,21 @@ function loadConfig(filename) {
99014
99143
  base: path.dirname(f) === process.cwd() ? "." : path.dirname(f),
99015
99144
  };
99016
99145
  }
99146
+ function formatNullable(value) {
99147
+ return value === null ? "n/a" : value.toString();
99148
+ }
99149
+ function outputSyntaxConfig(config) {
99150
+ const release = config.getRelease();
99151
+ const releaseDetails = [
99152
+ `SAP_BASIS ${formatNullable(release.abap)}`,
99153
+ `kernel ${formatNullable(release.kernel)}`,
99154
+ `on-premise ${formatNullable(release.op)}`,
99155
+ `cloud ${formatNullable(release.cloud)}`,
99156
+ `CE ${formatNullable(release.ce)}`,
99157
+ ].join(", ");
99158
+ process.stderr.write(`ABAP release: ${release.name} (${releaseDetails})\n`);
99159
+ process.stderr.write(`ABAP language version: ${config.getLanguageVersion()}\n`);
99160
+ }
99017
99161
  async function loadDependencies(config, compress, bar, base) {
99018
99162
  let files = [];
99019
99163
  const deps = config.get().dependencies || [];
@@ -99108,6 +99252,7 @@ async function run(arg) {
99108
99252
  let loaded = [];
99109
99253
  let deps = [];
99110
99254
  const { config, base } = loadConfig(arg.configFilename);
99255
+ outputSyntaxConfig(config);
99111
99256
  try {
99112
99257
  if (config.get().global.files === undefined) {
99113
99258
  throw "Error: Update abaplint configuration file to latest format";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/cli",
3
- "version": "2.119.47",
3
+ "version": "2.119.49",
4
4
  "description": "abaplint - Command Line Interface",
5
5
  "funding": "https://github.com/sponsors/larshp",
6
6
  "bin": {
@@ -39,7 +39,7 @@
39
39
  },
40
40
  "homepage": "https://abaplint.org",
41
41
  "devDependencies": {
42
- "@abaplint/core": "^2.119.47",
42
+ "@abaplint/core": "^2.119.49",
43
43
  "@types/chai": "^4.3.20",
44
44
  "@types/minimist": "^1.2.5",
45
45
  "@types/mocha": "^10.0.10",