@dbml/core 2.3.0 → 2.4.1

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 (52) hide show
  1. package/lib/export/DbmlExporter.js +17 -9
  2. package/lib/export/JsonExporter.js +1 -3
  3. package/lib/export/ModelExporter.js +1 -3
  4. package/lib/export/MysqlExporter.js +50 -42
  5. package/lib/export/PostgresExporter.js +64 -49
  6. package/lib/export/SqlServerExporter.js +52 -46
  7. package/lib/model_structure/database.js +73 -28
  8. package/lib/model_structure/dbState.js +1 -3
  9. package/lib/model_structure/element.js +13 -13
  10. package/lib/model_structure/endpoint.js +18 -14
  11. package/lib/model_structure/enum.js +18 -14
  12. package/lib/model_structure/enumValue.js +16 -12
  13. package/lib/model_structure/field.js +47 -13
  14. package/lib/model_structure/indexColumn.js +16 -12
  15. package/lib/model_structure/indexes.js +18 -14
  16. package/lib/model_structure/ref.js +19 -16
  17. package/lib/model_structure/schema.js +24 -36
  18. package/lib/model_structure/table.js +19 -15
  19. package/lib/model_structure/tableGroup.js +18 -14
  20. package/lib/model_structure/utils.js +5 -0
  21. package/lib/parse/Parser.js +2 -4
  22. package/lib/parse/buildParser.js +1 -3
  23. package/lib/parse/dbml/parser.pegjs +64 -20
  24. package/lib/parse/dbmlParser.js +1401 -899
  25. package/lib/parse/mssql/constraint_definition/actions.js +2 -2
  26. package/lib/parse/mssql/fk_definition/actions.js +10 -3
  27. package/lib/parse/mssql/keyword_parsers.js +12 -2
  28. package/lib/parse/mssql/statements/actions.js +37 -6
  29. package/lib/parse/mssql/statements/index.js +1 -1
  30. package/lib/parse/mssql/statements/statement_types/alter_table/actions.js +11 -5
  31. package/lib/parse/mssql/statements/statement_types/comments/actions.js +57 -0
  32. package/lib/parse/mssql/statements/statement_types/comments/index.js +97 -0
  33. package/lib/parse/mssql/statements/statement_types/create_index/actions.js +6 -1
  34. package/lib/parse/mssql/statements/statement_types/create_table/actions.js +12 -10
  35. package/lib/parse/mssql/statements/statement_types/index.js +4 -1
  36. package/lib/parse/mssql/utils.js +16 -1
  37. package/lib/parse/mysql/parser.pegjs +66 -40
  38. package/lib/parse/mysqlParser.js +534 -359
  39. package/lib/parse/postgresParser.js +15 -13
  40. package/lib/parse/postgresql/Base_rules.pegjs +45 -10
  41. package/lib/parse/postgresql/Commands/Alter_table/Alter_table.pegjs +49 -4
  42. package/lib/parse/postgresql/Commands/Comment.pegjs +18 -6
  43. package/lib/parse/postgresql/Commands/Create_table/Create_table_normal.pegjs +5 -3
  44. package/lib/parse/postgresql/Commands/Create_table/Create_table_of.pegjs +1 -1
  45. package/lib/parse/postgresql/Commands/Create_table/Create_table_partition_of.pegjs +1 -1
  46. package/lib/parse/postgresql/Commands/Create_type/Create_type_enum.pegjs +2 -2
  47. package/lib/parse/postgresql/Commands/Ignore_syntax.pegjs +10 -1
  48. package/lib/parse/postgresql/InitializerUtils.pegjs +14 -2
  49. package/lib/parse/postgresql/Keywords.pegjs +5 -1
  50. package/lib/parse/postgresql/parser.pegjs +22 -8
  51. package/lib/parse/schemarbParser.js +3 -3
  52. package/package.json +2 -2
@@ -5,13 +5,23 @@
5
5
  */
6
6
  "use strict";
7
7
 
8
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }
8
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
9
9
 
10
- function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); }
10
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
11
11
 
12
- function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); }
12
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
13
13
 
14
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } }
14
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
15
+
16
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
17
+
18
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
19
+
20
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
21
+
22
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
23
+
24
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
15
25
 
16
26
  var _ = require("lodash"),
17
27
  pluralize = require("pluralize");
@@ -152,25 +162,12 @@ function peg$parse(input, options) {
152
162
  peg$c3 = peg$literalExpectation("(", false),
153
163
  peg$c4 = ")",
154
164
  peg$c5 = peg$literalExpectation(")", false),
155
- peg$c6 = function peg$c6(name, body) {
165
+ peg$c6 = function peg$c6(table_name, body, options) {
156
166
  var fields = body.fields;
157
- var indexes = body.indexes; // push inline_ref to refs
158
-
167
+ var indexes = body.indexes;
168
+ var bodyRefs = body.refs;
159
169
  fields.forEach(function (field) {
160
- (field.inline_ref || []).forEach(function (ref) {
161
- var endpoints = [{
162
- tableName: name,
163
- fieldNames: [field.name],
164
- relation: "*" //set by default
165
-
166
- }, ref.endpoint];
167
- refs.push({
168
- endpoints: endpoints,
169
- onUpdate: ref.onUpdate,
170
- onDelete: ref.onDelete
171
- });
172
- }); // process enum: rename enum and push to array `enums`
173
-
170
+ // process enum: rename enum and push to array `enums`
174
171
  if (field.type.type_name.toLowerCase() === 'enum') {
175
172
  var enumValuesArr = field.type.args.split(/[\s\r\n\n]*,[\s\r\n\n]*/);
176
173
  var values = [];
@@ -182,22 +179,28 @@ function peg$parse(input, options) {
182
179
  values.push(enumValue);
183
180
  });
184
181
  var _enum = {
185
- name: "".concat(name, "_").concat(field.name, "_enum"),
182
+ name: "".concat(table_name.schemaName ? "".concat(table_name.schemaName, "_") : '').concat(table_name.name, "_").concat(field.name, "_enum"),
186
183
  values: values
187
184
  };
188
185
  enums.push(_enum);
189
186
  field.type.type_name = _enum.name;
190
187
  }
191
- }); // return statement
188
+ });
189
+ bodyRefs.forEach(function (ref) {
190
+ ref.endpoints[0].tableName = table_name.name;
191
+ ref.endpoints[0].schemaName = table_name.schemaName;
192
+ ref.endpoints[0].relation = '*';
193
+ refs.push(ref);
194
+ });
192
195
 
193
- return indexes ? {
194
- name: name,
195
- fields: fields,
196
- indexes: indexes
197
- } : {
198
- name: name,
196
+ var res = _objectSpread(_objectSpread({}, table_name), {}, {
199
197
  fields: fields
200
- };
198
+ });
199
+
200
+ if (options && options.comment) res.note = options.comment;
201
+ if (indexes) res.indexes = indexes; // return statement
202
+
203
+ return res;
201
204
  },
202
205
  peg$c7 = function peg$c7(lines) {
203
206
  // classify lines into pk, fk, unique, index and fields
@@ -263,7 +266,8 @@ function peg$parse(input, options) {
263
266
  });
264
267
  return {
265
268
  fields: fields,
266
- indexes: indexes
269
+ indexes: indexes,
270
+ refs: fks
267
271
  };
268
272
  },
269
273
  peg$c8 = peg$otherExpectation("fields"),
@@ -305,7 +309,8 @@ function peg$parse(input, options) {
305
309
  fieldNames: fields,
306
310
  relation: "*"
307
311
  }, {
308
- tableName: table2,
312
+ tableName: table2.name,
313
+ schemaName: table2.schemaName,
309
314
  fieldNames: fields2,
310
315
  relation: "1"
311
316
  }]
@@ -627,7 +632,8 @@ function peg$parse(input, options) {
627
632
  }));
628
633
 
629
634
  fks.forEach(function (fk) {
630
- fk.endpoints[0].tableName = table;
635
+ fk.endpoints[0].tableName = table.name;
636
+ fk.endpoints[0].schemaName = table.schemaName;
631
637
  });
632
638
  refs.push.apply(refs, _toConsumableArray(fks));
633
639
 
@@ -637,9 +643,7 @@ function peg$parse(input, options) {
637
643
  return o.pks;
638
644
  }));
639
645
 
640
- var tableAlter = tables.find(function (t) {
641
- return t.name === table;
642
- });
646
+ var tableAlter = findTable(table.schemaName, table.name);
643
647
  var index = {
644
648
  columns: pks.map(function (field) {
645
649
  return {
@@ -711,9 +715,7 @@ function peg$parse(input, options) {
711
715
  if (constraint.toLowerCase() === "unique") index.unique = true;
712
716
  var type = typeInOption || indexType;
713
717
  if (type) index.type = type;
714
- var table = tables.find(function (table) {
715
- return table.name === tableName;
716
- });
718
+ var table = findTable(tableName.schemaName, tableName.name);
717
719
 
718
720
  if (table.indexes) {
719
721
  table.indexes.push(index);
@@ -778,56 +780,56 @@ function peg$parse(input, options) {
778
780
  value: type
779
781
  };
780
782
  },
781
- peg$c199 = "insert",
782
- peg$c200 = peg$literalExpectation("INSERT", true),
783
- peg$c201 = ";",
784
- peg$c202 = peg$literalExpectation(";", false),
785
- peg$c203 = peg$anyExpectation(),
786
- peg$c204 = "create",
787
- peg$c205 = peg$literalExpectation("CREATE", true),
788
- peg$c206 = "schema",
789
- peg$c207 = peg$literalExpectation("SCHEMA", true),
790
- peg$c208 = "database",
791
- peg$c209 = peg$literalExpectation("DATABASE", true),
792
- peg$c210 = "use",
793
- peg$c211 = peg$literalExpectation("USE", true),
794
- peg$c212 = "begin",
795
- peg$c213 = peg$literalExpectation("BEGIN", true),
796
- peg$c214 = "commit",
797
- peg$c215 = peg$literalExpectation("COMMIT", true),
798
- peg$c216 = "rollback",
799
- peg$c217 = peg$literalExpectation("ROLLBACK", true),
800
- peg$c218 = function peg$c218(first, rest) {
783
+ peg$c199 = "alter",
784
+ peg$c200 = peg$literalExpectation("ALTER", true),
785
+ peg$c201 = peg$anyExpectation(),
786
+ peg$c202 = "insert",
787
+ peg$c203 = peg$literalExpectation("INSERT", true),
788
+ peg$c204 = ";",
789
+ peg$c205 = peg$literalExpectation(";", false),
790
+ peg$c206 = "create",
791
+ peg$c207 = peg$literalExpectation("CREATE", true),
792
+ peg$c208 = "schema",
793
+ peg$c209 = peg$literalExpectation("SCHEMA", true),
794
+ peg$c210 = "database",
795
+ peg$c211 = peg$literalExpectation("DATABASE", true),
796
+ peg$c212 = "use",
797
+ peg$c213 = peg$literalExpectation("USE", true),
798
+ peg$c214 = "begin",
799
+ peg$c215 = peg$literalExpectation("BEGIN", true),
800
+ peg$c216 = "commit",
801
+ peg$c217 = peg$literalExpectation("COMMIT", true),
802
+ peg$c218 = "rollback",
803
+ peg$c219 = peg$literalExpectation("ROLLBACK", true),
804
+ peg$c220 = function peg$c220(first, rest) {
801
805
  return [first].concat(_toConsumableArray(rest.map(function (n) {
802
806
  return n[2];
803
807
  })));
804
808
  },
805
- peg$c219 = "COMMENT",
806
- peg$c220 = peg$literalExpectation("COMMENT", false),
807
- peg$c221 = "'",
808
- peg$c222 = peg$literalExpectation("'", false),
809
- peg$c223 = /^[^']/,
810
- peg$c224 = peg$classExpectation(["'"], true, false),
811
- peg$c225 = function peg$c225(comment, c) {
809
+ peg$c221 = "COMMENT",
810
+ peg$c222 = peg$literalExpectation("COMMENT", false),
811
+ peg$c223 = "'",
812
+ peg$c224 = peg$literalExpectation("'", false),
813
+ peg$c225 = /^[^']/,
814
+ peg$c226 = peg$classExpectation(["'"], true, false),
815
+ peg$c227 = function peg$c227(comment, c) {
812
816
  return c.join('');
813
817
  },
814
- peg$c226 = "\"",
815
- peg$c227 = peg$literalExpectation("\"", false),
816
- peg$c228 = /^[^"]/,
817
- peg$c229 = peg$classExpectation(["\""], true, false),
818
- peg$c230 = peg$otherExpectation("CREATE TABLE"),
819
- peg$c231 = "temporary",
820
- peg$c232 = peg$literalExpectation("TEMPORARY", true),
821
- peg$c233 = "table",
822
- peg$c234 = peg$literalExpectation("TABLE", true),
823
- peg$c235 = peg$otherExpectation("IF NOT EXISTS"),
824
- peg$c236 = "if",
825
- peg$c237 = peg$literalExpectation("IF", true),
826
- peg$c238 = "exists",
827
- peg$c239 = peg$literalExpectation("EXISTS", true),
828
- peg$c240 = peg$otherExpectation("ALTER TABLE"),
829
- peg$c241 = "alter",
830
- peg$c242 = peg$literalExpectation("ALTER", true),
818
+ peg$c228 = "\"",
819
+ peg$c229 = peg$literalExpectation("\"", false),
820
+ peg$c230 = /^[^"]/,
821
+ peg$c231 = peg$classExpectation(["\""], true, false),
822
+ peg$c232 = peg$otherExpectation("CREATE TABLE"),
823
+ peg$c233 = "temporary",
824
+ peg$c234 = peg$literalExpectation("TEMPORARY", true),
825
+ peg$c235 = "table",
826
+ peg$c236 = peg$literalExpectation("TABLE", true),
827
+ peg$c237 = peg$otherExpectation("IF NOT EXISTS"),
828
+ peg$c238 = "if",
829
+ peg$c239 = peg$literalExpectation("IF", true),
830
+ peg$c240 = "exists",
831
+ peg$c241 = peg$literalExpectation("EXISTS", true),
832
+ peg$c242 = peg$otherExpectation("ALTER TABLE"),
831
833
  peg$c243 = peg$otherExpectation("CREATE INDEX"),
832
834
  peg$c244 = function peg$c244(type) {
833
835
  return type;
@@ -863,19 +865,40 @@ function peg$parse(input, options) {
863
865
  },
864
866
  peg$c268 = /^[^`]/,
865
867
  peg$c269 = peg$classExpectation(["`"], true, false),
866
- peg$c270 = peg$otherExpectation("valid table name"),
867
- peg$c271 = ".",
868
- peg$c272 = peg$literalExpectation(".", false),
869
- peg$c273 = peg$otherExpectation("type"),
870
- peg$c274 = function peg$c274(c) {
868
+ peg$c270 = ".",
869
+ peg$c271 = peg$literalExpectation(".", false),
870
+ peg$c272 = function peg$c272(names) {
871
+ var dbName = null;
872
+ var schemaName = null;
873
+
874
+ if (names && names.length > 0) {
875
+ if (names.length === 1) schemaName = names[0][0];else {
876
+ dbName = names[0][0];
877
+ schemaName = names[1][0];
878
+ }
879
+ }
880
+
881
+ return {
882
+ dbName: dbName,
883
+ schemaName: schemaName
884
+ };
885
+ },
886
+ peg$c273 = peg$otherExpectation("valid table name"),
887
+ peg$c274 = function peg$c274(pathName, name) {
888
+ return _objectSpread(_objectSpread({}, pathName), {}, {
889
+ name: name
890
+ });
891
+ },
892
+ peg$c275 = peg$otherExpectation("type"),
893
+ peg$c276 = function peg$c276(c) {
871
894
  return c;
872
895
  },
873
- peg$c275 = function peg$c275(c) {
896
+ peg$c277 = function peg$c277(c) {
874
897
  return {
875
898
  type_name: c
876
899
  };
877
900
  },
878
- peg$c276 = function peg$c276(type_name, args) {
901
+ peg$c278 = function peg$c278(type_name, args) {
879
902
  args = args ? args[2] : null;
880
903
 
881
904
  if (type_name.toLowerCase() !== 'enum') {
@@ -887,67 +910,67 @@ function peg$parse(input, options) {
887
910
  args: args
888
911
  };
889
912
  },
890
- peg$c277 = peg$otherExpectation("expression"),
891
- peg$c278 = function peg$c278(factors) {
913
+ peg$c279 = peg$otherExpectation("expression"),
914
+ peg$c280 = function peg$c280(factors) {
892
915
  return removeReduntdantSpNewline(_.flattenDeep(factors).join(""));
893
916
  },
894
- peg$c279 = ",",
895
- peg$c280 = peg$literalExpectation(",", false),
896
- peg$c281 = ");",
897
- peg$c282 = peg$literalExpectation(");", false),
898
- peg$c283 = function peg$c283(factors) {
917
+ peg$c281 = ",",
918
+ peg$c282 = peg$literalExpectation(",", false),
919
+ peg$c283 = ");",
920
+ peg$c284 = peg$literalExpectation(");", false),
921
+ peg$c285 = function peg$c285(factors) {
899
922
  return _.flattenDeep(factors).join("");
900
923
  },
901
- peg$c284 = /^[',.a-z0-9_+-`%]/i,
902
- peg$c285 = peg$classExpectation(["'", ",", ".", ["a", "z"], ["0", "9"], "_", ["+", "`"], "%"], false, true),
903
- peg$c286 = /^['.a-z0-9_+\-]/i,
904
- peg$c287 = peg$classExpectation(["'", ".", ["a", "z"], ["0", "9"], "_", "+", "-"], false, true),
905
- peg$c288 = peg$otherExpectation("letter, number or underscore"),
906
- peg$c289 = /^[a-z0-9_]/i,
907
- peg$c290 = peg$classExpectation([["a", "z"], ["0", "9"], "_"], false, true),
908
- peg$c291 = " ",
909
- peg$c292 = peg$literalExpectation(" ", false),
910
- peg$c293 = "`",
911
- peg$c294 = peg$literalExpectation("`", false),
912
- peg$c295 = "\t",
913
- peg$c296 = peg$literalExpectation("\t", false),
914
- peg$c297 = peg$otherExpectation("endline"),
915
- peg$c298 = peg$otherExpectation("newline"),
916
- peg$c299 = "\r\n",
917
- peg$c300 = peg$literalExpectation("\r\n", false),
918
- peg$c301 = "\n",
919
- peg$c302 = peg$literalExpectation("\n", false),
920
- peg$c303 = peg$otherExpectation("space"),
921
- peg$c304 = peg$otherExpectation("comment"),
922
- peg$c305 = "--",
923
- peg$c306 = peg$literalExpectation("--", false),
924
- peg$c307 = /^[^\n]/,
925
- peg$c308 = peg$classExpectation(["\n"], true, false),
926
- peg$c309 = "/*",
927
- peg$c310 = peg$literalExpectation("/*", false),
928
- peg$c311 = "*/",
929
- peg$c312 = peg$literalExpectation("*/", false),
930
- peg$c313 = peg$otherExpectation("string"),
931
- peg$c314 = function peg$c314(chars) {
924
+ peg$c286 = /^[',.a-z0-9_+-`%]/i,
925
+ peg$c287 = peg$classExpectation(["'", ",", ".", ["a", "z"], ["0", "9"], "_", ["+", "`"], "%"], false, true),
926
+ peg$c288 = /^['.a-z0-9_+\-]/i,
927
+ peg$c289 = peg$classExpectation(["'", ".", ["a", "z"], ["0", "9"], "_", "+", "-"], false, true),
928
+ peg$c290 = peg$otherExpectation("letter, number or underscore"),
929
+ peg$c291 = /^[a-z0-9_]/i,
930
+ peg$c292 = peg$classExpectation([["a", "z"], ["0", "9"], "_"], false, true),
931
+ peg$c293 = " ",
932
+ peg$c294 = peg$literalExpectation(" ", false),
933
+ peg$c295 = "`",
934
+ peg$c296 = peg$literalExpectation("`", false),
935
+ peg$c297 = "\t",
936
+ peg$c298 = peg$literalExpectation("\t", false),
937
+ peg$c299 = peg$otherExpectation("endline"),
938
+ peg$c300 = peg$otherExpectation("newline"),
939
+ peg$c301 = "\r\n",
940
+ peg$c302 = peg$literalExpectation("\r\n", false),
941
+ peg$c303 = "\n",
942
+ peg$c304 = peg$literalExpectation("\n", false),
943
+ peg$c305 = peg$otherExpectation("space"),
944
+ peg$c306 = peg$otherExpectation("comment"),
945
+ peg$c307 = "--",
946
+ peg$c308 = peg$literalExpectation("--", false),
947
+ peg$c309 = /^[^\n]/,
948
+ peg$c310 = peg$classExpectation(["\n"], true, false),
949
+ peg$c311 = "/*",
950
+ peg$c312 = peg$literalExpectation("/*", false),
951
+ peg$c313 = "*/",
952
+ peg$c314 = peg$literalExpectation("*/", false),
953
+ peg$c315 = peg$otherExpectation("string"),
954
+ peg$c316 = function peg$c316(chars) {
932
955
  return chars.join('');
933
956
  },
934
- peg$c315 = "\\",
935
- peg$c316 = peg$literalExpectation("\\", false),
936
- peg$c317 = function peg$c317() {
957
+ peg$c317 = "\\",
958
+ peg$c318 = peg$literalExpectation("\\", false),
959
+ peg$c319 = function peg$c319() {
937
960
  return '"';
938
961
  },
939
- peg$c318 = function peg$c318() {
962
+ peg$c320 = function peg$c320() {
940
963
  return text();
941
964
  },
942
- peg$c319 = function peg$c319() {
965
+ peg$c321 = function peg$c321() {
943
966
  return "'";
944
967
  },
945
- peg$c320 = /^[0-9]/,
946
- peg$c321 = peg$classExpectation([["0", "9"]], false, false),
947
- peg$c322 = function peg$c322(left, right) {
968
+ peg$c322 = /^[0-9]/,
969
+ peg$c323 = peg$classExpectation([["0", "9"]], false, false),
970
+ peg$c324 = function peg$c324(left, right) {
948
971
  return parseFloat(left.join("") + "." + right.join(""));
949
972
  },
950
- peg$c323 = function peg$c323(digits) {
973
+ peg$c325 = function peg$c325(digits) {
951
974
  return parseInt(digits.join(""), 10);
952
975
  },
953
976
  peg$currPos = 0,
@@ -1242,7 +1265,7 @@ function peg$parse(input, options) {
1242
1265
 
1243
1266
  if (s15 !== peg$FAILED) {
1244
1267
  peg$savedPos = s0;
1245
- s1 = peg$c6(s4, s8);
1268
+ s1 = peg$c6(s4, s8, s12);
1246
1269
  s0 = s1;
1247
1270
  } else {
1248
1271
  peg$currPos = s0;
@@ -2405,7 +2428,7 @@ function peg$parse(input, options) {
2405
2428
  }
2406
2429
 
2407
2430
  function peg$parseIndexInLineSyntax() {
2408
- var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13;
2431
+ var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14;
2409
2432
  s0 = peg$currPos;
2410
2433
  s1 = peg$parse_();
2411
2434
 
@@ -2433,56 +2456,63 @@ function peg$parse(input, options) {
2433
2456
  }
2434
2457
 
2435
2458
  if (s6 !== peg$FAILED) {
2436
- if (input.charCodeAt(peg$currPos) === 40) {
2437
- s7 = peg$c2;
2438
- peg$currPos++;
2439
- } else {
2440
- s7 = peg$FAILED;
2441
-
2442
- if (peg$silentFails === 0) {
2443
- peg$fail(peg$c3);
2444
- }
2445
- }
2459
+ s7 = peg$parse_();
2446
2460
 
2447
2461
  if (s7 !== peg$FAILED) {
2448
- s8 = peg$parse_();
2462
+ if (input.charCodeAt(peg$currPos) === 40) {
2463
+ s8 = peg$c2;
2464
+ peg$currPos++;
2465
+ } else {
2466
+ s8 = peg$FAILED;
2467
+
2468
+ if (peg$silentFails === 0) {
2469
+ peg$fail(peg$c3);
2470
+ }
2471
+ }
2449
2472
 
2450
2473
  if (s8 !== peg$FAILED) {
2451
- s9 = peg$parseIndexColumnValues();
2474
+ s9 = peg$parse_();
2452
2475
 
2453
2476
  if (s9 !== peg$FAILED) {
2454
- s10 = peg$parse_();
2477
+ s10 = peg$parseIndexColumnValues();
2455
2478
 
2456
2479
  if (s10 !== peg$FAILED) {
2457
- if (input.charCodeAt(peg$currPos) === 41) {
2458
- s11 = peg$c4;
2459
- peg$currPos++;
2460
- } else {
2461
- s11 = peg$FAILED;
2462
-
2463
- if (peg$silentFails === 0) {
2464
- peg$fail(peg$c5);
2465
- }
2466
- }
2480
+ s11 = peg$parse_();
2467
2481
 
2468
2482
  if (s11 !== peg$FAILED) {
2469
- s12 = peg$parseIndexOption();
2483
+ if (input.charCodeAt(peg$currPos) === 41) {
2484
+ s12 = peg$c4;
2485
+ peg$currPos++;
2486
+ } else {
2487
+ s12 = peg$FAILED;
2470
2488
 
2471
- if (s12 === peg$FAILED) {
2472
- s12 = null;
2489
+ if (peg$silentFails === 0) {
2490
+ peg$fail(peg$c5);
2491
+ }
2473
2492
  }
2474
2493
 
2475
2494
  if (s12 !== peg$FAILED) {
2476
- s13 = peg$parseindex_type();
2495
+ s13 = peg$parseIndexOption();
2477
2496
 
2478
2497
  if (s13 === peg$FAILED) {
2479
2498
  s13 = null;
2480
2499
  }
2481
2500
 
2482
2501
  if (s13 !== peg$FAILED) {
2483
- peg$savedPos = s0;
2484
- s1 = peg$c29(s2, s4, s6, s9, s13);
2485
- s0 = s1;
2502
+ s14 = peg$parseindex_type();
2503
+
2504
+ if (s14 === peg$FAILED) {
2505
+ s14 = null;
2506
+ }
2507
+
2508
+ if (s14 !== peg$FAILED) {
2509
+ peg$savedPos = s0;
2510
+ s1 = peg$c29(s2, s4, s6, s10, s14);
2511
+ s0 = s1;
2512
+ } else {
2513
+ peg$currPos = s0;
2514
+ s0 = peg$FAILED;
2515
+ }
2486
2516
  } else {
2487
2517
  peg$currPos = s0;
2488
2518
  s0 = peg$FAILED;
@@ -5230,7 +5260,7 @@ function peg$parse(input, options) {
5230
5260
  s2 = peg$parse_();
5231
5261
 
5232
5262
  if (s2 !== peg$FAILED) {
5233
- s3 = peg$parsename();
5263
+ s3 = peg$parsetable_name();
5234
5264
 
5235
5265
  if (s3 !== peg$FAILED) {
5236
5266
  s4 = peg$parse_();
@@ -5784,7 +5814,7 @@ function peg$parse(input, options) {
5784
5814
  s6 = peg$parse_();
5785
5815
 
5786
5816
  if (s6 !== peg$FAILED) {
5787
- s7 = peg$parsename();
5817
+ s7 = peg$parsetable_name();
5788
5818
 
5789
5819
  if (s7 !== peg$FAILED) {
5790
5820
  s8 = peg$parse_();
@@ -6554,7 +6584,7 @@ function peg$parse(input, options) {
6554
6584
  }
6555
6585
 
6556
6586
  function peg$parseIgnoreSyntax() {
6557
- var s0, s1, s2, s3;
6587
+ var s0, s1, s2, s3, s4, s5, s6, s7;
6558
6588
  s0 = peg$currPos;
6559
6589
  s1 = peg$parseInsertSyntax();
6560
6590
 
@@ -6578,6 +6608,127 @@ function peg$parse(input, options) {
6578
6608
 
6579
6609
  if (s1 === peg$FAILED) {
6580
6610
  s1 = peg$parseRollbackSyntax();
6611
+
6612
+ if (s1 === peg$FAILED) {
6613
+ s1 = peg$currPos;
6614
+
6615
+ if (input.substr(peg$currPos, 5).toLowerCase() === peg$c199) {
6616
+ s2 = input.substr(peg$currPos, 5);
6617
+ peg$currPos += 5;
6618
+ } else {
6619
+ s2 = peg$FAILED;
6620
+
6621
+ if (peg$silentFails === 0) {
6622
+ peg$fail(peg$c200);
6623
+ }
6624
+ }
6625
+
6626
+ if (s2 !== peg$FAILED) {
6627
+ s3 = peg$parse_();
6628
+
6629
+ if (s3 !== peg$FAILED) {
6630
+ s4 = [];
6631
+ s5 = peg$parsecomment();
6632
+
6633
+ if (s5 === peg$FAILED) {
6634
+ s5 = peg$currPos;
6635
+ s6 = peg$currPos;
6636
+ peg$silentFails++;
6637
+ s7 = peg$parsesemicolon();
6638
+ peg$silentFails--;
6639
+
6640
+ if (s7 === peg$FAILED) {
6641
+ s6 = void 0;
6642
+ } else {
6643
+ peg$currPos = s6;
6644
+ s6 = peg$FAILED;
6645
+ }
6646
+
6647
+ if (s6 !== peg$FAILED) {
6648
+ if (input.length > peg$currPos) {
6649
+ s7 = input.charAt(peg$currPos);
6650
+ peg$currPos++;
6651
+ } else {
6652
+ s7 = peg$FAILED;
6653
+
6654
+ if (peg$silentFails === 0) {
6655
+ peg$fail(peg$c201);
6656
+ }
6657
+ }
6658
+
6659
+ if (s7 !== peg$FAILED) {
6660
+ s6 = [s6, s7];
6661
+ s5 = s6;
6662
+ } else {
6663
+ peg$currPos = s5;
6664
+ s5 = peg$FAILED;
6665
+ }
6666
+ } else {
6667
+ peg$currPos = s5;
6668
+ s5 = peg$FAILED;
6669
+ }
6670
+ }
6671
+
6672
+ while (s5 !== peg$FAILED) {
6673
+ s4.push(s5);
6674
+ s5 = peg$parsecomment();
6675
+
6676
+ if (s5 === peg$FAILED) {
6677
+ s5 = peg$currPos;
6678
+ s6 = peg$currPos;
6679
+ peg$silentFails++;
6680
+ s7 = peg$parsesemicolon();
6681
+ peg$silentFails--;
6682
+
6683
+ if (s7 === peg$FAILED) {
6684
+ s6 = void 0;
6685
+ } else {
6686
+ peg$currPos = s6;
6687
+ s6 = peg$FAILED;
6688
+ }
6689
+
6690
+ if (s6 !== peg$FAILED) {
6691
+ if (input.length > peg$currPos) {
6692
+ s7 = input.charAt(peg$currPos);
6693
+ peg$currPos++;
6694
+ } else {
6695
+ s7 = peg$FAILED;
6696
+
6697
+ if (peg$silentFails === 0) {
6698
+ peg$fail(peg$c201);
6699
+ }
6700
+ }
6701
+
6702
+ if (s7 !== peg$FAILED) {
6703
+ s6 = [s6, s7];
6704
+ s5 = s6;
6705
+ } else {
6706
+ peg$currPos = s5;
6707
+ s5 = peg$FAILED;
6708
+ }
6709
+ } else {
6710
+ peg$currPos = s5;
6711
+ s5 = peg$FAILED;
6712
+ }
6713
+ }
6714
+ }
6715
+
6716
+ if (s4 !== peg$FAILED) {
6717
+ s2 = [s2, s3, s4];
6718
+ s1 = s2;
6719
+ } else {
6720
+ peg$currPos = s1;
6721
+ s1 = peg$FAILED;
6722
+ }
6723
+ } else {
6724
+ peg$currPos = s1;
6725
+ s1 = peg$FAILED;
6726
+ }
6727
+ } else {
6728
+ peg$currPos = s1;
6729
+ s1 = peg$FAILED;
6730
+ }
6731
+ }
6581
6732
  }
6582
6733
  }
6583
6734
  }
@@ -6621,14 +6772,14 @@ function peg$parse(input, options) {
6621
6772
  s1 = peg$parse_();
6622
6773
 
6623
6774
  if (s1 !== peg$FAILED) {
6624
- if (input.substr(peg$currPos, 6).toLowerCase() === peg$c199) {
6775
+ if (input.substr(peg$currPos, 6).toLowerCase() === peg$c202) {
6625
6776
  s2 = input.substr(peg$currPos, 6);
6626
6777
  peg$currPos += 6;
6627
6778
  } else {
6628
6779
  s2 = peg$FAILED;
6629
6780
 
6630
6781
  if (peg$silentFails === 0) {
6631
- peg$fail(peg$c200);
6782
+ peg$fail(peg$c203);
6632
6783
  }
6633
6784
  }
6634
6785
 
@@ -6655,13 +6806,13 @@ function peg$parse(input, options) {
6655
6806
 
6656
6807
  if (s8 !== peg$FAILED) {
6657
6808
  if (input.charCodeAt(peg$currPos) === 59) {
6658
- s9 = peg$c201;
6809
+ s9 = peg$c204;
6659
6810
  peg$currPos++;
6660
6811
  } else {
6661
6812
  s9 = peg$FAILED;
6662
6813
 
6663
6814
  if (peg$silentFails === 0) {
6664
- peg$fail(peg$c202);
6815
+ peg$fail(peg$c205);
6665
6816
  }
6666
6817
  }
6667
6818
 
@@ -6698,7 +6849,7 @@ function peg$parse(input, options) {
6698
6849
  s6 = peg$FAILED;
6699
6850
 
6700
6851
  if (peg$silentFails === 0) {
6701
- peg$fail(peg$c203);
6852
+ peg$fail(peg$c201);
6702
6853
  }
6703
6854
  }
6704
6855
 
@@ -6737,13 +6888,13 @@ function peg$parse(input, options) {
6737
6888
 
6738
6889
  if (s8 !== peg$FAILED) {
6739
6890
  if (input.charCodeAt(peg$currPos) === 59) {
6740
- s9 = peg$c201;
6891
+ s9 = peg$c204;
6741
6892
  peg$currPos++;
6742
6893
  } else {
6743
6894
  s9 = peg$FAILED;
6744
6895
 
6745
6896
  if (peg$silentFails === 0) {
6746
- peg$fail(peg$c202);
6897
+ peg$fail(peg$c205);
6747
6898
  }
6748
6899
  }
6749
6900
 
@@ -6780,7 +6931,7 @@ function peg$parse(input, options) {
6780
6931
  s6 = peg$FAILED;
6781
6932
 
6782
6933
  if (peg$silentFails === 0) {
6783
- peg$fail(peg$c203);
6934
+ peg$fail(peg$c201);
6784
6935
  }
6785
6936
  }
6786
6937
 
@@ -6903,14 +7054,14 @@ function peg$parse(input, options) {
6903
7054
  s1 = peg$parse_();
6904
7055
 
6905
7056
  if (s1 !== peg$FAILED) {
6906
- if (input.substr(peg$currPos, 6).toLowerCase() === peg$c204) {
7057
+ if (input.substr(peg$currPos, 6).toLowerCase() === peg$c206) {
6907
7058
  s2 = input.substr(peg$currPos, 6);
6908
7059
  peg$currPos += 6;
6909
7060
  } else {
6910
7061
  s2 = peg$FAILED;
6911
7062
 
6912
7063
  if (peg$silentFails === 0) {
6913
- peg$fail(peg$c205);
7064
+ peg$fail(peg$c207);
6914
7065
  }
6915
7066
  }
6916
7067
 
@@ -6918,26 +7069,26 @@ function peg$parse(input, options) {
6918
7069
  s3 = peg$parse_();
6919
7070
 
6920
7071
  if (s3 !== peg$FAILED) {
6921
- if (input.substr(peg$currPos, 6).toLowerCase() === peg$c206) {
7072
+ if (input.substr(peg$currPos, 6).toLowerCase() === peg$c208) {
6922
7073
  s4 = input.substr(peg$currPos, 6);
6923
7074
  peg$currPos += 6;
6924
7075
  } else {
6925
7076
  s4 = peg$FAILED;
6926
7077
 
6927
7078
  if (peg$silentFails === 0) {
6928
- peg$fail(peg$c207);
7079
+ peg$fail(peg$c209);
6929
7080
  }
6930
7081
  }
6931
7082
 
6932
7083
  if (s4 === peg$FAILED) {
6933
- if (input.substr(peg$currPos, 8).toLowerCase() === peg$c208) {
7084
+ if (input.substr(peg$currPos, 8).toLowerCase() === peg$c210) {
6934
7085
  s4 = input.substr(peg$currPos, 8);
6935
7086
  peg$currPos += 8;
6936
7087
  } else {
6937
7088
  s4 = peg$FAILED;
6938
7089
 
6939
7090
  if (peg$silentFails === 0) {
6940
- peg$fail(peg$c209);
7091
+ peg$fail(peg$c211);
6941
7092
  }
6942
7093
  }
6943
7094
  }
@@ -7069,14 +7220,14 @@ function peg$parse(input, options) {
7069
7220
  s1 = peg$parse_();
7070
7221
 
7071
7222
  if (s1 !== peg$FAILED) {
7072
- if (input.substr(peg$currPos, 3).toLowerCase() === peg$c210) {
7223
+ if (input.substr(peg$currPos, 3).toLowerCase() === peg$c212) {
7073
7224
  s2 = input.substr(peg$currPos, 3);
7074
7225
  peg$currPos += 3;
7075
7226
  } else {
7076
7227
  s2 = peg$FAILED;
7077
7228
 
7078
7229
  if (peg$silentFails === 0) {
7079
- peg$fail(peg$c211);
7230
+ peg$fail(peg$c213);
7080
7231
  }
7081
7232
  }
7082
7233
 
@@ -7134,14 +7285,14 @@ function peg$parse(input, options) {
7134
7285
  s1 = peg$parse_();
7135
7286
 
7136
7287
  if (s1 !== peg$FAILED) {
7137
- if (input.substr(peg$currPos, 5).toLowerCase() === peg$c212) {
7288
+ if (input.substr(peg$currPos, 5).toLowerCase() === peg$c214) {
7138
7289
  s2 = input.substr(peg$currPos, 5);
7139
7290
  peg$currPos += 5;
7140
7291
  } else {
7141
7292
  s2 = peg$FAILED;
7142
7293
 
7143
7294
  if (peg$silentFails === 0) {
7144
- peg$fail(peg$c213);
7295
+ peg$fail(peg$c215);
7145
7296
  }
7146
7297
  }
7147
7298
 
@@ -7199,14 +7350,14 @@ function peg$parse(input, options) {
7199
7350
  s1 = peg$parse_();
7200
7351
 
7201
7352
  if (s1 !== peg$FAILED) {
7202
- if (input.substr(peg$currPos, 6).toLowerCase() === peg$c214) {
7353
+ if (input.substr(peg$currPos, 6).toLowerCase() === peg$c216) {
7203
7354
  s2 = input.substr(peg$currPos, 6);
7204
7355
  peg$currPos += 6;
7205
7356
  } else {
7206
7357
  s2 = peg$FAILED;
7207
7358
 
7208
7359
  if (peg$silentFails === 0) {
7209
- peg$fail(peg$c215);
7360
+ peg$fail(peg$c217);
7210
7361
  }
7211
7362
  }
7212
7363
 
@@ -7264,14 +7415,14 @@ function peg$parse(input, options) {
7264
7415
  s1 = peg$parse_();
7265
7416
 
7266
7417
  if (s1 !== peg$FAILED) {
7267
- if (input.substr(peg$currPos, 8).toLowerCase() === peg$c216) {
7418
+ if (input.substr(peg$currPos, 8).toLowerCase() === peg$c218) {
7268
7419
  s2 = input.substr(peg$currPos, 8);
7269
7420
  peg$currPos += 8;
7270
7421
  } else {
7271
7422
  s2 = peg$FAILED;
7272
7423
 
7273
7424
  if (peg$silentFails === 0) {
7274
- peg$fail(peg$c217);
7425
+ peg$fail(peg$c219);
7275
7426
  }
7276
7427
  }
7277
7428
 
@@ -7385,7 +7536,7 @@ function peg$parse(input, options) {
7385
7536
 
7386
7537
  if (s2 !== peg$FAILED) {
7387
7538
  peg$savedPos = s0;
7388
- s1 = peg$c218(s1, s2);
7539
+ s1 = peg$c220(s1, s2);
7389
7540
  s0 = s1;
7390
7541
  } else {
7391
7542
  peg$currPos = s0;
@@ -7403,14 +7554,14 @@ function peg$parse(input, options) {
7403
7554
  var s0, s1, s2, s3, s4, s5, s6;
7404
7555
  s0 = peg$currPos;
7405
7556
 
7406
- if (input.substr(peg$currPos, 7) === peg$c219) {
7407
- s1 = peg$c219;
7557
+ if (input.substr(peg$currPos, 7) === peg$c221) {
7558
+ s1 = peg$c221;
7408
7559
  peg$currPos += 7;
7409
7560
  } else {
7410
7561
  s1 = peg$FAILED;
7411
7562
 
7412
7563
  if (peg$silentFails === 0) {
7413
- peg$fail(peg$c220);
7564
+ peg$fail(peg$c222);
7414
7565
  }
7415
7566
  }
7416
7567
 
@@ -7452,60 +7603,60 @@ function peg$parse(input, options) {
7452
7603
 
7453
7604
  if (s3 !== peg$FAILED) {
7454
7605
  if (input.charCodeAt(peg$currPos) === 39) {
7455
- s4 = peg$c221;
7606
+ s4 = peg$c223;
7456
7607
  peg$currPos++;
7457
7608
  } else {
7458
7609
  s4 = peg$FAILED;
7459
7610
 
7460
7611
  if (peg$silentFails === 0) {
7461
- peg$fail(peg$c222);
7612
+ peg$fail(peg$c224);
7462
7613
  }
7463
7614
  }
7464
7615
 
7465
7616
  if (s4 !== peg$FAILED) {
7466
7617
  s5 = [];
7467
7618
 
7468
- if (peg$c223.test(input.charAt(peg$currPos))) {
7619
+ if (peg$c225.test(input.charAt(peg$currPos))) {
7469
7620
  s6 = input.charAt(peg$currPos);
7470
7621
  peg$currPos++;
7471
7622
  } else {
7472
7623
  s6 = peg$FAILED;
7473
7624
 
7474
7625
  if (peg$silentFails === 0) {
7475
- peg$fail(peg$c224);
7626
+ peg$fail(peg$c226);
7476
7627
  }
7477
7628
  }
7478
7629
 
7479
7630
  while (s6 !== peg$FAILED) {
7480
7631
  s5.push(s6);
7481
7632
 
7482
- if (peg$c223.test(input.charAt(peg$currPos))) {
7633
+ if (peg$c225.test(input.charAt(peg$currPos))) {
7483
7634
  s6 = input.charAt(peg$currPos);
7484
7635
  peg$currPos++;
7485
7636
  } else {
7486
7637
  s6 = peg$FAILED;
7487
7638
 
7488
7639
  if (peg$silentFails === 0) {
7489
- peg$fail(peg$c224);
7640
+ peg$fail(peg$c226);
7490
7641
  }
7491
7642
  }
7492
7643
  }
7493
7644
 
7494
7645
  if (s5 !== peg$FAILED) {
7495
7646
  if (input.charCodeAt(peg$currPos) === 39) {
7496
- s6 = peg$c221;
7647
+ s6 = peg$c223;
7497
7648
  peg$currPos++;
7498
7649
  } else {
7499
7650
  s6 = peg$FAILED;
7500
7651
 
7501
7652
  if (peg$silentFails === 0) {
7502
- peg$fail(peg$c222);
7653
+ peg$fail(peg$c224);
7503
7654
  }
7504
7655
  }
7505
7656
 
7506
7657
  if (s6 !== peg$FAILED) {
7507
7658
  peg$savedPos = s0;
7508
- s1 = peg$c225(s4, s5);
7659
+ s1 = peg$c227(s4, s5);
7509
7660
  s0 = s1;
7510
7661
  } else {
7511
7662
  peg$currPos = s0;
@@ -7535,14 +7686,14 @@ function peg$parse(input, options) {
7535
7686
  if (s0 === peg$FAILED) {
7536
7687
  s0 = peg$currPos;
7537
7688
 
7538
- if (input.substr(peg$currPos, 7) === peg$c219) {
7539
- s1 = peg$c219;
7689
+ if (input.substr(peg$currPos, 7) === peg$c221) {
7690
+ s1 = peg$c221;
7540
7691
  peg$currPos += 7;
7541
7692
  } else {
7542
7693
  s1 = peg$FAILED;
7543
7694
 
7544
7695
  if (peg$silentFails === 0) {
7545
- peg$fail(peg$c220);
7696
+ peg$fail(peg$c222);
7546
7697
  }
7547
7698
  }
7548
7699
 
@@ -7584,60 +7735,60 @@ function peg$parse(input, options) {
7584
7735
 
7585
7736
  if (s3 !== peg$FAILED) {
7586
7737
  if (input.charCodeAt(peg$currPos) === 34) {
7587
- s4 = peg$c226;
7738
+ s4 = peg$c228;
7588
7739
  peg$currPos++;
7589
7740
  } else {
7590
7741
  s4 = peg$FAILED;
7591
7742
 
7592
7743
  if (peg$silentFails === 0) {
7593
- peg$fail(peg$c227);
7744
+ peg$fail(peg$c229);
7594
7745
  }
7595
7746
  }
7596
7747
 
7597
7748
  if (s4 !== peg$FAILED) {
7598
7749
  s5 = [];
7599
7750
 
7600
- if (peg$c228.test(input.charAt(peg$currPos))) {
7751
+ if (peg$c230.test(input.charAt(peg$currPos))) {
7601
7752
  s6 = input.charAt(peg$currPos);
7602
7753
  peg$currPos++;
7603
7754
  } else {
7604
7755
  s6 = peg$FAILED;
7605
7756
 
7606
7757
  if (peg$silentFails === 0) {
7607
- peg$fail(peg$c229);
7758
+ peg$fail(peg$c231);
7608
7759
  }
7609
7760
  }
7610
7761
 
7611
7762
  while (s6 !== peg$FAILED) {
7612
7763
  s5.push(s6);
7613
7764
 
7614
- if (peg$c228.test(input.charAt(peg$currPos))) {
7765
+ if (peg$c230.test(input.charAt(peg$currPos))) {
7615
7766
  s6 = input.charAt(peg$currPos);
7616
7767
  peg$currPos++;
7617
7768
  } else {
7618
7769
  s6 = peg$FAILED;
7619
7770
 
7620
7771
  if (peg$silentFails === 0) {
7621
- peg$fail(peg$c229);
7772
+ peg$fail(peg$c231);
7622
7773
  }
7623
7774
  }
7624
7775
  }
7625
7776
 
7626
7777
  if (s5 !== peg$FAILED) {
7627
7778
  if (input.charCodeAt(peg$currPos) === 34) {
7628
- s6 = peg$c226;
7779
+ s6 = peg$c228;
7629
7780
  peg$currPos++;
7630
7781
  } else {
7631
7782
  s6 = peg$FAILED;
7632
7783
 
7633
7784
  if (peg$silentFails === 0) {
7634
- peg$fail(peg$c227);
7785
+ peg$fail(peg$c229);
7635
7786
  }
7636
7787
  }
7637
7788
 
7638
7789
  if (s6 !== peg$FAILED) {
7639
7790
  peg$savedPos = s0;
7640
- s1 = peg$c225(s4, s5);
7791
+ s1 = peg$c227(s4, s5);
7641
7792
  s0 = s1;
7642
7793
  } else {
7643
7794
  peg$currPos = s0;
@@ -7673,14 +7824,14 @@ function peg$parse(input, options) {
7673
7824
  peg$silentFails++;
7674
7825
  s0 = peg$currPos;
7675
7826
 
7676
- if (input.substr(peg$currPos, 6).toLowerCase() === peg$c204) {
7827
+ if (input.substr(peg$currPos, 6).toLowerCase() === peg$c206) {
7677
7828
  s1 = input.substr(peg$currPos, 6);
7678
7829
  peg$currPos += 6;
7679
7830
  } else {
7680
7831
  s1 = peg$FAILED;
7681
7832
 
7682
7833
  if (peg$silentFails === 0) {
7683
- peg$fail(peg$c205);
7834
+ peg$fail(peg$c207);
7684
7835
  }
7685
7836
  }
7686
7837
 
@@ -7688,14 +7839,14 @@ function peg$parse(input, options) {
7688
7839
  s2 = peg$parse_();
7689
7840
 
7690
7841
  if (s2 !== peg$FAILED) {
7691
- if (input.substr(peg$currPos, 9).toLowerCase() === peg$c231) {
7842
+ if (input.substr(peg$currPos, 9).toLowerCase() === peg$c233) {
7692
7843
  s3 = input.substr(peg$currPos, 9);
7693
7844
  peg$currPos += 9;
7694
7845
  } else {
7695
7846
  s3 = peg$FAILED;
7696
7847
 
7697
7848
  if (peg$silentFails === 0) {
7698
- peg$fail(peg$c232);
7849
+ peg$fail(peg$c234);
7699
7850
  }
7700
7851
  }
7701
7852
 
@@ -7707,14 +7858,14 @@ function peg$parse(input, options) {
7707
7858
  s4 = peg$parse_();
7708
7859
 
7709
7860
  if (s4 !== peg$FAILED) {
7710
- if (input.substr(peg$currPos, 5).toLowerCase() === peg$c233) {
7861
+ if (input.substr(peg$currPos, 5).toLowerCase() === peg$c235) {
7711
7862
  s5 = input.substr(peg$currPos, 5);
7712
7863
  peg$currPos += 5;
7713
7864
  } else {
7714
7865
  s5 = peg$FAILED;
7715
7866
 
7716
7867
  if (peg$silentFails === 0) {
7717
- peg$fail(peg$c234);
7868
+ peg$fail(peg$c236);
7718
7869
  }
7719
7870
  }
7720
7871
 
@@ -7748,7 +7899,7 @@ function peg$parse(input, options) {
7748
7899
  s1 = peg$FAILED;
7749
7900
 
7750
7901
  if (peg$silentFails === 0) {
7751
- peg$fail(peg$c230);
7902
+ peg$fail(peg$c232);
7752
7903
  }
7753
7904
  }
7754
7905
 
@@ -7760,14 +7911,14 @@ function peg$parse(input, options) {
7760
7911
  peg$silentFails++;
7761
7912
  s0 = peg$currPos;
7762
7913
 
7763
- if (input.substr(peg$currPos, 2).toLowerCase() === peg$c236) {
7914
+ if (input.substr(peg$currPos, 2).toLowerCase() === peg$c238) {
7764
7915
  s1 = input.substr(peg$currPos, 2);
7765
7916
  peg$currPos += 2;
7766
7917
  } else {
7767
7918
  s1 = peg$FAILED;
7768
7919
 
7769
7920
  if (peg$silentFails === 0) {
7770
- peg$fail(peg$c237);
7921
+ peg$fail(peg$c239);
7771
7922
  }
7772
7923
  }
7773
7924
 
@@ -7790,14 +7941,14 @@ function peg$parse(input, options) {
7790
7941
  s4 = peg$parse_();
7791
7942
 
7792
7943
  if (s4 !== peg$FAILED) {
7793
- if (input.substr(peg$currPos, 6).toLowerCase() === peg$c238) {
7944
+ if (input.substr(peg$currPos, 6).toLowerCase() === peg$c240) {
7794
7945
  s5 = input.substr(peg$currPos, 6);
7795
7946
  peg$currPos += 6;
7796
7947
  } else {
7797
7948
  s5 = peg$FAILED;
7798
7949
 
7799
7950
  if (peg$silentFails === 0) {
7800
- peg$fail(peg$c239);
7951
+ peg$fail(peg$c241);
7801
7952
  }
7802
7953
  }
7803
7954
 
@@ -7831,7 +7982,7 @@ function peg$parse(input, options) {
7831
7982
  s1 = peg$FAILED;
7832
7983
 
7833
7984
  if (peg$silentFails === 0) {
7834
- peg$fail(peg$c235);
7985
+ peg$fail(peg$c237);
7835
7986
  }
7836
7987
  }
7837
7988
 
@@ -7843,14 +7994,14 @@ function peg$parse(input, options) {
7843
7994
  peg$silentFails++;
7844
7995
  s0 = peg$currPos;
7845
7996
 
7846
- if (input.substr(peg$currPos, 5).toLowerCase() === peg$c241) {
7997
+ if (input.substr(peg$currPos, 5).toLowerCase() === peg$c199) {
7847
7998
  s1 = input.substr(peg$currPos, 5);
7848
7999
  peg$currPos += 5;
7849
8000
  } else {
7850
8001
  s1 = peg$FAILED;
7851
8002
 
7852
8003
  if (peg$silentFails === 0) {
7853
- peg$fail(peg$c242);
8004
+ peg$fail(peg$c200);
7854
8005
  }
7855
8006
  }
7856
8007
 
@@ -7858,14 +8009,14 @@ function peg$parse(input, options) {
7858
8009
  s2 = peg$parse_();
7859
8010
 
7860
8011
  if (s2 !== peg$FAILED) {
7861
- if (input.substr(peg$currPos, 5).toLowerCase() === peg$c233) {
8012
+ if (input.substr(peg$currPos, 5).toLowerCase() === peg$c235) {
7862
8013
  s3 = input.substr(peg$currPos, 5);
7863
8014
  peg$currPos += 5;
7864
8015
  } else {
7865
8016
  s3 = peg$FAILED;
7866
8017
 
7867
8018
  if (peg$silentFails === 0) {
7868
- peg$fail(peg$c234);
8019
+ peg$fail(peg$c236);
7869
8020
  }
7870
8021
  }
7871
8022
 
@@ -7891,7 +8042,7 @@ function peg$parse(input, options) {
7891
8042
  s1 = peg$FAILED;
7892
8043
 
7893
8044
  if (peg$silentFails === 0) {
7894
- peg$fail(peg$c240);
8045
+ peg$fail(peg$c242);
7895
8046
  }
7896
8047
  }
7897
8048
 
@@ -7903,14 +8054,14 @@ function peg$parse(input, options) {
7903
8054
  peg$silentFails++;
7904
8055
  s0 = peg$currPos;
7905
8056
 
7906
- if (input.substr(peg$currPos, 6).toLowerCase() === peg$c204) {
8057
+ if (input.substr(peg$currPos, 6).toLowerCase() === peg$c206) {
7907
8058
  s1 = input.substr(peg$currPos, 6);
7908
8059
  peg$currPos += 6;
7909
8060
  } else {
7910
8061
  s1 = peg$FAILED;
7911
8062
 
7912
8063
  if (peg$silentFails === 0) {
7913
- peg$fail(peg$c205);
8064
+ peg$fail(peg$c207);
7914
8065
  }
7915
8066
  }
7916
8067
 
@@ -7963,14 +8114,14 @@ function peg$parse(input, options) {
7963
8114
  if (s0 === peg$FAILED) {
7964
8115
  s0 = peg$currPos;
7965
8116
 
7966
- if (input.substr(peg$currPos, 6).toLowerCase() === peg$c204) {
8117
+ if (input.substr(peg$currPos, 6).toLowerCase() === peg$c206) {
7967
8118
  s1 = input.substr(peg$currPos, 6);
7968
8119
  peg$currPos += 6;
7969
8120
  } else {
7970
8121
  s1 = peg$FAILED;
7971
8122
 
7972
8123
  if (peg$silentFails === 0) {
7973
- peg$fail(peg$c205);
8124
+ peg$fail(peg$c207);
7974
8125
  }
7975
8126
  }
7976
8127
 
@@ -8495,9 +8646,8 @@ function peg$parse(input, options) {
8495
8646
  return s0;
8496
8647
  }
8497
8648
 
8498
- function peg$parsetable_name() {
8649
+ function peg$parsepath_name() {
8499
8650
  var s0, s1, s2, s3, s4, s5, s6;
8500
- peg$silentFails++;
8501
8651
  s0 = peg$currPos;
8502
8652
  s1 = [];
8503
8653
  s2 = peg$currPos;
@@ -8508,13 +8658,13 @@ function peg$parse(input, options) {
8508
8658
 
8509
8659
  if (s4 !== peg$FAILED) {
8510
8660
  if (input.charCodeAt(peg$currPos) === 46) {
8511
- s5 = peg$c271;
8661
+ s5 = peg$c270;
8512
8662
  peg$currPos++;
8513
8663
  } else {
8514
8664
  s5 = peg$FAILED;
8515
8665
 
8516
8666
  if (peg$silentFails === 0) {
8517
- peg$fail(peg$c272);
8667
+ peg$fail(peg$c271);
8518
8668
  }
8519
8669
  }
8520
8670
 
@@ -8551,13 +8701,13 @@ function peg$parse(input, options) {
8551
8701
 
8552
8702
  if (s4 !== peg$FAILED) {
8553
8703
  if (input.charCodeAt(peg$currPos) === 46) {
8554
- s5 = peg$c271;
8704
+ s5 = peg$c270;
8555
8705
  peg$currPos++;
8556
8706
  } else {
8557
8707
  s5 = peg$FAILED;
8558
8708
 
8559
8709
  if (peg$silentFails === 0) {
8560
- peg$fail(peg$c272);
8710
+ peg$fail(peg$c271);
8561
8711
  }
8562
8712
  }
8563
8713
 
@@ -8585,12 +8735,27 @@ function peg$parse(input, options) {
8585
8735
  }
8586
8736
  }
8587
8737
 
8738
+ if (s1 !== peg$FAILED) {
8739
+ peg$savedPos = s0;
8740
+ s1 = peg$c272(s1);
8741
+ }
8742
+
8743
+ s0 = s1;
8744
+ return s0;
8745
+ }
8746
+
8747
+ function peg$parsetable_name() {
8748
+ var s0, s1, s2;
8749
+ peg$silentFails++;
8750
+ s0 = peg$currPos;
8751
+ s1 = peg$parsepath_name();
8752
+
8588
8753
  if (s1 !== peg$FAILED) {
8589
8754
  s2 = peg$parsename();
8590
8755
 
8591
8756
  if (s2 !== peg$FAILED) {
8592
8757
  peg$savedPos = s0;
8593
- s1 = peg$c28(s2);
8758
+ s1 = peg$c274(s1, s2);
8594
8759
  s0 = s1;
8595
8760
  } else {
8596
8761
  peg$currPos = s0;
@@ -8607,7 +8772,7 @@ function peg$parse(input, options) {
8607
8772
  s1 = peg$FAILED;
8608
8773
 
8609
8774
  if (peg$silentFails === 0) {
8610
- peg$fail(peg$c270);
8775
+ peg$fail(peg$c273);
8611
8776
  }
8612
8777
  }
8613
8778
 
@@ -8622,7 +8787,7 @@ function peg$parse(input, options) {
8622
8787
 
8623
8788
  if (s1 !== peg$FAILED) {
8624
8789
  peg$savedPos = s0;
8625
- s1 = peg$c274(s1);
8790
+ s1 = peg$c276(s1);
8626
8791
  }
8627
8792
 
8628
8793
  s0 = s1;
@@ -8633,7 +8798,7 @@ function peg$parse(input, options) {
8633
8798
 
8634
8799
  if (s1 !== peg$FAILED) {
8635
8800
  peg$savedPos = s0;
8636
- s1 = peg$c275(s1);
8801
+ s1 = peg$c277(s1);
8637
8802
  }
8638
8803
 
8639
8804
  s0 = s1;
@@ -8645,7 +8810,7 @@ function peg$parse(input, options) {
8645
8810
  s1 = peg$FAILED;
8646
8811
 
8647
8812
  if (peg$silentFails === 0) {
8648
- peg$fail(peg$c273);
8813
+ peg$fail(peg$c275);
8649
8814
  }
8650
8815
  }
8651
8816
 
@@ -8725,7 +8890,7 @@ function peg$parse(input, options) {
8725
8890
 
8726
8891
  if (s3 !== peg$FAILED) {
8727
8892
  peg$savedPos = s0;
8728
- s1 = peg$c276(s1, s3);
8893
+ s1 = peg$c278(s1, s3);
8729
8894
  s0 = s1;
8730
8895
  } else {
8731
8896
  peg$currPos = s0;
@@ -8757,7 +8922,7 @@ function peg$parse(input, options) {
8757
8922
 
8758
8923
  if (s1 !== peg$FAILED) {
8759
8924
  peg$savedPos = s0;
8760
- s1 = peg$c278(s1);
8925
+ s1 = peg$c280(s1);
8761
8926
  }
8762
8927
 
8763
8928
  s0 = s1;
@@ -8767,7 +8932,7 @@ function peg$parse(input, options) {
8767
8932
  s1 = peg$FAILED;
8768
8933
 
8769
8934
  if (peg$silentFails === 0) {
8770
- peg$fail(peg$c277);
8935
+ peg$fail(peg$c279);
8771
8936
  }
8772
8937
  }
8773
8938
 
@@ -8910,25 +9075,25 @@ function peg$parse(input, options) {
8910
9075
 
8911
9076
  if (s4 === peg$FAILED) {
8912
9077
  if (input.charCodeAt(peg$currPos) === 44) {
8913
- s4 = peg$c279;
9078
+ s4 = peg$c281;
8914
9079
  peg$currPos++;
8915
9080
  } else {
8916
9081
  s4 = peg$FAILED;
8917
9082
 
8918
9083
  if (peg$silentFails === 0) {
8919
- peg$fail(peg$c280);
9084
+ peg$fail(peg$c282);
8920
9085
  }
8921
9086
  }
8922
9087
 
8923
9088
  if (s4 === peg$FAILED) {
8924
- if (input.substr(peg$currPos, 2) === peg$c281) {
8925
- s4 = peg$c281;
9089
+ if (input.substr(peg$currPos, 2) === peg$c283) {
9090
+ s4 = peg$c283;
8926
9091
  peg$currPos += 2;
8927
9092
  } else {
8928
9093
  s4 = peg$FAILED;
8929
9094
 
8930
9095
  if (peg$silentFails === 0) {
8931
- peg$fail(peg$c282);
9096
+ peg$fail(peg$c284);
8932
9097
  }
8933
9098
  }
8934
9099
 
@@ -8937,14 +9102,14 @@ function peg$parse(input, options) {
8937
9102
  s5 = peg$parseendline();
8938
9103
 
8939
9104
  if (s5 !== peg$FAILED) {
8940
- if (input.substr(peg$currPos, 2) === peg$c281) {
8941
- s6 = peg$c281;
9105
+ if (input.substr(peg$currPos, 2) === peg$c283) {
9106
+ s6 = peg$c283;
8942
9107
  peg$currPos += 2;
8943
9108
  } else {
8944
9109
  s6 = peg$FAILED;
8945
9110
 
8946
9111
  if (peg$silentFails === 0) {
8947
- peg$fail(peg$c282);
9112
+ peg$fail(peg$c284);
8948
9113
  }
8949
9114
  }
8950
9115
 
@@ -9009,7 +9174,7 @@ function peg$parse(input, options) {
9009
9174
  s4 = peg$FAILED;
9010
9175
 
9011
9176
  if (peg$silentFails === 0) {
9012
- peg$fail(peg$c203);
9177
+ peg$fail(peg$c201);
9013
9178
  }
9014
9179
  }
9015
9180
 
@@ -9039,7 +9204,7 @@ function peg$parse(input, options) {
9039
9204
 
9040
9205
  if (s1 !== peg$FAILED) {
9041
9206
  peg$savedPos = s0;
9042
- s1 = peg$c283(s1);
9207
+ s1 = peg$c285(s1);
9043
9208
  }
9044
9209
 
9045
9210
  s0 = s1;
@@ -9049,14 +9214,14 @@ function peg$parse(input, options) {
9049
9214
  function peg$parseexprChar() {
9050
9215
  var s0;
9051
9216
 
9052
- if (peg$c284.test(input.charAt(peg$currPos))) {
9217
+ if (peg$c286.test(input.charAt(peg$currPos))) {
9053
9218
  s0 = input.charAt(peg$currPos);
9054
9219
  peg$currPos++;
9055
9220
  } else {
9056
9221
  s0 = peg$FAILED;
9057
9222
 
9058
9223
  if (peg$silentFails === 0) {
9059
- peg$fail(peg$c285);
9224
+ peg$fail(peg$c287);
9060
9225
  }
9061
9226
  }
9062
9227
 
@@ -9078,14 +9243,14 @@ function peg$parse(input, options) {
9078
9243
  function peg$parseexprCharNoCommaSpace() {
9079
9244
  var s0;
9080
9245
 
9081
- if (peg$c286.test(input.charAt(peg$currPos))) {
9246
+ if (peg$c288.test(input.charAt(peg$currPos))) {
9082
9247
  s0 = input.charAt(peg$currPos);
9083
9248
  peg$currPos++;
9084
9249
  } else {
9085
9250
  s0 = peg$FAILED;
9086
9251
 
9087
9252
  if (peg$silentFails === 0) {
9088
- peg$fail(peg$c287);
9253
+ peg$fail(peg$c289);
9089
9254
  }
9090
9255
  }
9091
9256
 
@@ -9096,14 +9261,14 @@ function peg$parse(input, options) {
9096
9261
  var s0, s1;
9097
9262
  peg$silentFails++;
9098
9263
 
9099
- if (peg$c289.test(input.charAt(peg$currPos))) {
9264
+ if (peg$c291.test(input.charAt(peg$currPos))) {
9100
9265
  s0 = input.charAt(peg$currPos);
9101
9266
  peg$currPos++;
9102
9267
  } else {
9103
9268
  s0 = peg$FAILED;
9104
9269
 
9105
9270
  if (peg$silentFails === 0) {
9106
- peg$fail(peg$c290);
9271
+ peg$fail(peg$c292);
9107
9272
  }
9108
9273
  }
9109
9274
 
@@ -9113,7 +9278,7 @@ function peg$parse(input, options) {
9113
9278
  s1 = peg$FAILED;
9114
9279
 
9115
9280
  if (peg$silentFails === 0) {
9116
- peg$fail(peg$c288);
9281
+ peg$fail(peg$c290);
9117
9282
  }
9118
9283
  }
9119
9284
 
@@ -9124,13 +9289,13 @@ function peg$parse(input, options) {
9124
9289
  var s0;
9125
9290
 
9126
9291
  if (input.charCodeAt(peg$currPos) === 32) {
9127
- s0 = peg$c291;
9292
+ s0 = peg$c293;
9128
9293
  peg$currPos++;
9129
9294
  } else {
9130
9295
  s0 = peg$FAILED;
9131
9296
 
9132
9297
  if (peg$silentFails === 0) {
9133
- peg$fail(peg$c292);
9298
+ peg$fail(peg$c294);
9134
9299
  }
9135
9300
  }
9136
9301
 
@@ -9141,25 +9306,25 @@ function peg$parse(input, options) {
9141
9306
  var s0;
9142
9307
 
9143
9308
  if (input.charCodeAt(peg$currPos) === 96) {
9144
- s0 = peg$c293;
9309
+ s0 = peg$c295;
9145
9310
  peg$currPos++;
9146
9311
  } else {
9147
9312
  s0 = peg$FAILED;
9148
9313
 
9149
9314
  if (peg$silentFails === 0) {
9150
- peg$fail(peg$c294);
9315
+ peg$fail(peg$c296);
9151
9316
  }
9152
9317
  }
9153
9318
 
9154
9319
  if (s0 === peg$FAILED) {
9155
9320
  if (input.charCodeAt(peg$currPos) === 34) {
9156
- s0 = peg$c226;
9321
+ s0 = peg$c228;
9157
9322
  peg$currPos++;
9158
9323
  } else {
9159
9324
  s0 = peg$FAILED;
9160
9325
 
9161
9326
  if (peg$silentFails === 0) {
9162
- peg$fail(peg$c227);
9327
+ peg$fail(peg$c229);
9163
9328
  }
9164
9329
  }
9165
9330
  }
@@ -9171,13 +9336,13 @@ function peg$parse(input, options) {
9171
9336
  var s0;
9172
9337
 
9173
9338
  if (input.charCodeAt(peg$currPos) === 44) {
9174
- s0 = peg$c279;
9339
+ s0 = peg$c281;
9175
9340
  peg$currPos++;
9176
9341
  } else {
9177
9342
  s0 = peg$FAILED;
9178
9343
 
9179
9344
  if (peg$silentFails === 0) {
9180
- peg$fail(peg$c280);
9345
+ peg$fail(peg$c282);
9181
9346
  }
9182
9347
  }
9183
9348
 
@@ -9188,13 +9353,13 @@ function peg$parse(input, options) {
9188
9353
  var s0;
9189
9354
 
9190
9355
  if (input.charCodeAt(peg$currPos) === 9) {
9191
- s0 = peg$c295;
9356
+ s0 = peg$c297;
9192
9357
  peg$currPos++;
9193
9358
  } else {
9194
9359
  s0 = peg$FAILED;
9195
9360
 
9196
9361
  if (peg$silentFails === 0) {
9197
- peg$fail(peg$c296);
9362
+ peg$fail(peg$c298);
9198
9363
  }
9199
9364
  }
9200
9365
 
@@ -9205,13 +9370,13 @@ function peg$parse(input, options) {
9205
9370
  var s0;
9206
9371
 
9207
9372
  if (input.charCodeAt(peg$currPos) === 59) {
9208
- s0 = peg$c201;
9373
+ s0 = peg$c204;
9209
9374
  peg$currPos++;
9210
9375
  } else {
9211
9376
  s0 = peg$FAILED;
9212
9377
 
9213
9378
  if (peg$silentFails === 0) {
9214
- peg$fail(peg$c202);
9379
+ peg$fail(peg$c205);
9215
9380
  }
9216
9381
  }
9217
9382
 
@@ -9251,7 +9416,7 @@ function peg$parse(input, options) {
9251
9416
  s1 = peg$FAILED;
9252
9417
 
9253
9418
  if (peg$silentFails === 0) {
9254
- peg$fail(peg$c297);
9419
+ peg$fail(peg$c299);
9255
9420
  }
9256
9421
  }
9257
9422
 
@@ -9262,26 +9427,26 @@ function peg$parse(input, options) {
9262
9427
  var s0, s1;
9263
9428
  peg$silentFails++;
9264
9429
 
9265
- if (input.substr(peg$currPos, 2) === peg$c299) {
9266
- s0 = peg$c299;
9430
+ if (input.substr(peg$currPos, 2) === peg$c301) {
9431
+ s0 = peg$c301;
9267
9432
  peg$currPos += 2;
9268
9433
  } else {
9269
9434
  s0 = peg$FAILED;
9270
9435
 
9271
9436
  if (peg$silentFails === 0) {
9272
- peg$fail(peg$c300);
9437
+ peg$fail(peg$c302);
9273
9438
  }
9274
9439
  }
9275
9440
 
9276
9441
  if (s0 === peg$FAILED) {
9277
9442
  if (input.charCodeAt(peg$currPos) === 10) {
9278
- s0 = peg$c301;
9443
+ s0 = peg$c303;
9279
9444
  peg$currPos++;
9280
9445
  } else {
9281
9446
  s0 = peg$FAILED;
9282
9447
 
9283
9448
  if (peg$silentFails === 0) {
9284
- peg$fail(peg$c302);
9449
+ peg$fail(peg$c304);
9285
9450
  }
9286
9451
  }
9287
9452
  }
@@ -9292,7 +9457,7 @@ function peg$parse(input, options) {
9292
9457
  s1 = peg$FAILED;
9293
9458
 
9294
9459
  if (peg$silentFails === 0) {
9295
- peg$fail(peg$c298);
9460
+ peg$fail(peg$c300);
9296
9461
  }
9297
9462
  }
9298
9463
 
@@ -9340,7 +9505,7 @@ function peg$parse(input, options) {
9340
9505
  s1 = peg$FAILED;
9341
9506
 
9342
9507
  if (peg$silentFails === 0) {
9343
- peg$fail(peg$c303);
9508
+ peg$fail(peg$c305);
9344
9509
  }
9345
9510
  }
9346
9511
 
@@ -9392,7 +9557,7 @@ function peg$parse(input, options) {
9392
9557
  s1 = peg$FAILED;
9393
9558
 
9394
9559
  if (peg$silentFails === 0) {
9395
- peg$fail(peg$c303);
9560
+ peg$fail(peg$c305);
9396
9561
  }
9397
9562
  }
9398
9563
 
@@ -9404,42 +9569,42 @@ function peg$parse(input, options) {
9404
9569
  peg$silentFails++;
9405
9570
  s0 = peg$currPos;
9406
9571
 
9407
- if (input.substr(peg$currPos, 2) === peg$c305) {
9408
- s1 = peg$c305;
9572
+ if (input.substr(peg$currPos, 2) === peg$c307) {
9573
+ s1 = peg$c307;
9409
9574
  peg$currPos += 2;
9410
9575
  } else {
9411
9576
  s1 = peg$FAILED;
9412
9577
 
9413
9578
  if (peg$silentFails === 0) {
9414
- peg$fail(peg$c306);
9579
+ peg$fail(peg$c308);
9415
9580
  }
9416
9581
  }
9417
9582
 
9418
9583
  if (s1 !== peg$FAILED) {
9419
9584
  s2 = [];
9420
9585
 
9421
- if (peg$c307.test(input.charAt(peg$currPos))) {
9586
+ if (peg$c309.test(input.charAt(peg$currPos))) {
9422
9587
  s3 = input.charAt(peg$currPos);
9423
9588
  peg$currPos++;
9424
9589
  } else {
9425
9590
  s3 = peg$FAILED;
9426
9591
 
9427
9592
  if (peg$silentFails === 0) {
9428
- peg$fail(peg$c308);
9593
+ peg$fail(peg$c310);
9429
9594
  }
9430
9595
  }
9431
9596
 
9432
9597
  while (s3 !== peg$FAILED) {
9433
9598
  s2.push(s3);
9434
9599
 
9435
- if (peg$c307.test(input.charAt(peg$currPos))) {
9600
+ if (peg$c309.test(input.charAt(peg$currPos))) {
9436
9601
  s3 = input.charAt(peg$currPos);
9437
9602
  peg$currPos++;
9438
9603
  } else {
9439
9604
  s3 = peg$FAILED;
9440
9605
 
9441
9606
  if (peg$silentFails === 0) {
9442
- peg$fail(peg$c308);
9607
+ peg$fail(peg$c310);
9443
9608
  }
9444
9609
  }
9445
9610
  }
@@ -9459,14 +9624,14 @@ function peg$parse(input, options) {
9459
9624
  if (s0 === peg$FAILED) {
9460
9625
  s0 = peg$currPos;
9461
9626
 
9462
- if (input.substr(peg$currPos, 2) === peg$c309) {
9463
- s1 = peg$c309;
9627
+ if (input.substr(peg$currPos, 2) === peg$c311) {
9628
+ s1 = peg$c311;
9464
9629
  peg$currPos += 2;
9465
9630
  } else {
9466
9631
  s1 = peg$FAILED;
9467
9632
 
9468
9633
  if (peg$silentFails === 0) {
9469
- peg$fail(peg$c310);
9634
+ peg$fail(peg$c312);
9470
9635
  }
9471
9636
  }
9472
9637
 
@@ -9476,14 +9641,14 @@ function peg$parse(input, options) {
9476
9641
  s4 = peg$currPos;
9477
9642
  peg$silentFails++;
9478
9643
 
9479
- if (input.substr(peg$currPos, 2) === peg$c311) {
9480
- s5 = peg$c311;
9644
+ if (input.substr(peg$currPos, 2) === peg$c313) {
9645
+ s5 = peg$c313;
9481
9646
  peg$currPos += 2;
9482
9647
  } else {
9483
9648
  s5 = peg$FAILED;
9484
9649
 
9485
9650
  if (peg$silentFails === 0) {
9486
- peg$fail(peg$c312);
9651
+ peg$fail(peg$c314);
9487
9652
  }
9488
9653
  }
9489
9654
 
@@ -9504,7 +9669,7 @@ function peg$parse(input, options) {
9504
9669
  s5 = peg$FAILED;
9505
9670
 
9506
9671
  if (peg$silentFails === 0) {
9507
- peg$fail(peg$c203);
9672
+ peg$fail(peg$c201);
9508
9673
  }
9509
9674
  }
9510
9675
 
@@ -9526,14 +9691,14 @@ function peg$parse(input, options) {
9526
9691
  s4 = peg$currPos;
9527
9692
  peg$silentFails++;
9528
9693
 
9529
- if (input.substr(peg$currPos, 2) === peg$c311) {
9530
- s5 = peg$c311;
9694
+ if (input.substr(peg$currPos, 2) === peg$c313) {
9695
+ s5 = peg$c313;
9531
9696
  peg$currPos += 2;
9532
9697
  } else {
9533
9698
  s5 = peg$FAILED;
9534
9699
 
9535
9700
  if (peg$silentFails === 0) {
9536
- peg$fail(peg$c312);
9701
+ peg$fail(peg$c314);
9537
9702
  }
9538
9703
  }
9539
9704
 
@@ -9554,7 +9719,7 @@ function peg$parse(input, options) {
9554
9719
  s5 = peg$FAILED;
9555
9720
 
9556
9721
  if (peg$silentFails === 0) {
9557
- peg$fail(peg$c203);
9722
+ peg$fail(peg$c201);
9558
9723
  }
9559
9724
  }
9560
9725
 
@@ -9572,14 +9737,14 @@ function peg$parse(input, options) {
9572
9737
  }
9573
9738
 
9574
9739
  if (s2 !== peg$FAILED) {
9575
- if (input.substr(peg$currPos, 2) === peg$c311) {
9576
- s3 = peg$c311;
9740
+ if (input.substr(peg$currPos, 2) === peg$c313) {
9741
+ s3 = peg$c313;
9577
9742
  peg$currPos += 2;
9578
9743
  } else {
9579
9744
  s3 = peg$FAILED;
9580
9745
 
9581
9746
  if (peg$silentFails === 0) {
9582
- peg$fail(peg$c312);
9747
+ peg$fail(peg$c314);
9583
9748
  }
9584
9749
  }
9585
9750
 
@@ -9617,7 +9782,7 @@ function peg$parse(input, options) {
9617
9782
  s1 = peg$FAILED;
9618
9783
 
9619
9784
  if (peg$silentFails === 0) {
9620
- peg$fail(peg$c304);
9785
+ peg$fail(peg$c306);
9621
9786
  }
9622
9787
  }
9623
9788
 
@@ -9630,13 +9795,13 @@ function peg$parse(input, options) {
9630
9795
  s0 = peg$currPos;
9631
9796
 
9632
9797
  if (input.charCodeAt(peg$currPos) === 34) {
9633
- s1 = peg$c226;
9798
+ s1 = peg$c228;
9634
9799
  peg$currPos++;
9635
9800
  } else {
9636
9801
  s1 = peg$FAILED;
9637
9802
 
9638
9803
  if (peg$silentFails === 0) {
9639
- peg$fail(peg$c227);
9804
+ peg$fail(peg$c229);
9640
9805
  }
9641
9806
  }
9642
9807
 
@@ -9651,19 +9816,19 @@ function peg$parse(input, options) {
9651
9816
 
9652
9817
  if (s2 !== peg$FAILED) {
9653
9818
  if (input.charCodeAt(peg$currPos) === 34) {
9654
- s3 = peg$c226;
9819
+ s3 = peg$c228;
9655
9820
  peg$currPos++;
9656
9821
  } else {
9657
9822
  s3 = peg$FAILED;
9658
9823
 
9659
9824
  if (peg$silentFails === 0) {
9660
- peg$fail(peg$c227);
9825
+ peg$fail(peg$c229);
9661
9826
  }
9662
9827
  }
9663
9828
 
9664
9829
  if (s3 !== peg$FAILED) {
9665
9830
  peg$savedPos = s0;
9666
- s1 = peg$c314(s2);
9831
+ s1 = peg$c316(s2);
9667
9832
  s0 = s1;
9668
9833
  } else {
9669
9834
  peg$currPos = s0;
@@ -9682,13 +9847,13 @@ function peg$parse(input, options) {
9682
9847
  s0 = peg$currPos;
9683
9848
 
9684
9849
  if (input.charCodeAt(peg$currPos) === 39) {
9685
- s1 = peg$c221;
9850
+ s1 = peg$c223;
9686
9851
  peg$currPos++;
9687
9852
  } else {
9688
9853
  s1 = peg$FAILED;
9689
9854
 
9690
9855
  if (peg$silentFails === 0) {
9691
- peg$fail(peg$c222);
9856
+ peg$fail(peg$c224);
9692
9857
  }
9693
9858
  }
9694
9859
 
@@ -9703,19 +9868,19 @@ function peg$parse(input, options) {
9703
9868
 
9704
9869
  if (s2 !== peg$FAILED) {
9705
9870
  if (input.charCodeAt(peg$currPos) === 39) {
9706
- s3 = peg$c221;
9871
+ s3 = peg$c223;
9707
9872
  peg$currPos++;
9708
9873
  } else {
9709
9874
  s3 = peg$FAILED;
9710
9875
 
9711
9876
  if (peg$silentFails === 0) {
9712
- peg$fail(peg$c222);
9877
+ peg$fail(peg$c224);
9713
9878
  }
9714
9879
  }
9715
9880
 
9716
9881
  if (s3 !== peg$FAILED) {
9717
9882
  peg$savedPos = s0;
9718
- s1 = peg$c314(s2);
9883
+ s1 = peg$c316(s2);
9719
9884
  s0 = s1;
9720
9885
  } else {
9721
9886
  peg$currPos = s0;
@@ -9737,7 +9902,7 @@ function peg$parse(input, options) {
9737
9902
  s1 = peg$FAILED;
9738
9903
 
9739
9904
  if (peg$silentFails === 0) {
9740
- peg$fail(peg$c313);
9905
+ peg$fail(peg$c315);
9741
9906
  }
9742
9907
  }
9743
9908
 
@@ -9749,31 +9914,31 @@ function peg$parse(input, options) {
9749
9914
  s0 = peg$currPos;
9750
9915
 
9751
9916
  if (input.charCodeAt(peg$currPos) === 92) {
9752
- s1 = peg$c315;
9917
+ s1 = peg$c317;
9753
9918
  peg$currPos++;
9754
9919
  } else {
9755
9920
  s1 = peg$FAILED;
9756
9921
 
9757
9922
  if (peg$silentFails === 0) {
9758
- peg$fail(peg$c316);
9923
+ peg$fail(peg$c318);
9759
9924
  }
9760
9925
  }
9761
9926
 
9762
9927
  if (s1 !== peg$FAILED) {
9763
9928
  if (input.charCodeAt(peg$currPos) === 34) {
9764
- s2 = peg$c226;
9929
+ s2 = peg$c228;
9765
9930
  peg$currPos++;
9766
9931
  } else {
9767
9932
  s2 = peg$FAILED;
9768
9933
 
9769
9934
  if (peg$silentFails === 0) {
9770
- peg$fail(peg$c227);
9935
+ peg$fail(peg$c229);
9771
9936
  }
9772
9937
  }
9773
9938
 
9774
9939
  if (s2 !== peg$FAILED) {
9775
9940
  peg$savedPos = s0;
9776
- s1 = peg$c317();
9941
+ s1 = peg$c319();
9777
9942
  s0 = s1;
9778
9943
  } else {
9779
9944
  peg$currPos = s0;
@@ -9790,13 +9955,13 @@ function peg$parse(input, options) {
9790
9955
  peg$silentFails++;
9791
9956
 
9792
9957
  if (input.charCodeAt(peg$currPos) === 34) {
9793
- s2 = peg$c226;
9958
+ s2 = peg$c228;
9794
9959
  peg$currPos++;
9795
9960
  } else {
9796
9961
  s2 = peg$FAILED;
9797
9962
 
9798
9963
  if (peg$silentFails === 0) {
9799
- peg$fail(peg$c227);
9964
+ peg$fail(peg$c229);
9800
9965
  }
9801
9966
  }
9802
9967
 
@@ -9814,7 +9979,7 @@ function peg$parse(input, options) {
9814
9979
 
9815
9980
  if (s2 !== peg$FAILED) {
9816
9981
  peg$savedPos = s0;
9817
- s1 = peg$c318();
9982
+ s1 = peg$c320();
9818
9983
  s0 = s1;
9819
9984
  } else {
9820
9985
  peg$currPos = s0;
@@ -9834,31 +9999,31 @@ function peg$parse(input, options) {
9834
9999
  s0 = peg$currPos;
9835
10000
 
9836
10001
  if (input.charCodeAt(peg$currPos) === 92) {
9837
- s1 = peg$c315;
10002
+ s1 = peg$c317;
9838
10003
  peg$currPos++;
9839
10004
  } else {
9840
10005
  s1 = peg$FAILED;
9841
10006
 
9842
10007
  if (peg$silentFails === 0) {
9843
- peg$fail(peg$c316);
10008
+ peg$fail(peg$c318);
9844
10009
  }
9845
10010
  }
9846
10011
 
9847
10012
  if (s1 !== peg$FAILED) {
9848
10013
  if (input.charCodeAt(peg$currPos) === 39) {
9849
- s2 = peg$c221;
10014
+ s2 = peg$c223;
9850
10015
  peg$currPos++;
9851
10016
  } else {
9852
10017
  s2 = peg$FAILED;
9853
10018
 
9854
10019
  if (peg$silentFails === 0) {
9855
- peg$fail(peg$c222);
10020
+ peg$fail(peg$c224);
9856
10021
  }
9857
10022
  }
9858
10023
 
9859
10024
  if (s2 !== peg$FAILED) {
9860
10025
  peg$savedPos = s0;
9861
- s1 = peg$c319();
10026
+ s1 = peg$c321();
9862
10027
  s0 = s1;
9863
10028
  } else {
9864
10029
  peg$currPos = s0;
@@ -9875,13 +10040,13 @@ function peg$parse(input, options) {
9875
10040
  peg$silentFails++;
9876
10041
 
9877
10042
  if (input.charCodeAt(peg$currPos) === 39) {
9878
- s2 = peg$c221;
10043
+ s2 = peg$c223;
9879
10044
  peg$currPos++;
9880
10045
  } else {
9881
10046
  s2 = peg$FAILED;
9882
10047
 
9883
10048
  if (peg$silentFails === 0) {
9884
- peg$fail(peg$c222);
10049
+ peg$fail(peg$c224);
9885
10050
  }
9886
10051
  }
9887
10052
 
@@ -9899,7 +10064,7 @@ function peg$parse(input, options) {
9899
10064
 
9900
10065
  if (s2 !== peg$FAILED) {
9901
10066
  peg$savedPos = s0;
9902
- s1 = peg$c318();
10067
+ s1 = peg$c320();
9903
10068
  s0 = s1;
9904
10069
  } else {
9905
10070
  peg$currPos = s0;
@@ -9924,7 +10089,7 @@ function peg$parse(input, options) {
9924
10089
  s0 = peg$FAILED;
9925
10090
 
9926
10091
  if (peg$silentFails === 0) {
9927
- peg$fail(peg$c203);
10092
+ peg$fail(peg$c201);
9928
10093
  }
9929
10094
  }
9930
10095
 
@@ -9947,14 +10112,14 @@ function peg$parse(input, options) {
9947
10112
  s0 = peg$currPos;
9948
10113
  s1 = [];
9949
10114
 
9950
- if (peg$c320.test(input.charAt(peg$currPos))) {
10115
+ if (peg$c322.test(input.charAt(peg$currPos))) {
9951
10116
  s2 = input.charAt(peg$currPos);
9952
10117
  peg$currPos++;
9953
10118
  } else {
9954
10119
  s2 = peg$FAILED;
9955
10120
 
9956
10121
  if (peg$silentFails === 0) {
9957
- peg$fail(peg$c321);
10122
+ peg$fail(peg$c323);
9958
10123
  }
9959
10124
  }
9960
10125
 
@@ -9962,14 +10127,14 @@ function peg$parse(input, options) {
9962
10127
  while (s2 !== peg$FAILED) {
9963
10128
  s1.push(s2);
9964
10129
 
9965
- if (peg$c320.test(input.charAt(peg$currPos))) {
10130
+ if (peg$c322.test(input.charAt(peg$currPos))) {
9966
10131
  s2 = input.charAt(peg$currPos);
9967
10132
  peg$currPos++;
9968
10133
  } else {
9969
10134
  s2 = peg$FAILED;
9970
10135
 
9971
10136
  if (peg$silentFails === 0) {
9972
- peg$fail(peg$c321);
10137
+ peg$fail(peg$c323);
9973
10138
  }
9974
10139
  }
9975
10140
  }
@@ -9979,27 +10144,27 @@ function peg$parse(input, options) {
9979
10144
 
9980
10145
  if (s1 !== peg$FAILED) {
9981
10146
  if (input.charCodeAt(peg$currPos) === 46) {
9982
- s2 = peg$c271;
10147
+ s2 = peg$c270;
9983
10148
  peg$currPos++;
9984
10149
  } else {
9985
10150
  s2 = peg$FAILED;
9986
10151
 
9987
10152
  if (peg$silentFails === 0) {
9988
- peg$fail(peg$c272);
10153
+ peg$fail(peg$c271);
9989
10154
  }
9990
10155
  }
9991
10156
 
9992
10157
  if (s2 !== peg$FAILED) {
9993
10158
  s3 = [];
9994
10159
 
9995
- if (peg$c320.test(input.charAt(peg$currPos))) {
10160
+ if (peg$c322.test(input.charAt(peg$currPos))) {
9996
10161
  s4 = input.charAt(peg$currPos);
9997
10162
  peg$currPos++;
9998
10163
  } else {
9999
10164
  s4 = peg$FAILED;
10000
10165
 
10001
10166
  if (peg$silentFails === 0) {
10002
- peg$fail(peg$c321);
10167
+ peg$fail(peg$c323);
10003
10168
  }
10004
10169
  }
10005
10170
 
@@ -10007,14 +10172,14 @@ function peg$parse(input, options) {
10007
10172
  while (s4 !== peg$FAILED) {
10008
10173
  s3.push(s4);
10009
10174
 
10010
- if (peg$c320.test(input.charAt(peg$currPos))) {
10175
+ if (peg$c322.test(input.charAt(peg$currPos))) {
10011
10176
  s4 = input.charAt(peg$currPos);
10012
10177
  peg$currPos++;
10013
10178
  } else {
10014
10179
  s4 = peg$FAILED;
10015
10180
 
10016
10181
  if (peg$silentFails === 0) {
10017
- peg$fail(peg$c321);
10182
+ peg$fail(peg$c323);
10018
10183
  }
10019
10184
  }
10020
10185
  }
@@ -10024,7 +10189,7 @@ function peg$parse(input, options) {
10024
10189
 
10025
10190
  if (s3 !== peg$FAILED) {
10026
10191
  peg$savedPos = s0;
10027
- s1 = peg$c322(s1, s3);
10192
+ s1 = peg$c324(s1, s3);
10028
10193
  s0 = s1;
10029
10194
  } else {
10030
10195
  peg$currPos = s0;
@@ -10047,14 +10212,14 @@ function peg$parse(input, options) {
10047
10212
  s0 = peg$currPos;
10048
10213
  s1 = [];
10049
10214
 
10050
- if (peg$c320.test(input.charAt(peg$currPos))) {
10215
+ if (peg$c322.test(input.charAt(peg$currPos))) {
10051
10216
  s2 = input.charAt(peg$currPos);
10052
10217
  peg$currPos++;
10053
10218
  } else {
10054
10219
  s2 = peg$FAILED;
10055
10220
 
10056
10221
  if (peg$silentFails === 0) {
10057
- peg$fail(peg$c321);
10222
+ peg$fail(peg$c323);
10058
10223
  }
10059
10224
  }
10060
10225
 
@@ -10062,14 +10227,14 @@ function peg$parse(input, options) {
10062
10227
  while (s2 !== peg$FAILED) {
10063
10228
  s1.push(s2);
10064
10229
 
10065
- if (peg$c320.test(input.charAt(peg$currPos))) {
10230
+ if (peg$c322.test(input.charAt(peg$currPos))) {
10066
10231
  s2 = input.charAt(peg$currPos);
10067
10232
  peg$currPos++;
10068
10233
  } else {
10069
10234
  s2 = peg$FAILED;
10070
10235
 
10071
10236
  if (peg$silentFails === 0) {
10072
- peg$fail(peg$c321);
10237
+ peg$fail(peg$c323);
10073
10238
  }
10074
10239
  }
10075
10240
  }
@@ -10079,7 +10244,7 @@ function peg$parse(input, options) {
10079
10244
 
10080
10245
  if (s1 !== peg$FAILED) {
10081
10246
  peg$savedPos = s0;
10082
- s1 = peg$c323(s1);
10247
+ s1 = peg$c325(s1);
10083
10248
  }
10084
10249
 
10085
10250
  s0 = s1;
@@ -10090,7 +10255,16 @@ function peg$parse(input, options) {
10090
10255
 
10091
10256
  var tables = [];
10092
10257
  var refs = [];
10093
- var enums = []; // intput:
10258
+ var enums = []; // TODO: support configurable default schema name other than 'public'
10259
+
10260
+ var findTable = function findTable(schemaName, tableName) {
10261
+ var realSchemaName = schemaName || 'public';
10262
+ var table = tables.find(function (table) {
10263
+ var targetSchemaName = table.schemaName || 'public';
10264
+ return targetSchemaName === realSchemaName && table.name === tableName;
10265
+ });
10266
+ return table;
10267
+ }; // intput:
10094
10268
  // `
10095
10269
  // 'created'
10096
10270
  // ,
@@ -10098,6 +10272,7 @@ function peg$parse(input, options) {
10098
10272
  // `
10099
10273
  // => `'created', 'pending', 'done'`
10100
10274
 
10275
+
10101
10276
  var removeReduntdantSpNewline = function removeReduntdantSpNewline(str) {
10102
10277
  var arr = str.split(/[\s\r\n]*,[\s\r\n]*/); // need to trim spaces and newlines of the first and last element
10103
10278