@dbml/core 5.0.0 → 5.2.0

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 (53) hide show
  1. package/lib/export/DbmlExporter.js +3 -2
  2. package/lib/export/MysqlExporter.js +2 -2
  3. package/lib/export/OracleExporter.js +2 -2
  4. package/lib/export/PostgresExporter.js +2 -2
  5. package/lib/export/SqlServerExporter.js +2 -2
  6. package/lib/model_structure/element.js +1 -3
  7. package/lib/parse/ANTLR/ASTGeneration/AST.js +0 -2
  8. package/lib/parse/ANTLR/ASTGeneration/constants.js +1 -0
  9. package/lib/parse/ANTLR/ASTGeneration/index.js +16 -3
  10. package/lib/parse/ANTLR/ASTGeneration/mssql/MssqlASTGen.js +1 -1
  11. package/lib/parse/ANTLR/ASTGeneration/mssql/README.md +157 -0
  12. package/lib/parse/ANTLR/ASTGeneration/mysql/MySQLASTGen.js +1 -1
  13. package/lib/parse/ANTLR/ASTGeneration/mysql/README.md +157 -0
  14. package/lib/parse/ANTLR/ASTGeneration/oraclesql/OracleSQLASTGen.js +1154 -0
  15. package/lib/parse/ANTLR/ASTGeneration/oraclesql/README.md +157 -0
  16. package/lib/parse/ANTLR/ASTGeneration/postgres/PostgresASTGen.js +2 -3
  17. package/lib/parse/ANTLR/ASTGeneration/postgres/README.md +157 -0
  18. package/lib/parse/ANTLR/ASTGeneration/snowflake/README.md +157 -0
  19. package/lib/parse/ANTLR/ASTGeneration/snowflake/SnowflakeASTGen.js +1 -1
  20. package/lib/parse/ANTLR/parsers/mysql/MySqlLexer.g4 +60 -2
  21. package/lib/parse/ANTLR/parsers/mysql/MySqlLexer.interp +25 -4
  22. package/lib/parse/ANTLR/parsers/mysql/MySqlLexer.js +1235 -1171
  23. package/lib/parse/ANTLR/parsers/mysql/MySqlLexer.tokens +2306 -2300
  24. package/lib/parse/ANTLR/parsers/mysql/MySqlLexerBase.js +52 -0
  25. package/lib/parse/ANTLR/parsers/mysql/MySqlParser.g4 +6 -4
  26. package/lib/parse/ANTLR/parsers/mysql/MySqlParser.interp +15 -3
  27. package/lib/parse/ANTLR/parsers/mysql/MySqlParser.js +2 -2
  28. package/lib/parse/ANTLR/parsers/mysql/MySqlParser.tokens +2306 -2300
  29. package/lib/parse/ANTLR/parsers/mysql/MySqlParserVisitor.js +1 -1
  30. package/lib/parse/ANTLR/parsers/oraclesql/OracleSqlLexer.g4 +2623 -0
  31. package/lib/parse/ANTLR/parsers/oraclesql/OracleSqlLexer.interp +7475 -0
  32. package/lib/parse/ANTLR/parsers/oraclesql/OracleSqlLexer.js +3 -0
  33. package/lib/parse/ANTLR/parsers/oraclesql/OracleSqlLexer.tokens +4934 -0
  34. package/lib/parse/ANTLR/parsers/oraclesql/OracleSqlLexerBase.js +35 -0
  35. package/lib/parse/ANTLR/parsers/oraclesql/OracleSqlParser.g4 +9988 -0
  36. package/lib/parse/ANTLR/parsers/oraclesql/OracleSqlParser.interp +6174 -0
  37. package/lib/parse/ANTLR/parsers/oraclesql/OracleSqlParser.js +3 -0
  38. package/lib/parse/ANTLR/parsers/oraclesql/OracleSqlParser.tokens +4934 -0
  39. package/lib/parse/ANTLR/parsers/oraclesql/OracleSqlParserBase.js +64 -0
  40. package/lib/parse/ANTLR/parsers/oraclesql/OracleSqlParserVisitor.js +8466 -0
  41. package/lib/parse/Parser.js +8 -0
  42. package/lib/parse/buildParser.js +1 -1
  43. package/lib/parse/databaseGenerator.js +10 -7
  44. package/lib/parse/error.js +0 -1
  45. package/lib/parse/mssql/fk_definition/actions.js +1 -1
  46. package/lib/parse/mssql/index.js +0 -1
  47. package/lib/parse/mssql/statements/statement_types/alter_table/actions.js +0 -1
  48. package/lib/parse/mssql/statements/statement_types/alter_table/add/actions.js +0 -2
  49. package/lib/parse/mssql/statements/statement_types/comments/index.js +2 -2
  50. package/lib/parse/mssql/utils.js +0 -1
  51. package/package.json +16 -5
  52. package/types/import/index.d.ts +1 -1
  53. package/types/parse/Parser.d.ts +3 -1
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+
3
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports["default"] = void 0;
8
+ var _antlr = _interopRequireDefault(require("antlr4"));
9
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
10
+ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
11
+ function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
12
+ function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
13
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
14
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
15
+ function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
16
+ function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
17
+ function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
18
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
19
+ function _superPropGet(t, o, e, r) { var p = _get(_getPrototypeOf(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; }
20
+ function _get() { return _get = "undefined" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) { var p = _superPropBase(e, t); if (p) { var n = Object.getOwnPropertyDescriptor(p, t); return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value; } }, _get.apply(null, arguments); }
21
+ function _superPropBase(t, o) { for (; !{}.hasOwnProperty.call(t, o) && null !== (t = _getPrototypeOf(t));); return t; }
22
+ function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
23
+ function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
24
+ function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
25
+ var MySqlLexerBase = exports["default"] = /*#__PURE__*/function (_antlr4$Lexer) {
26
+ function MySqlLexerBase(input) {
27
+ var _this;
28
+ _classCallCheck(this, MySqlLexerBase);
29
+ _this = _callSuper(this, MySqlLexerBase, [input]);
30
+ _this.currentDelimiter = ';';
31
+ return _this;
32
+ }
33
+ _inherits(MySqlLexerBase, _antlr4$Lexer);
34
+ return _createClass(MySqlLexerBase, [{
35
+ key: "setDelimiter",
36
+ value: function setDelimiter(delimiter) {
37
+ this.currentDelimiter = delimiter.trim();
38
+ }
39
+ }, {
40
+ key: "isCurrentDelimiter",
41
+ value: function isCurrentDelimiter(text) {
42
+ return text === this.currentDelimiter;
43
+ }
44
+ }, {
45
+ key: "nextToken",
46
+ value: function nextToken() {
47
+ // See the comment above HIGH_PRIORITY_MODE in the Lexer grammar G4 file
48
+ this.mode(MySqlLexerBase.DEFAULT_MODE); // always start in DEFAULT_MODE, which will automatically switch to high priority mode
49
+ return _superPropGet(MySqlLexerBase, "nextToken", this, 3)([]);
50
+ }
51
+ }]);
52
+ }(_antlr["default"].Lexer);
@@ -43,9 +43,10 @@ root
43
43
  : sqlStatements? (MINUS MINUS)? EOF
44
44
  ;
45
45
 
46
+ // MUST READ: STATEMENT_TERMINATOR is used to detect dynamic DELIMITERs, the original grammar does not have this
46
47
  sqlStatements
47
- : (sqlStatement (MINUS MINUS)? SEMI? | emptyStatement_)* (
48
- sqlStatement ((MINUS MINUS)? SEMI)?
48
+ : (sqlStatement (MINUS MINUS)? (STATEMENT_TERMINATOR | SEMI)? | emptyStatement_)* (
49
+ sqlStatement ((MINUS MINUS)? (STATEMENT_TERMINATOR | SEMI))?
49
50
  | emptyStatement_
50
51
  )
51
52
  ;
@@ -60,8 +61,9 @@ sqlStatement
60
61
  | utilityStatement
61
62
  ;
62
63
 
64
+ // MUST READ: STATEMENT_TERMINATOR is used to detect dynamic DELIMITERs, the original grammar does not have this
63
65
  emptyStatement_
64
- : SEMI
66
+ : STATEMENT_TERMINATOR | SEMI
65
67
  ;
66
68
 
67
69
  ddlStatement
@@ -3491,4 +3493,4 @@ functionNameBase
3491
3493
  | JSON_STORAGE_SIZE
3492
3494
  | JSON_ARRAYAGG
3493
3495
  | JSON_OBJECTAGG
3494
- ;
3496
+ ;