@abaplint/core 2.113.91 → 2.113.93

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.
@@ -6,14 +6,14 @@ const combi_1 = require("../../abap/2_statements/combi");
6
6
  const cds_integer_1 = require("./cds_integer");
7
7
  class CDSArithmetics extends combi_1.Expression {
8
8
  getRunnable() {
9
- const name = (0, combi_1.seq)(_1.CDSName, (0, combi_1.opt)((0, combi_1.seq)(".", _1.CDSName)));
10
- const val = (0, combi_1.alt)(cds_integer_1.CDSInteger, name, _1.CDSFunction, _1.CDSCase, _1.CDSCast, _1.CDSString);
9
+ const name = (0, combi_1.seq)(_1.CDSName, (0, combi_1.optPrio)((0, combi_1.seq)(".", _1.CDSName)));
10
+ const val = (0, combi_1.altPrio)(cds_integer_1.CDSInteger, _1.CDSFunction, _1.CDSCase, _1.CDSCast, _1.CDSString, name);
11
11
  const operator = (0, combi_1.altPrio)("+", "-", "*", "/");
12
12
  const operatorValue = (0, combi_1.seq)(operator, val);
13
- const paren = (0, combi_1.seq)("(", val, (0, combi_1.plus)(operatorValue), ")");
14
- const noParen = (0, combi_1.seq)(val, (0, combi_1.plus)(operatorValue));
13
+ const paren = (0, combi_1.seq)("(", val, (0, combi_1.plusPrio)(operatorValue), ")");
14
+ const noParen = (0, combi_1.seq)(val, (0, combi_1.plusPrio)(operatorValue));
15
15
  // todo: this is pretty bad, it needs a rewrite
16
- return (0, combi_1.altPrio)((0, combi_1.seq)(paren, (0, combi_1.plus)(operatorValue)), paren, noParen);
16
+ return (0, combi_1.altPrio)((0, combi_1.seq)(paren, (0, combi_1.plusPrio)(operatorValue)), paren, noParen);
17
17
  }
18
18
  }
19
19
  exports.CDSArithmetics = CDSArithmetics;
@@ -6,10 +6,10 @@ const combi_1 = require("../../abap/2_statements/combi");
6
6
  class CDSCase extends combi_1.Expression {
7
7
  getRunnable() {
8
8
  const name = (0, combi_1.seq)(_1.CDSName, (0, combi_1.optPrio)((0, combi_1.seq)(".", _1.CDSName)));
9
- const value = (0, combi_1.alt)(name, _1.CDSString, _1.CDSFunction, CDSCase, _1.CDSCast, _1.CDSArithmetics);
10
- const simple = (0, combi_1.seq)("CASE", (0, combi_1.alt)(name, _1.CDSFunction), (0, combi_1.plusPrio)((0, combi_1.seq)("WHEN", value, "THEN", value)), "ELSE", value, "END");
11
- const complex = (0, combi_1.seq)("CASE", (0, combi_1.plusPrio)((0, combi_1.seq)("WHEN", _1.CDSCondition, "THEN", value)), (0, combi_1.opt)((0, combi_1.seq)("ELSE", value)), "END");
12
- return (0, combi_1.altPrio)(simple, complex);
9
+ const value = (0, combi_1.altPrio)(_1.CDSFunction, _1.CDSString, CDSCase, _1.CDSCast, _1.CDSArithmetics, name);
10
+ const simple = (0, combi_1.seq)((0, combi_1.altPrio)(_1.CDSFunction, name), (0, combi_1.plusPrio)((0, combi_1.seq)("WHEN", value, "THEN", value)), "ELSE", value);
11
+ const complex = (0, combi_1.seq)((0, combi_1.plusPrio)((0, combi_1.seq)("WHEN", _1.CDSCondition, "THEN", value)), (0, combi_1.optPrio)((0, combi_1.seq)("ELSE", value)));
12
+ return (0, combi_1.seq)("CASE", (0, combi_1.altPrio)(complex, simple), "END");
13
13
  }
14
14
  }
15
15
  exports.CDSCase = CDSCase;
@@ -5,8 +5,8 @@ const _1 = require(".");
5
5
  const combi_1 = require("../../abap/2_statements/combi");
6
6
  class CDSCast extends combi_1.Expression {
7
7
  getRunnable() {
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, _1.CDSAggregate, CDSCast, _1.CDSString, _1.CDSArithmetics), "AS", _1.CDSType, (0, combi_1.opt)((0, combi_1.seq)("PRESERVING", "TYPE")), ")");
8
+ const name = (0, combi_1.seq)(_1.CDSName, (0, combi_1.optPrio)((0, combi_1.seq)(".", _1.CDSName)));
9
+ return (0, combi_1.seq)("CAST", "(", (0, combi_1.altPrio)(_1.CDSFunction, _1.CDSCase, _1.CDSAggregate, CDSCast, _1.CDSString, _1.CDSArithmetics, name), "AS", _1.CDSType, (0, combi_1.optPrio)((0, combi_1.seq)("PRESERVING", "TYPE")), ")");
10
10
  }
11
11
  }
12
12
  exports.CDSCast = CDSCast;
@@ -9,7 +9,7 @@ class CDSCondition extends combi_1.Expression {
9
9
  const name = (0, combi_1.seq)(_1.CDSName, (0, combi_1.optPrio)((0, combi_1.seq)(".", (0, combi_1.altPrio)(_1.CDSString, _1.CDSName))));
10
10
  const left = (0, combi_1.altPrio)(_1.CDSString, _1.CDSFunction, name);
11
11
  const operators = (0, combi_1.altPrio)("=", (0, combi_1.seq)("!", "="), (0, combi_1.seq)("<", ">"), (0, combi_1.seq)(">", "="), (0, combi_1.seq)("<", "="), "<", ">", "LIKE", "NOT LIKE");
12
- const compare = (0, combi_1.seq)(left, operators, (0, combi_1.alt)(left, cds_integer_1.CDSInteger));
12
+ const compare = (0, combi_1.seq)(left, operators, (0, combi_1.altPrio)(left, cds_integer_1.CDSInteger));
13
13
  const is = (0, combi_1.seq)(left, "IS", (0, combi_1.optPrio)("NOT"), (0, combi_1.altPrio)("INITIAL", "NULL"));
14
14
  const condition = (0, combi_1.seq)((0, combi_1.optPrio)("NOT"), (0, combi_1.altPrio)(compare, is));
15
15
  const paren = (0, combi_1.seq)("(", CDSCondition, ")");
@@ -5,7 +5,7 @@ const combi_1 = require("../../abap/2_statements/combi");
5
5
  class CDSName extends combi_1.Expression {
6
6
  getRunnable() {
7
7
  const pre = (0, combi_1.seq)("/", (0, combi_1.regex)(/^[\w_]+$/), "/");
8
- return (0, combi_1.seq)((0, combi_1.opt)(":"), (0, combi_1.opt)(pre), (0, combi_1.regex)(/^\$?#?[\w_]+$/));
8
+ return (0, combi_1.seq)((0, combi_1.optPrio)(":"), (0, combi_1.optPrio)(pre), (0, combi_1.regex)(/^\$?#?[\w_]+$/));
9
9
  }
10
10
  }
11
11
  exports.CDSName = CDSName;
@@ -8,6 +8,7 @@ const _abap_object_1 = require("../objects/_abap_object");
8
8
  const dump_scope_1 = require("./dump_scope");
9
9
  const virtual_position_1 = require("../virtual_position");
10
10
  const objects_1 = require("../objects");
11
+ const cds_lexer_1 = require("../cds/cds_lexer");
11
12
  class Help {
12
13
  static find(reg, textDocument, position) {
13
14
  const abapFile = _lsp_utils_1.LSPUtils.getABAPFile(reg, textDocument.uri);
@@ -20,11 +21,34 @@ class Help {
20
21
  }
21
22
  const obj = reg.findObjectForFile(file);
22
23
  if (obj instanceof objects_1.DataDefinition) {
23
- return "Data definition, dump todo";
24
+ return this.dumpDDLS(obj, reg);
24
25
  }
25
26
  return "Unhandled object type: " + obj.getType();
26
27
  }
27
28
  /////////////////////////////////////////////////
29
+ static dumpDDLS(obj, reg) {
30
+ let content = "";
31
+ content += "<h1>" + obj.getType() + " " + obj.getName() + "</h1>\n";
32
+ content += obj.getDescription() + "\n";
33
+ content += obj.getParsingIssues().map(i => i.getMessage()).join("<br>\n");
34
+ content += `<hr>\n`;
35
+ const parsed = obj.getParsedData();
36
+ parsed === null || parsed === void 0 ? true : delete parsed.tree;
37
+ content += `<pre>` + JSON.stringify(parsed, null, 2) + "</pre>\n";
38
+ content += `<hr>\n`;
39
+ content += `<pre>` + obj.parseType(reg).toText(0) + "</pre>\n";
40
+ content += `<hr>\n`;
41
+ const file = obj.findSourceFile();
42
+ if (file) {
43
+ const tokens = cds_lexer_1.CDSLexer.run(file);
44
+ content += `<h3>Tokens</h3>\n<pre>\n`;
45
+ for (const t of tokens) {
46
+ content += JSON.stringify(t) + "\n";
47
+ }
48
+ content += `</pre>\n`;
49
+ }
50
+ return content;
51
+ }
28
52
  static dumpABAP(file, reg, textDocument, position) {
29
53
  let content = "";
30
54
  content = `
@@ -67,7 +67,7 @@ class Registry {
67
67
  }
68
68
  static abaplintVersion() {
69
69
  // magic, see build script "version.sh"
70
- return "2.113.91";
70
+ return "2.113.93";
71
71
  }
72
72
  getDDICReferences() {
73
73
  return this.ddicReferences;
@@ -37,7 +37,7 @@ DATA lt_bar TYPE STANDARD TABLE OF ty.`,
37
37
  runParsed(file) {
38
38
  const issues = [];
39
39
  for (const statement of file.getStatements()) {
40
- if (!(statement.get() instanceof Statements.Data)) {
40
+ if (!(statement.get() instanceof Statements.Data || statement.get() instanceof Statements.Type)) {
41
41
  continue;
42
42
  }
43
43
  const tt = statement.findFirstExpression(Expressions.TypeTable);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/core",
3
- "version": "2.113.91",
3
+ "version": "2.113.93",
4
4
  "description": "abaplint - Core API",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/abaplint.d.ts",