@dbml/core 2.5.2 → 2.5.3
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.
- package/lib/export/DbmlExporter.js +9 -64
- package/lib/export/JsonExporter.js +5 -11
- package/lib/export/ModelExporter.js +5 -22
- package/lib/export/MysqlExporter.js +8 -70
- package/lib/export/PostgresExporter.js +11 -80
- package/lib/export/SqlServerExporter.js +10 -71
- package/lib/export/index.js +0 -6
- package/lib/export/utils.js +2 -12
- package/lib/import/index.js +0 -7
- package/lib/index.js +4 -9
- package/lib/model_structure/config.js +1 -1
- package/lib/model_structure/database.js +32 -83
- package/lib/model_structure/dbState.js +5 -10
- package/lib/model_structure/element.js +13 -38
- package/lib/model_structure/endpoint.js +22 -68
- package/lib/model_structure/enum.js +18 -49
- package/lib/model_structure/enumValue.js +17 -44
- package/lib/model_structure/field.js +26 -62
- package/lib/model_structure/indexColumn.js +15 -40
- package/lib/model_structure/indexes.js +22 -50
- package/lib/model_structure/ref.js +24 -56
- package/lib/model_structure/schema.js +27 -65
- package/lib/model_structure/table.js +24 -59
- package/lib/model_structure/tableGroup.js +18 -49
- package/lib/model_structure/utils.js +0 -3
- package/lib/parse/Parser.js +5 -27
- package/lib/parse/buildParser.js +11 -23
- package/lib/parse/dbmlParser.js +863 -2131
- package/lib/parse/mssql/base_parsers.js +2 -11
- package/lib/parse/mssql/column_definition/actions.js +0 -3
- package/lib/parse/mssql/column_definition/index.js +9 -17
- package/lib/parse/mssql/constraint_definition/actions.js +6 -12
- package/lib/parse/mssql/constraint_definition/index.js +10 -18
- package/lib/parse/mssql/expression.js +6 -16
- package/lib/parse/mssql/fk_definition/actions.js +1 -12
- package/lib/parse/mssql/fk_definition/index.js +5 -10
- package/lib/parse/mssql/index.js +2 -4
- package/lib/parse/mssql/index_definition/actions.js +0 -6
- package/lib/parse/mssql/index_definition/index.js +8 -13
- package/lib/parse/mssql/keyword_parsers.js +2 -3
- package/lib/parse/mssql/keyword_utils.js +0 -4
- package/lib/parse/mssql/statements/actions.js +0 -24
- package/lib/parse/mssql/statements/index.js +1 -7
- package/lib/parse/mssql/statements/statement_types/alter_table/actions.js +3 -10
- package/lib/parse/mssql/statements/statement_types/alter_table/add/actions.js +2 -6
- package/lib/parse/mssql/statements/statement_types/alter_table/add/index.js +9 -18
- package/lib/parse/mssql/statements/statement_types/alter_table/index.js +2 -7
- package/lib/parse/mssql/statements/statement_types/comments/actions.js +3 -11
- package/lib/parse/mssql/statements/statement_types/comments/index.js +3 -13
- package/lib/parse/mssql/statements/statement_types/create_index/actions.js +1 -3
- package/lib/parse/mssql/statements/statement_types/create_index/index.js +9 -15
- package/lib/parse/mssql/statements/statement_types/create_table/actions.js +7 -18
- package/lib/parse/mssql/statements/statement_types/create_table/index.js +8 -16
- package/lib/parse/mssql/statements/statement_types/index.js +0 -4
- package/lib/parse/mssql/utils.js +4 -14
- package/lib/parse/mssql/whitespaces.js +0 -1
- package/lib/parse/mssqlParser.js +0 -3
- package/lib/parse/mysqlParser.js +822 -2395
- package/lib/parse/postgresParser.js +3 -3
- package/lib/parse/postgresql/get_parser.js +6 -9
- package/lib/parse/schemarbParser.js +219 -714
- package/package.json +10 -11
- package/types/.DS_Store +0 -0
|
@@ -3,40 +3,35 @@
|
|
|
3
3
|
*
|
|
4
4
|
* http://pegjs.org/
|
|
5
5
|
*/
|
|
6
|
-
"use strict";
|
|
7
|
-
|
|
8
|
-
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; }
|
|
9
|
-
|
|
10
|
-
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; }
|
|
11
6
|
|
|
12
|
-
|
|
7
|
+
"use strict";
|
|
13
8
|
|
|
9
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
10
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
11
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
12
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
13
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
14
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
14
15
|
var _ = require("lodash"),
|
|
15
|
-
|
|
16
|
-
|
|
16
|
+
pluralize = require("pluralize");
|
|
17
17
|
function peg$subclass(child, parent) {
|
|
18
18
|
function ctor() {
|
|
19
19
|
this.constructor = child;
|
|
20
20
|
}
|
|
21
|
-
|
|
22
21
|
ctor.prototype = parent.prototype;
|
|
23
22
|
child.prototype = new ctor();
|
|
24
23
|
}
|
|
25
|
-
|
|
26
24
|
function peg$SyntaxError(message, expected, found, location) {
|
|
27
25
|
this.message = message;
|
|
28
26
|
this.expected = expected;
|
|
29
27
|
this.found = found;
|
|
30
28
|
this.location = location;
|
|
31
29
|
this.name = "SyntaxError";
|
|
32
|
-
|
|
33
30
|
if (typeof Error.captureStackTrace === "function") {
|
|
34
31
|
Error.captureStackTrace(this, peg$SyntaxError);
|
|
35
32
|
}
|
|
36
33
|
}
|
|
37
|
-
|
|
38
34
|
peg$subclass(peg$SyntaxError, Error);
|
|
39
|
-
|
|
40
35
|
peg$SyntaxError.buildMessage = function (expected, found) {
|
|
41
36
|
var DESCRIBE_EXPECTATION_FNS = {
|
|
42
37
|
literal: function literal(expectation) {
|
|
@@ -44,12 +39,10 @@ peg$SyntaxError.buildMessage = function (expected, found) {
|
|
|
44
39
|
},
|
|
45
40
|
"class": function _class(expectation) {
|
|
46
41
|
var escapedParts = "",
|
|
47
|
-
|
|
48
|
-
|
|
42
|
+
i;
|
|
49
43
|
for (i = 0; i < expectation.parts.length; i++) {
|
|
50
44
|
escapedParts += expectation.parts[i] instanceof Array ? classEscape(expectation.parts[i][0]) + "-" + classEscape(expectation.parts[i][1]) : classEscape(expectation.parts[i]);
|
|
51
45
|
}
|
|
52
|
-
|
|
53
46
|
return "[" + (expectation.inverted ? "^" : "") + escapedParts + "]";
|
|
54
47
|
},
|
|
55
48
|
any: function any(expectation) {
|
|
@@ -62,11 +55,9 @@ peg$SyntaxError.buildMessage = function (expected, found) {
|
|
|
62
55
|
return expectation.description;
|
|
63
56
|
}
|
|
64
57
|
};
|
|
65
|
-
|
|
66
58
|
function hex(ch) {
|
|
67
59
|
return ch.charCodeAt(0).toString(16).toUpperCase();
|
|
68
60
|
}
|
|
69
|
-
|
|
70
61
|
function literalEscape(s) {
|
|
71
62
|
return s.replace(/\\/g, '\\\\').replace(/"/g, '\\"').replace(/\0/g, '\\0').replace(/\t/g, '\\t').replace(/\n/g, '\\n').replace(/\r/g, '\\r').replace(/[\x00-\x0F]/g, function (ch) {
|
|
72
63
|
return '\\x0' + hex(ch);
|
|
@@ -74,7 +65,6 @@ peg$SyntaxError.buildMessage = function (expected, found) {
|
|
|
74
65
|
return '\\x' + hex(ch);
|
|
75
66
|
});
|
|
76
67
|
}
|
|
77
|
-
|
|
78
68
|
function classEscape(s) {
|
|
79
69
|
return s.replace(/\\/g, '\\\\').replace(/\]/g, '\\]').replace(/\^/g, '\\^').replace(/-/g, '\\-').replace(/\0/g, '\\0').replace(/\t/g, '\\t').replace(/\n/g, '\\n').replace(/\r/g, '\\r').replace(/[\x00-\x0F]/g, function (ch) {
|
|
80
70
|
return '\\x0' + hex(ch);
|
|
@@ -82,22 +72,17 @@ peg$SyntaxError.buildMessage = function (expected, found) {
|
|
|
82
72
|
return '\\x' + hex(ch);
|
|
83
73
|
});
|
|
84
74
|
}
|
|
85
|
-
|
|
86
75
|
function describeExpectation(expectation) {
|
|
87
76
|
return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation);
|
|
88
77
|
}
|
|
89
|
-
|
|
90
78
|
function describeExpected(expected) {
|
|
91
79
|
var descriptions = new Array(expected.length),
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
80
|
+
i,
|
|
81
|
+
j;
|
|
95
82
|
for (i = 0; i < expected.length; i++) {
|
|
96
83
|
descriptions[i] = describeExpectation(expected[i]);
|
|
97
84
|
}
|
|
98
|
-
|
|
99
85
|
descriptions.sort();
|
|
100
|
-
|
|
101
86
|
if (descriptions.length > 0) {
|
|
102
87
|
for (i = 1, j = 1; i < descriptions.length; i++) {
|
|
103
88
|
if (descriptions[i - 1] !== descriptions[i]) {
|
|
@@ -105,261 +90,246 @@ peg$SyntaxError.buildMessage = function (expected, found) {
|
|
|
105
90
|
j++;
|
|
106
91
|
}
|
|
107
92
|
}
|
|
108
|
-
|
|
109
93
|
descriptions.length = j;
|
|
110
94
|
}
|
|
111
|
-
|
|
112
95
|
switch (descriptions.length) {
|
|
113
96
|
case 1:
|
|
114
97
|
return descriptions[0];
|
|
115
|
-
|
|
116
98
|
case 2:
|
|
117
99
|
return descriptions[0] + " or " + descriptions[1];
|
|
118
|
-
|
|
119
100
|
default:
|
|
120
101
|
return descriptions.slice(0, -1).join(", ") + ", or " + descriptions[descriptions.length - 1];
|
|
121
102
|
}
|
|
122
103
|
}
|
|
123
|
-
|
|
124
104
|
function describeFound(found) {
|
|
125
105
|
return found ? "\"" + literalEscape(found) + "\"" : "end of input";
|
|
126
106
|
}
|
|
127
|
-
|
|
128
107
|
return "Expected " + describeExpected(expected) + " but " + describeFound(found) + " found.";
|
|
129
108
|
};
|
|
130
|
-
|
|
131
109
|
function peg$parse(input, options) {
|
|
132
110
|
options = options !== void 0 ? options : {};
|
|
133
|
-
|
|
134
111
|
var peg$FAILED = {},
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
112
|
+
peg$startRuleFunctions = {
|
|
113
|
+
schema: peg$parseschema
|
|
114
|
+
},
|
|
115
|
+
peg$startRuleFunction = peg$parseschema,
|
|
116
|
+
peg$c0 = function peg$c0() {
|
|
117
|
+
return implicityRef(data);
|
|
118
|
+
},
|
|
119
|
+
peg$c1 = function peg$c1(tableData) {
|
|
120
|
+
var table = tableData.table,
|
|
144
121
|
refs = tableData.refs;
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
};
|
|
180
|
-
}
|
|
181
|
-
},
|
|
182
|
-
peg$c11 = function peg$c11(name, body) {
|
|
183
|
-
var table = {
|
|
184
|
-
name: name,
|
|
185
|
-
fields: addPrimaryKey(body.fields) // index: _.union(...body.index)
|
|
186
|
-
|
|
187
|
-
};
|
|
188
|
-
return {
|
|
189
|
-
table: table,
|
|
190
|
-
refs: createRefFromTableWithReference(table, body.references)
|
|
191
|
-
};
|
|
192
|
-
},
|
|
193
|
-
peg$c12 = function peg$c12(fields) {
|
|
194
|
-
return {
|
|
195
|
-
fields: fields.filter(function (field) {
|
|
196
|
-
return field.isField;
|
|
197
|
-
}).map(function (field) {
|
|
198
|
-
return field.field;
|
|
199
|
-
}),
|
|
200
|
-
index: fields.filter(function (field) {
|
|
201
|
-
return field.isIndex;
|
|
202
|
-
}).map(function (field) {
|
|
203
|
-
return field.index;
|
|
204
|
-
}),
|
|
205
|
-
references: fields.filter(function (field) {
|
|
206
|
-
return field.isReferences;
|
|
207
|
-
}).map(function (field) {
|
|
208
|
-
return field.reference;
|
|
209
|
-
})
|
|
210
|
-
};
|
|
211
|
-
},
|
|
212
|
-
peg$c13 = function peg$c13(field) {
|
|
213
|
-
return field;
|
|
214
|
-
},
|
|
215
|
-
peg$c14 = function peg$c14(reference) {
|
|
216
|
-
return {
|
|
217
|
-
reference: reference,
|
|
218
|
-
isReferences: true
|
|
219
|
-
};
|
|
220
|
-
},
|
|
221
|
-
peg$c15 = function peg$c15(field) {
|
|
222
|
-
return {
|
|
223
|
-
field: field,
|
|
224
|
-
isField: true
|
|
225
|
-
};
|
|
226
|
-
},
|
|
227
|
-
peg$c16 = function peg$c16(reference) {
|
|
228
|
-
return reference;
|
|
229
|
-
},
|
|
230
|
-
peg$c17 = function peg$c17(type, name) {
|
|
231
|
-
return {
|
|
232
|
-
name: name,
|
|
233
|
-
type: {
|
|
234
|
-
type_name: type
|
|
122
|
+
pushTable(table);
|
|
123
|
+
pushRefs(refs);
|
|
124
|
+
},
|
|
125
|
+
peg$c2 = function peg$c2(r) {
|
|
126
|
+
pushRef(r);
|
|
127
|
+
},
|
|
128
|
+
peg$c3 = ",",
|
|
129
|
+
peg$c4 = peg$literalExpectation(",", false),
|
|
130
|
+
peg$c5 = function peg$c5(fromTable, toTable, props) {
|
|
131
|
+
var foreign = refactorForeign(createForeign(fromTable, toTable, props));
|
|
132
|
+
return foreign;
|
|
133
|
+
},
|
|
134
|
+
peg$c6 = ":",
|
|
135
|
+
peg$c7 = peg$literalExpectation(":", false),
|
|
136
|
+
peg$c8 = function peg$c8(columnName) {
|
|
137
|
+
return {
|
|
138
|
+
columnName: columnName
|
|
139
|
+
};
|
|
140
|
+
},
|
|
141
|
+
peg$c9 = function peg$c9(primaryKey) {
|
|
142
|
+
return {
|
|
143
|
+
primaryKey: primaryKey
|
|
144
|
+
};
|
|
145
|
+
},
|
|
146
|
+
peg$c10 = function peg$c10(r, value) {
|
|
147
|
+
switch (r.toLowerCase()) {
|
|
148
|
+
case 'on_delete':
|
|
149
|
+
return {
|
|
150
|
+
onDelete: value.split('_').join(' ')
|
|
151
|
+
};
|
|
152
|
+
case 'on_update':
|
|
153
|
+
return {
|
|
154
|
+
onUpdate: value.split('_').join(' ')
|
|
155
|
+
};
|
|
235
156
|
}
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
peg$c21 = "on_update",
|
|
244
|
-
peg$c22 = peg$literalExpectation("on_update", true),
|
|
245
|
-
peg$c23 = peg$otherExpectation("add index"),
|
|
246
|
-
peg$c24 = "add_index",
|
|
247
|
-
peg$c25 = peg$literalExpectation("add_index", false),
|
|
248
|
-
peg$c26 = peg$otherExpectation("schema define"),
|
|
249
|
-
peg$c27 = "ActiveRecord::Schema.define",
|
|
250
|
-
peg$c28 = peg$literalExpectation("ActiveRecord::Schema.define", false),
|
|
251
|
-
peg$c29 = peg$otherExpectation("create table"),
|
|
252
|
-
peg$c30 = "create_table",
|
|
253
|
-
peg$c31 = peg$literalExpectation("create_table", true),
|
|
254
|
-
peg$c32 = peg$otherExpectation("do |t|"),
|
|
255
|
-
peg$c33 = peg$otherExpectation("index"),
|
|
256
|
-
peg$c34 = ".index",
|
|
257
|
-
peg$c35 = peg$literalExpectation(".index", false),
|
|
258
|
-
peg$c36 = peg$otherExpectation("references"),
|
|
259
|
-
peg$c37 = ".references",
|
|
260
|
-
peg$c38 = peg$literalExpectation(".references", false),
|
|
261
|
-
peg$c39 = peg$otherExpectation("add foreign key"),
|
|
262
|
-
peg$c40 = "add_foreign_key",
|
|
263
|
-
peg$c41 = peg$literalExpectation("add_foreign_key", true),
|
|
264
|
-
peg$c42 = peg$otherExpectation("column"),
|
|
265
|
-
peg$c43 = "column",
|
|
266
|
-
peg$c44 = peg$literalExpectation("column", false),
|
|
267
|
-
peg$c45 = peg$otherExpectation("primary key"),
|
|
268
|
-
peg$c46 = "primary_key",
|
|
269
|
-
peg$c47 = peg$literalExpectation("primary_key", false),
|
|
270
|
-
peg$c48 = "version",
|
|
271
|
-
peg$c49 = peg$literalExpectation("version", false),
|
|
272
|
-
peg$c50 = "do",
|
|
273
|
-
peg$c51 = peg$literalExpectation("do", false),
|
|
274
|
-
peg$c52 = "end",
|
|
275
|
-
peg$c53 = peg$literalExpectation("end", false),
|
|
276
|
-
peg$c54 = peg$otherExpectation("lambda function"),
|
|
277
|
-
peg$c55 = "=>",
|
|
278
|
-
peg$c56 = peg$literalExpectation("=>", false),
|
|
279
|
-
peg$c57 = "->",
|
|
280
|
-
peg$c58 = peg$literalExpectation("->", false),
|
|
281
|
-
peg$c59 = /^[^"\n]/,
|
|
282
|
-
peg$c60 = peg$classExpectation(["\"", "\n"], true, false),
|
|
283
|
-
peg$c61 = function peg$c61(c) {
|
|
284
|
-
return c.join("");
|
|
285
|
-
},
|
|
286
|
-
peg$c62 = /^[^'\n]/,
|
|
287
|
-
peg$c63 = peg$classExpectation(["'", "\n"], true, false),
|
|
288
|
-
peg$c64 = ".",
|
|
289
|
-
peg$c65 = peg$literalExpectation(".", false),
|
|
290
|
-
peg$c66 = peg$anyExpectation(),
|
|
291
|
-
peg$c67 = function peg$c67() {
|
|
292
|
-
return text();
|
|
293
|
-
},
|
|
294
|
-
peg$c68 = /^[0-9]/i,
|
|
295
|
-
peg$c69 = peg$classExpectation([["0", "9"]], false, true),
|
|
296
|
-
peg$c70 = peg$otherExpectation("letter, number or underscore"),
|
|
297
|
-
peg$c71 = /^[a-z0-9_.]/i,
|
|
298
|
-
peg$c72 = peg$classExpectation([["a", "z"], ["0", "9"], "_", "."], false, true),
|
|
299
|
-
peg$c73 = peg$otherExpectation("comment line"),
|
|
300
|
-
peg$c74 = "#",
|
|
301
|
-
peg$c75 = peg$literalExpectation("#", false),
|
|
302
|
-
peg$c76 = peg$otherExpectation("whatever"),
|
|
303
|
-
peg$c77 = /^[^\t\r\n]/,
|
|
304
|
-
peg$c78 = peg$classExpectation(["\t", "\r", "\n"], true, false),
|
|
305
|
-
peg$c79 = "'",
|
|
306
|
-
peg$c80 = peg$literalExpectation("'", false),
|
|
307
|
-
peg$c81 = "\"",
|
|
308
|
-
peg$c82 = peg$literalExpectation("\"", false),
|
|
309
|
-
peg$c83 = "|",
|
|
310
|
-
peg$c84 = peg$literalExpectation("|", false),
|
|
311
|
-
peg$c85 = peg$otherExpectation("comment"),
|
|
312
|
-
peg$c86 = "//",
|
|
313
|
-
peg$c87 = peg$literalExpectation("//", false),
|
|
314
|
-
peg$c88 = /^[^\n]/,
|
|
315
|
-
peg$c89 = peg$classExpectation(["\n"], true, false),
|
|
316
|
-
peg$c90 = peg$otherExpectation("newline"),
|
|
317
|
-
peg$c91 = "\r\n",
|
|
318
|
-
peg$c92 = peg$literalExpectation("\r\n", false),
|
|
319
|
-
peg$c93 = "\n",
|
|
320
|
-
peg$c94 = peg$literalExpectation("\n", false),
|
|
321
|
-
peg$c95 = peg$otherExpectation("whitespace"),
|
|
322
|
-
peg$c96 = /^[ \t\r\n\r]/,
|
|
323
|
-
peg$c97 = peg$classExpectation([" ", "\t", "\r", "\n", "\r"], false, false),
|
|
324
|
-
peg$c98 = " ",
|
|
325
|
-
peg$c99 = peg$literalExpectation(" ", false),
|
|
326
|
-
peg$currPos = 0,
|
|
327
|
-
peg$savedPos = 0,
|
|
328
|
-
peg$posDetailsCache = [{
|
|
329
|
-
line: 1,
|
|
330
|
-
column: 1
|
|
331
|
-
}],
|
|
332
|
-
peg$maxFailPos = 0,
|
|
333
|
-
peg$maxFailExpected = [],
|
|
334
|
-
peg$silentFails = 0,
|
|
335
|
-
peg$result;
|
|
157
|
+
},
|
|
158
|
+
peg$c11 = function peg$c11(name, body) {
|
|
159
|
+
var table = {
|
|
160
|
+
name: name,
|
|
161
|
+
fields: addPrimaryKey(body.fields)
|
|
162
|
+
// index: _.union(...body.index)
|
|
163
|
+
};
|
|
336
164
|
|
|
165
|
+
return {
|
|
166
|
+
table: table,
|
|
167
|
+
refs: createRefFromTableWithReference(table, body.references)
|
|
168
|
+
};
|
|
169
|
+
},
|
|
170
|
+
peg$c12 = function peg$c12(fields) {
|
|
171
|
+
return {
|
|
172
|
+
fields: fields.filter(function (field) {
|
|
173
|
+
return field.isField;
|
|
174
|
+
}).map(function (field) {
|
|
175
|
+
return field.field;
|
|
176
|
+
}),
|
|
177
|
+
index: fields.filter(function (field) {
|
|
178
|
+
return field.isIndex;
|
|
179
|
+
}).map(function (field) {
|
|
180
|
+
return field.index;
|
|
181
|
+
}),
|
|
182
|
+
references: fields.filter(function (field) {
|
|
183
|
+
return field.isReferences;
|
|
184
|
+
}).map(function (field) {
|
|
185
|
+
return field.reference;
|
|
186
|
+
})
|
|
187
|
+
};
|
|
188
|
+
},
|
|
189
|
+
peg$c13 = function peg$c13(field) {
|
|
190
|
+
return field;
|
|
191
|
+
},
|
|
192
|
+
peg$c14 = function peg$c14(reference) {
|
|
193
|
+
return {
|
|
194
|
+
reference: reference,
|
|
195
|
+
isReferences: true
|
|
196
|
+
};
|
|
197
|
+
},
|
|
198
|
+
peg$c15 = function peg$c15(field) {
|
|
199
|
+
return {
|
|
200
|
+
field: field,
|
|
201
|
+
isField: true
|
|
202
|
+
};
|
|
203
|
+
},
|
|
204
|
+
peg$c16 = function peg$c16(reference) {
|
|
205
|
+
return reference;
|
|
206
|
+
},
|
|
207
|
+
peg$c17 = function peg$c17(type, name) {
|
|
208
|
+
return {
|
|
209
|
+
name: name,
|
|
210
|
+
type: {
|
|
211
|
+
type_name: type
|
|
212
|
+
}
|
|
213
|
+
};
|
|
214
|
+
},
|
|
215
|
+
peg$c18 = function peg$c18(reference) {
|
|
216
|
+
return reference;
|
|
217
|
+
},
|
|
218
|
+
peg$c19 = "on_delete",
|
|
219
|
+
peg$c20 = peg$literalExpectation("on_delete", true),
|
|
220
|
+
peg$c21 = "on_update",
|
|
221
|
+
peg$c22 = peg$literalExpectation("on_update", true),
|
|
222
|
+
peg$c23 = peg$otherExpectation("add index"),
|
|
223
|
+
peg$c24 = "add_index",
|
|
224
|
+
peg$c25 = peg$literalExpectation("add_index", false),
|
|
225
|
+
peg$c26 = peg$otherExpectation("schema define"),
|
|
226
|
+
peg$c27 = "ActiveRecord::Schema.define",
|
|
227
|
+
peg$c28 = peg$literalExpectation("ActiveRecord::Schema.define", false),
|
|
228
|
+
peg$c29 = peg$otherExpectation("create table"),
|
|
229
|
+
peg$c30 = "create_table",
|
|
230
|
+
peg$c31 = peg$literalExpectation("create_table", true),
|
|
231
|
+
peg$c32 = peg$otherExpectation("do |t|"),
|
|
232
|
+
peg$c33 = peg$otherExpectation("index"),
|
|
233
|
+
peg$c34 = ".index",
|
|
234
|
+
peg$c35 = peg$literalExpectation(".index", false),
|
|
235
|
+
peg$c36 = peg$otherExpectation("references"),
|
|
236
|
+
peg$c37 = ".references",
|
|
237
|
+
peg$c38 = peg$literalExpectation(".references", false),
|
|
238
|
+
peg$c39 = peg$otherExpectation("add foreign key"),
|
|
239
|
+
peg$c40 = "add_foreign_key",
|
|
240
|
+
peg$c41 = peg$literalExpectation("add_foreign_key", true),
|
|
241
|
+
peg$c42 = peg$otherExpectation("column"),
|
|
242
|
+
peg$c43 = "column",
|
|
243
|
+
peg$c44 = peg$literalExpectation("column", false),
|
|
244
|
+
peg$c45 = peg$otherExpectation("primary key"),
|
|
245
|
+
peg$c46 = "primary_key",
|
|
246
|
+
peg$c47 = peg$literalExpectation("primary_key", false),
|
|
247
|
+
peg$c48 = "version",
|
|
248
|
+
peg$c49 = peg$literalExpectation("version", false),
|
|
249
|
+
peg$c50 = "do",
|
|
250
|
+
peg$c51 = peg$literalExpectation("do", false),
|
|
251
|
+
peg$c52 = "end",
|
|
252
|
+
peg$c53 = peg$literalExpectation("end", false),
|
|
253
|
+
peg$c54 = peg$otherExpectation("lambda function"),
|
|
254
|
+
peg$c55 = "=>",
|
|
255
|
+
peg$c56 = peg$literalExpectation("=>", false),
|
|
256
|
+
peg$c57 = "->",
|
|
257
|
+
peg$c58 = peg$literalExpectation("->", false),
|
|
258
|
+
peg$c59 = /^[^"\n]/,
|
|
259
|
+
peg$c60 = peg$classExpectation(["\"", "\n"], true, false),
|
|
260
|
+
peg$c61 = function peg$c61(c) {
|
|
261
|
+
return c.join("");
|
|
262
|
+
},
|
|
263
|
+
peg$c62 = /^[^'\n]/,
|
|
264
|
+
peg$c63 = peg$classExpectation(["'", "\n"], true, false),
|
|
265
|
+
peg$c64 = ".",
|
|
266
|
+
peg$c65 = peg$literalExpectation(".", false),
|
|
267
|
+
peg$c66 = peg$anyExpectation(),
|
|
268
|
+
peg$c67 = function peg$c67() {
|
|
269
|
+
return text();
|
|
270
|
+
},
|
|
271
|
+
peg$c68 = /^[0-9]/i,
|
|
272
|
+
peg$c69 = peg$classExpectation([["0", "9"]], false, true),
|
|
273
|
+
peg$c70 = peg$otherExpectation("letter, number or underscore"),
|
|
274
|
+
peg$c71 = /^[a-z0-9_.]/i,
|
|
275
|
+
peg$c72 = peg$classExpectation([["a", "z"], ["0", "9"], "_", "."], false, true),
|
|
276
|
+
peg$c73 = peg$otherExpectation("comment line"),
|
|
277
|
+
peg$c74 = "#",
|
|
278
|
+
peg$c75 = peg$literalExpectation("#", false),
|
|
279
|
+
peg$c76 = peg$otherExpectation("whatever"),
|
|
280
|
+
peg$c77 = /^[^\t\r\n]/,
|
|
281
|
+
peg$c78 = peg$classExpectation(["\t", "\r", "\n"], true, false),
|
|
282
|
+
peg$c79 = "'",
|
|
283
|
+
peg$c80 = peg$literalExpectation("'", false),
|
|
284
|
+
peg$c81 = "\"",
|
|
285
|
+
peg$c82 = peg$literalExpectation("\"", false),
|
|
286
|
+
peg$c83 = "|",
|
|
287
|
+
peg$c84 = peg$literalExpectation("|", false),
|
|
288
|
+
peg$c85 = peg$otherExpectation("comment"),
|
|
289
|
+
peg$c86 = "//",
|
|
290
|
+
peg$c87 = peg$literalExpectation("//", false),
|
|
291
|
+
peg$c88 = /^[^\n]/,
|
|
292
|
+
peg$c89 = peg$classExpectation(["\n"], true, false),
|
|
293
|
+
peg$c90 = peg$otherExpectation("newline"),
|
|
294
|
+
peg$c91 = "\r\n",
|
|
295
|
+
peg$c92 = peg$literalExpectation("\r\n", false),
|
|
296
|
+
peg$c93 = "\n",
|
|
297
|
+
peg$c94 = peg$literalExpectation("\n", false),
|
|
298
|
+
peg$c95 = peg$otherExpectation("whitespace"),
|
|
299
|
+
peg$c96 = /^[ \t\r\n\r]/,
|
|
300
|
+
peg$c97 = peg$classExpectation([" ", "\t", "\r", "\n", "\r"], false, false),
|
|
301
|
+
peg$c98 = " ",
|
|
302
|
+
peg$c99 = peg$literalExpectation(" ", false),
|
|
303
|
+
peg$currPos = 0,
|
|
304
|
+
peg$savedPos = 0,
|
|
305
|
+
peg$posDetailsCache = [{
|
|
306
|
+
line: 1,
|
|
307
|
+
column: 1
|
|
308
|
+
}],
|
|
309
|
+
peg$maxFailPos = 0,
|
|
310
|
+
peg$maxFailExpected = [],
|
|
311
|
+
peg$silentFails = 0,
|
|
312
|
+
peg$result;
|
|
337
313
|
if ("startRule" in options) {
|
|
338
314
|
if (!(options.startRule in peg$startRuleFunctions)) {
|
|
339
315
|
throw new Error("Can't start parsing from rule \"" + options.startRule + "\".");
|
|
340
316
|
}
|
|
341
|
-
|
|
342
317
|
peg$startRuleFunction = peg$startRuleFunctions[options.startRule];
|
|
343
318
|
}
|
|
344
|
-
|
|
345
319
|
function text() {
|
|
346
320
|
return input.substring(peg$savedPos, peg$currPos);
|
|
347
321
|
}
|
|
348
|
-
|
|
349
322
|
function location() {
|
|
350
323
|
return peg$computeLocation(peg$savedPos, peg$currPos);
|
|
351
324
|
}
|
|
352
|
-
|
|
353
325
|
function expected(description, location) {
|
|
354
326
|
location = location !== void 0 ? location : peg$computeLocation(peg$savedPos, peg$currPos);
|
|
355
327
|
throw peg$buildStructuredError([peg$otherExpectation(description)], input.substring(peg$savedPos, peg$currPos), location);
|
|
356
328
|
}
|
|
357
|
-
|
|
358
329
|
function error(message, location) {
|
|
359
330
|
location = location !== void 0 ? location : peg$computeLocation(peg$savedPos, peg$currPos);
|
|
360
331
|
throw peg$buildSimpleError(message, location);
|
|
361
332
|
}
|
|
362
|
-
|
|
363
333
|
function peg$literalExpectation(text, ignoreCase) {
|
|
364
334
|
return {
|
|
365
335
|
type: "literal",
|
|
@@ -367,7 +337,6 @@ function peg$parse(input, options) {
|
|
|
367
337
|
ignoreCase: ignoreCase
|
|
368
338
|
};
|
|
369
339
|
}
|
|
370
|
-
|
|
371
340
|
function peg$classExpectation(parts, inverted, ignoreCase) {
|
|
372
341
|
return {
|
|
373
342
|
type: "class",
|
|
@@ -376,45 +345,37 @@ function peg$parse(input, options) {
|
|
|
376
345
|
ignoreCase: ignoreCase
|
|
377
346
|
};
|
|
378
347
|
}
|
|
379
|
-
|
|
380
348
|
function peg$anyExpectation() {
|
|
381
349
|
return {
|
|
382
350
|
type: "any"
|
|
383
351
|
};
|
|
384
352
|
}
|
|
385
|
-
|
|
386
353
|
function peg$endExpectation() {
|
|
387
354
|
return {
|
|
388
355
|
type: "end"
|
|
389
356
|
};
|
|
390
357
|
}
|
|
391
|
-
|
|
392
358
|
function peg$otherExpectation(description) {
|
|
393
359
|
return {
|
|
394
360
|
type: "other",
|
|
395
361
|
description: description
|
|
396
362
|
};
|
|
397
363
|
}
|
|
398
|
-
|
|
399
364
|
function peg$computePosDetails(pos) {
|
|
400
365
|
var details = peg$posDetailsCache[pos],
|
|
401
|
-
|
|
402
|
-
|
|
366
|
+
p;
|
|
403
367
|
if (details) {
|
|
404
368
|
return details;
|
|
405
369
|
} else {
|
|
406
370
|
p = pos - 1;
|
|
407
|
-
|
|
408
371
|
while (!peg$posDetailsCache[p]) {
|
|
409
372
|
p--;
|
|
410
373
|
}
|
|
411
|
-
|
|
412
374
|
details = peg$posDetailsCache[p];
|
|
413
375
|
details = {
|
|
414
376
|
line: details.line,
|
|
415
377
|
column: details.column
|
|
416
378
|
};
|
|
417
|
-
|
|
418
379
|
while (p < pos) {
|
|
419
380
|
if (input.charCodeAt(p) === 10) {
|
|
420
381
|
details.line++;
|
|
@@ -422,18 +383,15 @@ function peg$parse(input, options) {
|
|
|
422
383
|
} else {
|
|
423
384
|
details.column++;
|
|
424
385
|
}
|
|
425
|
-
|
|
426
386
|
p++;
|
|
427
387
|
}
|
|
428
|
-
|
|
429
388
|
peg$posDetailsCache[pos] = details;
|
|
430
389
|
return details;
|
|
431
390
|
}
|
|
432
391
|
}
|
|
433
|
-
|
|
434
392
|
function peg$computeLocation(startPos, endPos) {
|
|
435
393
|
var startPosDetails = peg$computePosDetails(startPos),
|
|
436
|
-
|
|
394
|
+
endPosDetails = peg$computePosDetails(endPos);
|
|
437
395
|
return {
|
|
438
396
|
start: {
|
|
439
397
|
offset: startPos,
|
|
@@ -447,62 +405,49 @@ function peg$parse(input, options) {
|
|
|
447
405
|
}
|
|
448
406
|
};
|
|
449
407
|
}
|
|
450
|
-
|
|
451
408
|
function peg$fail(expected) {
|
|
452
409
|
if (peg$currPos < peg$maxFailPos) {
|
|
453
410
|
return;
|
|
454
411
|
}
|
|
455
|
-
|
|
456
412
|
if (peg$currPos > peg$maxFailPos) {
|
|
457
413
|
peg$maxFailPos = peg$currPos;
|
|
458
414
|
peg$maxFailExpected = [];
|
|
459
415
|
}
|
|
460
|
-
|
|
461
416
|
peg$maxFailExpected.push(expected);
|
|
462
417
|
}
|
|
463
|
-
|
|
464
418
|
function peg$buildSimpleError(message, location) {
|
|
465
419
|
return new peg$SyntaxError(message, null, null, location);
|
|
466
420
|
}
|
|
467
|
-
|
|
468
421
|
function peg$buildStructuredError(expected, found, location) {
|
|
469
422
|
return new peg$SyntaxError(peg$SyntaxError.buildMessage(expected, found), expected, found, location);
|
|
470
423
|
}
|
|
471
|
-
|
|
472
424
|
function peg$parseschema() {
|
|
473
425
|
var s0, s1, s2;
|
|
474
426
|
s0 = peg$currPos;
|
|
475
427
|
s1 = [];
|
|
476
428
|
s2 = peg$parseline_rule();
|
|
477
|
-
|
|
478
429
|
while (s2 !== peg$FAILED) {
|
|
479
430
|
s1.push(s2);
|
|
480
431
|
s2 = peg$parseline_rule();
|
|
481
432
|
}
|
|
482
|
-
|
|
483
433
|
if (s1 !== peg$FAILED) {
|
|
484
434
|
peg$savedPos = s0;
|
|
485
435
|
s1 = peg$c0();
|
|
486
436
|
}
|
|
487
|
-
|
|
488
437
|
s0 = s1;
|
|
489
438
|
return s0;
|
|
490
439
|
}
|
|
491
|
-
|
|
492
440
|
function peg$parseline_rule() {
|
|
493
441
|
var s0, s1, s2;
|
|
494
442
|
s0 = peg$currPos;
|
|
495
443
|
s1 = [];
|
|
496
444
|
s2 = peg$parsewhitespace();
|
|
497
|
-
|
|
498
445
|
while (s2 !== peg$FAILED) {
|
|
499
446
|
s1.push(s2);
|
|
500
447
|
s2 = peg$parsewhitespace();
|
|
501
448
|
}
|
|
502
|
-
|
|
503
449
|
if (s1 !== peg$FAILED) {
|
|
504
450
|
s2 = peg$parserule();
|
|
505
|
-
|
|
506
451
|
if (s2 !== peg$FAILED) {
|
|
507
452
|
s1 = [s1, s2];
|
|
508
453
|
s0 = s1;
|
|
@@ -514,112 +459,86 @@ function peg$parse(input, options) {
|
|
|
514
459
|
peg$currPos = s0;
|
|
515
460
|
s0 = peg$FAILED;
|
|
516
461
|
}
|
|
517
|
-
|
|
518
462
|
if (s0 === peg$FAILED) {
|
|
519
463
|
s0 = peg$parsecomment_line();
|
|
520
|
-
|
|
521
464
|
if (s0 === peg$FAILED) {
|
|
522
465
|
s0 = peg$parseend_line();
|
|
523
|
-
|
|
524
466
|
if (s0 === peg$FAILED) {
|
|
525
467
|
s0 = peg$parse__();
|
|
526
468
|
}
|
|
527
469
|
}
|
|
528
470
|
}
|
|
529
|
-
|
|
530
471
|
return s0;
|
|
531
472
|
}
|
|
532
|
-
|
|
533
473
|
function peg$parserule() {
|
|
534
474
|
var s0, s1;
|
|
535
475
|
s0 = peg$currPos;
|
|
536
476
|
s1 = peg$parsecreate_table_syntax();
|
|
537
|
-
|
|
538
477
|
if (s1 !== peg$FAILED) {
|
|
539
478
|
peg$savedPos = s0;
|
|
540
479
|
s1 = peg$c1(s1);
|
|
541
480
|
}
|
|
542
|
-
|
|
543
481
|
s0 = s1;
|
|
544
|
-
|
|
545
482
|
if (s0 === peg$FAILED) {
|
|
546
483
|
s0 = peg$currPos;
|
|
547
484
|
s1 = peg$parseadd_foreign_key_syntax();
|
|
548
|
-
|
|
549
485
|
if (s1 !== peg$FAILED) {
|
|
550
486
|
peg$savedPos = s0;
|
|
551
487
|
s1 = peg$c2(s1);
|
|
552
488
|
}
|
|
553
|
-
|
|
554
489
|
s0 = s1;
|
|
555
|
-
|
|
556
490
|
if (s0 === peg$FAILED) {
|
|
557
491
|
s0 = peg$parseother_class_prop();
|
|
558
492
|
}
|
|
559
493
|
}
|
|
560
|
-
|
|
561
494
|
return s0;
|
|
562
495
|
}
|
|
563
|
-
|
|
564
496
|
function peg$parseadd_foreign_key_syntax() {
|
|
565
497
|
var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9;
|
|
566
498
|
s0 = peg$currPos;
|
|
567
499
|
s1 = [];
|
|
568
500
|
s2 = peg$parsesp();
|
|
569
|
-
|
|
570
501
|
while (s2 !== peg$FAILED) {
|
|
571
502
|
s1.push(s2);
|
|
572
503
|
s2 = peg$parsesp();
|
|
573
504
|
}
|
|
574
|
-
|
|
575
505
|
if (s1 !== peg$FAILED) {
|
|
576
506
|
s2 = peg$parseadd_foreign_key();
|
|
577
|
-
|
|
578
507
|
if (s2 !== peg$FAILED) {
|
|
579
508
|
s3 = [];
|
|
580
509
|
s4 = peg$parsesp();
|
|
581
|
-
|
|
582
510
|
while (s4 !== peg$FAILED) {
|
|
583
511
|
s3.push(s4);
|
|
584
512
|
s4 = peg$parsesp();
|
|
585
513
|
}
|
|
586
|
-
|
|
587
514
|
if (s3 !== peg$FAILED) {
|
|
588
515
|
s4 = peg$parsename();
|
|
589
|
-
|
|
590
516
|
if (s4 !== peg$FAILED) {
|
|
591
517
|
if (input.charCodeAt(peg$currPos) === 44) {
|
|
592
518
|
s5 = peg$c3;
|
|
593
519
|
peg$currPos++;
|
|
594
520
|
} else {
|
|
595
521
|
s5 = peg$FAILED;
|
|
596
|
-
|
|
597
522
|
if (peg$silentFails === 0) {
|
|
598
523
|
peg$fail(peg$c4);
|
|
599
524
|
}
|
|
600
525
|
}
|
|
601
|
-
|
|
602
526
|
if (s5 !== peg$FAILED) {
|
|
603
527
|
s6 = [];
|
|
604
528
|
s7 = peg$parsesp();
|
|
605
|
-
|
|
606
529
|
while (s7 !== peg$FAILED) {
|
|
607
530
|
s6.push(s7);
|
|
608
531
|
s7 = peg$parsesp();
|
|
609
532
|
}
|
|
610
|
-
|
|
611
533
|
if (s6 !== peg$FAILED) {
|
|
612
534
|
s7 = peg$parsename();
|
|
613
|
-
|
|
614
535
|
if (s7 !== peg$FAILED) {
|
|
615
536
|
s8 = [];
|
|
616
537
|
s9 = peg$parseadd_foreign_key_props_syntax();
|
|
617
|
-
|
|
618
538
|
while (s9 !== peg$FAILED) {
|
|
619
539
|
s8.push(s9);
|
|
620
540
|
s9 = peg$parseadd_foreign_key_props_syntax();
|
|
621
541
|
}
|
|
622
|
-
|
|
623
542
|
if (s8 !== peg$FAILED) {
|
|
624
543
|
peg$savedPos = s0;
|
|
625
544
|
s1 = peg$c5(s4, s7, s8);
|
|
@@ -656,61 +575,48 @@ function peg$parse(input, options) {
|
|
|
656
575
|
peg$currPos = s0;
|
|
657
576
|
s0 = peg$FAILED;
|
|
658
577
|
}
|
|
659
|
-
|
|
660
578
|
return s0;
|
|
661
579
|
}
|
|
662
|
-
|
|
663
580
|
function peg$parseadd_foreign_key_props_syntax() {
|
|
664
581
|
var s0, s1, s2, s3, s4, s5, s6;
|
|
665
582
|
s0 = peg$currPos;
|
|
666
|
-
|
|
667
583
|
if (input.charCodeAt(peg$currPos) === 44) {
|
|
668
584
|
s1 = peg$c3;
|
|
669
585
|
peg$currPos++;
|
|
670
586
|
} else {
|
|
671
587
|
s1 = peg$FAILED;
|
|
672
|
-
|
|
673
588
|
if (peg$silentFails === 0) {
|
|
674
589
|
peg$fail(peg$c4);
|
|
675
590
|
}
|
|
676
591
|
}
|
|
677
|
-
|
|
678
592
|
if (s1 !== peg$FAILED) {
|
|
679
593
|
s2 = [];
|
|
680
594
|
s3 = peg$parsesp();
|
|
681
|
-
|
|
682
595
|
while (s3 !== peg$FAILED) {
|
|
683
596
|
s2.push(s3);
|
|
684
597
|
s3 = peg$parsesp();
|
|
685
598
|
}
|
|
686
|
-
|
|
687
599
|
if (s2 !== peg$FAILED) {
|
|
688
600
|
s3 = peg$parsecolumn();
|
|
689
|
-
|
|
690
601
|
if (s3 !== peg$FAILED) {
|
|
691
602
|
if (input.charCodeAt(peg$currPos) === 58) {
|
|
692
603
|
s4 = peg$c6;
|
|
693
604
|
peg$currPos++;
|
|
694
605
|
} else {
|
|
695
606
|
s4 = peg$FAILED;
|
|
696
|
-
|
|
697
607
|
if (peg$silentFails === 0) {
|
|
698
608
|
peg$fail(peg$c7);
|
|
699
609
|
}
|
|
700
610
|
}
|
|
701
|
-
|
|
702
611
|
if (s4 !== peg$FAILED) {
|
|
703
612
|
s5 = [];
|
|
704
613
|
s6 = peg$parsesp();
|
|
705
|
-
|
|
706
614
|
while (s6 !== peg$FAILED) {
|
|
707
615
|
s5.push(s6);
|
|
708
616
|
s6 = peg$parsesp();
|
|
709
617
|
}
|
|
710
|
-
|
|
711
618
|
if (s5 !== peg$FAILED) {
|
|
712
619
|
s6 = peg$parsename();
|
|
713
|
-
|
|
714
620
|
if (s6 !== peg$FAILED) {
|
|
715
621
|
peg$savedPos = s0;
|
|
716
622
|
s1 = peg$c8(s6);
|
|
@@ -739,57 +645,45 @@ function peg$parse(input, options) {
|
|
|
739
645
|
peg$currPos = s0;
|
|
740
646
|
s0 = peg$FAILED;
|
|
741
647
|
}
|
|
742
|
-
|
|
743
648
|
if (s0 === peg$FAILED) {
|
|
744
649
|
s0 = peg$currPos;
|
|
745
|
-
|
|
746
650
|
if (input.charCodeAt(peg$currPos) === 44) {
|
|
747
651
|
s1 = peg$c3;
|
|
748
652
|
peg$currPos++;
|
|
749
653
|
} else {
|
|
750
654
|
s1 = peg$FAILED;
|
|
751
|
-
|
|
752
655
|
if (peg$silentFails === 0) {
|
|
753
656
|
peg$fail(peg$c4);
|
|
754
657
|
}
|
|
755
658
|
}
|
|
756
|
-
|
|
757
659
|
if (s1 !== peg$FAILED) {
|
|
758
660
|
s2 = [];
|
|
759
661
|
s3 = peg$parsesp();
|
|
760
|
-
|
|
761
662
|
while (s3 !== peg$FAILED) {
|
|
762
663
|
s2.push(s3);
|
|
763
664
|
s3 = peg$parsesp();
|
|
764
665
|
}
|
|
765
|
-
|
|
766
666
|
if (s2 !== peg$FAILED) {
|
|
767
667
|
s3 = peg$parseprimary_key();
|
|
768
|
-
|
|
769
668
|
if (s3 !== peg$FAILED) {
|
|
770
669
|
if (input.charCodeAt(peg$currPos) === 58) {
|
|
771
670
|
s4 = peg$c6;
|
|
772
671
|
peg$currPos++;
|
|
773
672
|
} else {
|
|
774
673
|
s4 = peg$FAILED;
|
|
775
|
-
|
|
776
674
|
if (peg$silentFails === 0) {
|
|
777
675
|
peg$fail(peg$c7);
|
|
778
676
|
}
|
|
779
677
|
}
|
|
780
|
-
|
|
781
678
|
if (s4 !== peg$FAILED) {
|
|
782
679
|
s5 = [];
|
|
783
680
|
s6 = peg$parsesp();
|
|
784
|
-
|
|
785
681
|
while (s6 !== peg$FAILED) {
|
|
786
682
|
s5.push(s6);
|
|
787
683
|
s6 = peg$parsesp();
|
|
788
684
|
}
|
|
789
|
-
|
|
790
685
|
if (s5 !== peg$FAILED) {
|
|
791
686
|
s6 = peg$parsename();
|
|
792
|
-
|
|
793
687
|
if (s6 !== peg$FAILED) {
|
|
794
688
|
peg$savedPos = s0;
|
|
795
689
|
s1 = peg$c9(s6);
|
|
@@ -818,57 +712,45 @@ function peg$parse(input, options) {
|
|
|
818
712
|
peg$currPos = s0;
|
|
819
713
|
s0 = peg$FAILED;
|
|
820
714
|
}
|
|
821
|
-
|
|
822
715
|
if (s0 === peg$FAILED) {
|
|
823
716
|
s0 = peg$currPos;
|
|
824
|
-
|
|
825
717
|
if (input.charCodeAt(peg$currPos) === 44) {
|
|
826
718
|
s1 = peg$c3;
|
|
827
719
|
peg$currPos++;
|
|
828
720
|
} else {
|
|
829
721
|
s1 = peg$FAILED;
|
|
830
|
-
|
|
831
722
|
if (peg$silentFails === 0) {
|
|
832
723
|
peg$fail(peg$c4);
|
|
833
724
|
}
|
|
834
725
|
}
|
|
835
|
-
|
|
836
726
|
if (s1 !== peg$FAILED) {
|
|
837
727
|
s2 = [];
|
|
838
728
|
s3 = peg$parsesp();
|
|
839
|
-
|
|
840
729
|
while (s3 !== peg$FAILED) {
|
|
841
730
|
s2.push(s3);
|
|
842
731
|
s3 = peg$parsesp();
|
|
843
732
|
}
|
|
844
|
-
|
|
845
733
|
if (s2 !== peg$FAILED) {
|
|
846
734
|
s3 = peg$parsereferential_actions();
|
|
847
|
-
|
|
848
735
|
if (s3 !== peg$FAILED) {
|
|
849
736
|
if (input.charCodeAt(peg$currPos) === 58) {
|
|
850
737
|
s4 = peg$c6;
|
|
851
738
|
peg$currPos++;
|
|
852
739
|
} else {
|
|
853
740
|
s4 = peg$FAILED;
|
|
854
|
-
|
|
855
741
|
if (peg$silentFails === 0) {
|
|
856
742
|
peg$fail(peg$c7);
|
|
857
743
|
}
|
|
858
744
|
}
|
|
859
|
-
|
|
860
745
|
if (s4 !== peg$FAILED) {
|
|
861
746
|
s5 = [];
|
|
862
747
|
s6 = peg$parsesp();
|
|
863
|
-
|
|
864
748
|
while (s6 !== peg$FAILED) {
|
|
865
749
|
s5.push(s6);
|
|
866
750
|
s6 = peg$parsesp();
|
|
867
751
|
}
|
|
868
|
-
|
|
869
752
|
if (s5 !== peg$FAILED) {
|
|
870
753
|
s6 = peg$parsesymbol();
|
|
871
|
-
|
|
872
754
|
if (s6 !== peg$FAILED) {
|
|
873
755
|
peg$savedPos = s0;
|
|
874
756
|
s1 = peg$c10(s3, s6);
|
|
@@ -899,39 +781,29 @@ function peg$parse(input, options) {
|
|
|
899
781
|
}
|
|
900
782
|
}
|
|
901
783
|
}
|
|
902
|
-
|
|
903
784
|
return s0;
|
|
904
785
|
}
|
|
905
|
-
|
|
906
786
|
function peg$parsecreate_table_syntax() {
|
|
907
787
|
var s0, s1, s2, s3, s4, s5, s6, s7;
|
|
908
788
|
s0 = peg$currPos;
|
|
909
789
|
s1 = peg$parsecreate_table();
|
|
910
|
-
|
|
911
790
|
if (s1 !== peg$FAILED) {
|
|
912
791
|
s2 = [];
|
|
913
792
|
s3 = peg$parsesp();
|
|
914
|
-
|
|
915
793
|
while (s3 !== peg$FAILED) {
|
|
916
794
|
s2.push(s3);
|
|
917
795
|
s3 = peg$parsesp();
|
|
918
796
|
}
|
|
919
|
-
|
|
920
797
|
if (s2 !== peg$FAILED) {
|
|
921
798
|
s3 = peg$parsename();
|
|
922
|
-
|
|
923
799
|
if (s3 !== peg$FAILED) {
|
|
924
800
|
s4 = peg$parsewhateters();
|
|
925
|
-
|
|
926
801
|
if (s4 !== peg$FAILED) {
|
|
927
802
|
s5 = peg$parseendline();
|
|
928
|
-
|
|
929
803
|
if (s5 !== peg$FAILED) {
|
|
930
804
|
s6 = peg$parsetable_body();
|
|
931
|
-
|
|
932
805
|
if (s6 !== peg$FAILED) {
|
|
933
806
|
s7 = peg$parseend_line();
|
|
934
|
-
|
|
935
807
|
if (s7 !== peg$FAILED) {
|
|
936
808
|
peg$savedPos = s0;
|
|
937
809
|
s1 = peg$c11(s3, s6);
|
|
@@ -964,56 +836,44 @@ function peg$parse(input, options) {
|
|
|
964
836
|
peg$currPos = s0;
|
|
965
837
|
s0 = peg$FAILED;
|
|
966
838
|
}
|
|
967
|
-
|
|
968
839
|
return s0;
|
|
969
840
|
}
|
|
970
|
-
|
|
971
841
|
function peg$parsetable_body() {
|
|
972
842
|
var s0, s1, s2;
|
|
973
843
|
s0 = peg$currPos;
|
|
974
844
|
s1 = [];
|
|
975
845
|
s2 = peg$parsefield();
|
|
976
|
-
|
|
977
846
|
while (s2 !== peg$FAILED) {
|
|
978
847
|
s1.push(s2);
|
|
979
848
|
s2 = peg$parsefield();
|
|
980
849
|
}
|
|
981
|
-
|
|
982
850
|
if (s1 !== peg$FAILED) {
|
|
983
851
|
peg$savedPos = s0;
|
|
984
852
|
s1 = peg$c12(s1);
|
|
985
853
|
}
|
|
986
|
-
|
|
987
854
|
s0 = s1;
|
|
988
855
|
return s0;
|
|
989
856
|
}
|
|
990
|
-
|
|
991
857
|
function peg$parsefield() {
|
|
992
858
|
var s0, s1, s2, s3, s4;
|
|
993
859
|
s0 = peg$currPos;
|
|
994
860
|
s1 = [];
|
|
995
861
|
s2 = peg$parsewhitespace();
|
|
996
|
-
|
|
997
862
|
while (s2 !== peg$FAILED) {
|
|
998
863
|
s1.push(s2);
|
|
999
864
|
s2 = peg$parsewhitespace();
|
|
1000
865
|
}
|
|
1001
|
-
|
|
1002
866
|
if (s1 !== peg$FAILED) {
|
|
1003
867
|
s2 = peg$parsetable_field_syntax();
|
|
1004
|
-
|
|
1005
868
|
if (s2 !== peg$FAILED) {
|
|
1006
869
|
s3 = [];
|
|
1007
870
|
s4 = peg$parsewhatever();
|
|
1008
|
-
|
|
1009
871
|
while (s4 !== peg$FAILED) {
|
|
1010
872
|
s3.push(s4);
|
|
1011
873
|
s4 = peg$parsewhatever();
|
|
1012
874
|
}
|
|
1013
|
-
|
|
1014
875
|
if (s3 !== peg$FAILED) {
|
|
1015
876
|
s4 = peg$parseendline();
|
|
1016
|
-
|
|
1017
877
|
if (s4 !== peg$FAILED) {
|
|
1018
878
|
peg$savedPos = s0;
|
|
1019
879
|
s1 = peg$c13(s2);
|
|
@@ -1034,50 +894,38 @@ function peg$parse(input, options) {
|
|
|
1034
894
|
peg$currPos = s0;
|
|
1035
895
|
s0 = peg$FAILED;
|
|
1036
896
|
}
|
|
1037
|
-
|
|
1038
897
|
return s0;
|
|
1039
898
|
}
|
|
1040
|
-
|
|
1041
899
|
function peg$parsetable_field_syntax() {
|
|
1042
900
|
var s0, s1;
|
|
1043
901
|
s0 = peg$parsefield_index_syntax();
|
|
1044
|
-
|
|
1045
902
|
if (s0 === peg$FAILED) {
|
|
1046
903
|
s0 = peg$currPos;
|
|
1047
904
|
s1 = peg$parsefield_reference_syntax();
|
|
1048
|
-
|
|
1049
905
|
if (s1 !== peg$FAILED) {
|
|
1050
906
|
peg$savedPos = s0;
|
|
1051
907
|
s1 = peg$c14(s1);
|
|
1052
908
|
}
|
|
1053
|
-
|
|
1054
909
|
s0 = s1;
|
|
1055
|
-
|
|
1056
910
|
if (s0 === peg$FAILED) {
|
|
1057
911
|
s0 = peg$currPos;
|
|
1058
912
|
s1 = peg$parsefield_type_syntax();
|
|
1059
|
-
|
|
1060
913
|
if (s1 !== peg$FAILED) {
|
|
1061
914
|
peg$savedPos = s0;
|
|
1062
915
|
s1 = peg$c15(s1);
|
|
1063
916
|
}
|
|
1064
|
-
|
|
1065
917
|
s0 = s1;
|
|
1066
918
|
}
|
|
1067
919
|
}
|
|
1068
|
-
|
|
1069
920
|
return s0;
|
|
1070
921
|
}
|
|
1071
|
-
|
|
1072
922
|
function peg$parsefield_index_syntax() {
|
|
1073
923
|
var s0, s1, s2, s3;
|
|
1074
924
|
s0 = peg$currPos;
|
|
1075
925
|
s1 = peg$parseindex();
|
|
1076
|
-
|
|
1077
926
|
if (s1 !== peg$FAILED) {
|
|
1078
927
|
s2 = [];
|
|
1079
928
|
s3 = peg$parsesp();
|
|
1080
|
-
|
|
1081
929
|
if (s3 !== peg$FAILED) {
|
|
1082
930
|
while (s3 !== peg$FAILED) {
|
|
1083
931
|
s2.push(s3);
|
|
@@ -1086,10 +934,8 @@ function peg$parse(input, options) {
|
|
|
1086
934
|
} else {
|
|
1087
935
|
s2 = peg$FAILED;
|
|
1088
936
|
}
|
|
1089
|
-
|
|
1090
937
|
if (s2 !== peg$FAILED) {
|
|
1091
938
|
s3 = peg$parsewhateters();
|
|
1092
|
-
|
|
1093
939
|
if (s3 !== peg$FAILED) {
|
|
1094
940
|
s1 = [s1, s2, s3];
|
|
1095
941
|
s0 = s1;
|
|
@@ -1105,19 +951,15 @@ function peg$parse(input, options) {
|
|
|
1105
951
|
peg$currPos = s0;
|
|
1106
952
|
s0 = peg$FAILED;
|
|
1107
953
|
}
|
|
1108
|
-
|
|
1109
954
|
return s0;
|
|
1110
955
|
}
|
|
1111
|
-
|
|
1112
956
|
function peg$parsefield_reference_syntax() {
|
|
1113
957
|
var s0, s1, s2, s3;
|
|
1114
958
|
s0 = peg$currPos;
|
|
1115
959
|
s1 = peg$parsereferences();
|
|
1116
|
-
|
|
1117
960
|
if (s1 !== peg$FAILED) {
|
|
1118
961
|
s2 = [];
|
|
1119
962
|
s3 = peg$parsesp();
|
|
1120
|
-
|
|
1121
963
|
if (s3 !== peg$FAILED) {
|
|
1122
964
|
while (s3 !== peg$FAILED) {
|
|
1123
965
|
s2.push(s3);
|
|
@@ -1126,10 +968,8 @@ function peg$parse(input, options) {
|
|
|
1126
968
|
} else {
|
|
1127
969
|
s2 = peg$FAILED;
|
|
1128
970
|
}
|
|
1129
|
-
|
|
1130
971
|
if (s2 !== peg$FAILED) {
|
|
1131
972
|
s3 = peg$parsereference_value();
|
|
1132
|
-
|
|
1133
973
|
if (s3 !== peg$FAILED) {
|
|
1134
974
|
peg$savedPos = s0;
|
|
1135
975
|
s1 = peg$c16(s3);
|
|
@@ -1146,19 +986,15 @@ function peg$parse(input, options) {
|
|
|
1146
986
|
peg$currPos = s0;
|
|
1147
987
|
s0 = peg$FAILED;
|
|
1148
988
|
}
|
|
1149
|
-
|
|
1150
989
|
return s0;
|
|
1151
990
|
}
|
|
1152
|
-
|
|
1153
991
|
function peg$parsefield_type_syntax() {
|
|
1154
992
|
var s0, s1, s2, s3;
|
|
1155
993
|
s0 = peg$currPos;
|
|
1156
994
|
s1 = peg$parsefield_type();
|
|
1157
|
-
|
|
1158
995
|
if (s1 !== peg$FAILED) {
|
|
1159
996
|
s2 = [];
|
|
1160
997
|
s3 = peg$parsesp();
|
|
1161
|
-
|
|
1162
998
|
if (s3 !== peg$FAILED) {
|
|
1163
999
|
while (s3 !== peg$FAILED) {
|
|
1164
1000
|
s2.push(s3);
|
|
@@ -1167,10 +1003,8 @@ function peg$parse(input, options) {
|
|
|
1167
1003
|
} else {
|
|
1168
1004
|
s2 = peg$FAILED;
|
|
1169
1005
|
}
|
|
1170
|
-
|
|
1171
1006
|
if (s2 !== peg$FAILED) {
|
|
1172
1007
|
s3 = peg$parsename();
|
|
1173
|
-
|
|
1174
1008
|
if (s3 !== peg$FAILED) {
|
|
1175
1009
|
peg$savedPos = s0;
|
|
1176
1010
|
s1 = peg$c17(s1, s3);
|
|
@@ -1187,28 +1021,22 @@ function peg$parse(input, options) {
|
|
|
1187
1021
|
peg$currPos = s0;
|
|
1188
1022
|
s0 = peg$FAILED;
|
|
1189
1023
|
}
|
|
1190
|
-
|
|
1191
1024
|
return s0;
|
|
1192
1025
|
}
|
|
1193
|
-
|
|
1194
1026
|
function peg$parsereference_value() {
|
|
1195
1027
|
var s0, s1, s2;
|
|
1196
1028
|
s0 = peg$currPos;
|
|
1197
|
-
|
|
1198
1029
|
if (input.charCodeAt(peg$currPos) === 58) {
|
|
1199
1030
|
s1 = peg$c6;
|
|
1200
1031
|
peg$currPos++;
|
|
1201
1032
|
} else {
|
|
1202
1033
|
s1 = peg$FAILED;
|
|
1203
|
-
|
|
1204
1034
|
if (peg$silentFails === 0) {
|
|
1205
1035
|
peg$fail(peg$c7);
|
|
1206
1036
|
}
|
|
1207
1037
|
}
|
|
1208
|
-
|
|
1209
1038
|
if (s1 !== peg$FAILED) {
|
|
1210
1039
|
s2 = peg$parsevariable();
|
|
1211
|
-
|
|
1212
1040
|
if (s2 !== peg$FAILED) {
|
|
1213
1041
|
peg$savedPos = s0;
|
|
1214
1042
|
s1 = peg$c18(s2);
|
|
@@ -1221,146 +1049,112 @@ function peg$parse(input, options) {
|
|
|
1221
1049
|
peg$currPos = s0;
|
|
1222
1050
|
s0 = peg$FAILED;
|
|
1223
1051
|
}
|
|
1224
|
-
|
|
1225
1052
|
if (s0 === peg$FAILED) {
|
|
1226
1053
|
s0 = peg$currPos;
|
|
1227
1054
|
s1 = peg$parsename();
|
|
1228
|
-
|
|
1229
1055
|
if (s1 !== peg$FAILED) {
|
|
1230
1056
|
peg$savedPos = s0;
|
|
1231
1057
|
s1 = peg$c18(s1);
|
|
1232
1058
|
}
|
|
1233
|
-
|
|
1234
1059
|
s0 = s1;
|
|
1235
1060
|
}
|
|
1236
|
-
|
|
1237
1061
|
return s0;
|
|
1238
1062
|
}
|
|
1239
|
-
|
|
1240
1063
|
function peg$parsereferential_actions() {
|
|
1241
1064
|
var s0;
|
|
1242
|
-
|
|
1243
1065
|
if (input.substr(peg$currPos, 9).toLowerCase() === peg$c19) {
|
|
1244
1066
|
s0 = input.substr(peg$currPos, 9);
|
|
1245
1067
|
peg$currPos += 9;
|
|
1246
1068
|
} else {
|
|
1247
1069
|
s0 = peg$FAILED;
|
|
1248
|
-
|
|
1249
1070
|
if (peg$silentFails === 0) {
|
|
1250
1071
|
peg$fail(peg$c20);
|
|
1251
1072
|
}
|
|
1252
1073
|
}
|
|
1253
|
-
|
|
1254
1074
|
if (s0 === peg$FAILED) {
|
|
1255
1075
|
if (input.substr(peg$currPos, 9).toLowerCase() === peg$c21) {
|
|
1256
1076
|
s0 = input.substr(peg$currPos, 9);
|
|
1257
1077
|
peg$currPos += 9;
|
|
1258
1078
|
} else {
|
|
1259
1079
|
s0 = peg$FAILED;
|
|
1260
|
-
|
|
1261
1080
|
if (peg$silentFails === 0) {
|
|
1262
1081
|
peg$fail(peg$c22);
|
|
1263
1082
|
}
|
|
1264
1083
|
}
|
|
1265
1084
|
}
|
|
1266
|
-
|
|
1267
1085
|
return s0;
|
|
1268
1086
|
}
|
|
1269
|
-
|
|
1270
1087
|
function peg$parseadd_index() {
|
|
1271
1088
|
var s0, s1;
|
|
1272
1089
|
peg$silentFails++;
|
|
1273
|
-
|
|
1274
1090
|
if (input.substr(peg$currPos, 9) === peg$c24) {
|
|
1275
1091
|
s0 = peg$c24;
|
|
1276
1092
|
peg$currPos += 9;
|
|
1277
1093
|
} else {
|
|
1278
1094
|
s0 = peg$FAILED;
|
|
1279
|
-
|
|
1280
1095
|
if (peg$silentFails === 0) {
|
|
1281
1096
|
peg$fail(peg$c25);
|
|
1282
1097
|
}
|
|
1283
1098
|
}
|
|
1284
|
-
|
|
1285
1099
|
peg$silentFails--;
|
|
1286
|
-
|
|
1287
1100
|
if (s0 === peg$FAILED) {
|
|
1288
1101
|
s1 = peg$FAILED;
|
|
1289
|
-
|
|
1290
1102
|
if (peg$silentFails === 0) {
|
|
1291
1103
|
peg$fail(peg$c23);
|
|
1292
1104
|
}
|
|
1293
1105
|
}
|
|
1294
|
-
|
|
1295
1106
|
return s0;
|
|
1296
1107
|
}
|
|
1297
|
-
|
|
1298
1108
|
function peg$parseschema_define() {
|
|
1299
1109
|
var s0, s1;
|
|
1300
1110
|
peg$silentFails++;
|
|
1301
|
-
|
|
1302
1111
|
if (input.substr(peg$currPos, 27) === peg$c27) {
|
|
1303
1112
|
s0 = peg$c27;
|
|
1304
1113
|
peg$currPos += 27;
|
|
1305
1114
|
} else {
|
|
1306
1115
|
s0 = peg$FAILED;
|
|
1307
|
-
|
|
1308
1116
|
if (peg$silentFails === 0) {
|
|
1309
1117
|
peg$fail(peg$c28);
|
|
1310
1118
|
}
|
|
1311
1119
|
}
|
|
1312
|
-
|
|
1313
1120
|
peg$silentFails--;
|
|
1314
|
-
|
|
1315
1121
|
if (s0 === peg$FAILED) {
|
|
1316
1122
|
s1 = peg$FAILED;
|
|
1317
|
-
|
|
1318
1123
|
if (peg$silentFails === 0) {
|
|
1319
1124
|
peg$fail(peg$c26);
|
|
1320
1125
|
}
|
|
1321
1126
|
}
|
|
1322
|
-
|
|
1323
1127
|
return s0;
|
|
1324
1128
|
}
|
|
1325
|
-
|
|
1326
1129
|
function peg$parsecreate_table() {
|
|
1327
1130
|
var s0, s1;
|
|
1328
1131
|
peg$silentFails++;
|
|
1329
|
-
|
|
1330
1132
|
if (input.substr(peg$currPos, 12).toLowerCase() === peg$c30) {
|
|
1331
1133
|
s0 = input.substr(peg$currPos, 12);
|
|
1332
1134
|
peg$currPos += 12;
|
|
1333
1135
|
} else {
|
|
1334
1136
|
s0 = peg$FAILED;
|
|
1335
|
-
|
|
1336
1137
|
if (peg$silentFails === 0) {
|
|
1337
1138
|
peg$fail(peg$c31);
|
|
1338
1139
|
}
|
|
1339
1140
|
}
|
|
1340
|
-
|
|
1341
1141
|
peg$silentFails--;
|
|
1342
|
-
|
|
1343
1142
|
if (s0 === peg$FAILED) {
|
|
1344
1143
|
s1 = peg$FAILED;
|
|
1345
|
-
|
|
1346
1144
|
if (peg$silentFails === 0) {
|
|
1347
1145
|
peg$fail(peg$c29);
|
|
1348
1146
|
}
|
|
1349
1147
|
}
|
|
1350
|
-
|
|
1351
1148
|
return s0;
|
|
1352
1149
|
}
|
|
1353
|
-
|
|
1354
1150
|
function peg$parseend_create_table() {
|
|
1355
1151
|
var s0, s1, s2, s3, s4, s5, s6;
|
|
1356
1152
|
peg$silentFails++;
|
|
1357
1153
|
s0 = peg$currPos;
|
|
1358
1154
|
s1 = peg$parsedo();
|
|
1359
|
-
|
|
1360
1155
|
if (s1 !== peg$FAILED) {
|
|
1361
1156
|
s2 = [];
|
|
1362
1157
|
s3 = peg$parsesp();
|
|
1363
|
-
|
|
1364
1158
|
if (s3 !== peg$FAILED) {
|
|
1365
1159
|
while (s3 !== peg$FAILED) {
|
|
1366
1160
|
s2.push(s3);
|
|
@@ -1369,19 +1163,14 @@ function peg$parse(input, options) {
|
|
|
1369
1163
|
} else {
|
|
1370
1164
|
s2 = peg$FAILED;
|
|
1371
1165
|
}
|
|
1372
|
-
|
|
1373
1166
|
if (s2 !== peg$FAILED) {
|
|
1374
1167
|
s3 = peg$parseabs();
|
|
1375
|
-
|
|
1376
1168
|
if (s3 !== peg$FAILED) {
|
|
1377
1169
|
s4 = peg$parsecharacter();
|
|
1378
|
-
|
|
1379
1170
|
if (s4 !== peg$FAILED) {
|
|
1380
1171
|
s5 = peg$parseabs();
|
|
1381
|
-
|
|
1382
1172
|
if (s5 !== peg$FAILED) {
|
|
1383
1173
|
s6 = peg$parseendline();
|
|
1384
|
-
|
|
1385
1174
|
if (s6 !== peg$FAILED) {
|
|
1386
1175
|
s1 = [s1, s2, s3, s4, s5, s6];
|
|
1387
1176
|
s0 = s1;
|
|
@@ -1409,38 +1198,30 @@ function peg$parse(input, options) {
|
|
|
1409
1198
|
peg$currPos = s0;
|
|
1410
1199
|
s0 = peg$FAILED;
|
|
1411
1200
|
}
|
|
1412
|
-
|
|
1413
1201
|
peg$silentFails--;
|
|
1414
|
-
|
|
1415
1202
|
if (s0 === peg$FAILED) {
|
|
1416
1203
|
s1 = peg$FAILED;
|
|
1417
|
-
|
|
1418
1204
|
if (peg$silentFails === 0) {
|
|
1419
1205
|
peg$fail(peg$c32);
|
|
1420
1206
|
}
|
|
1421
1207
|
}
|
|
1422
|
-
|
|
1423
1208
|
return s0;
|
|
1424
1209
|
}
|
|
1425
|
-
|
|
1426
1210
|
function peg$parseindex() {
|
|
1427
1211
|
var s0, s1, s2;
|
|
1428
1212
|
peg$silentFails++;
|
|
1429
1213
|
s0 = peg$currPos;
|
|
1430
1214
|
s1 = peg$parsecharacter();
|
|
1431
|
-
|
|
1432
1215
|
if (s1 !== peg$FAILED) {
|
|
1433
1216
|
if (input.substr(peg$currPos, 6) === peg$c34) {
|
|
1434
1217
|
s2 = peg$c34;
|
|
1435
1218
|
peg$currPos += 6;
|
|
1436
1219
|
} else {
|
|
1437
1220
|
s2 = peg$FAILED;
|
|
1438
|
-
|
|
1439
1221
|
if (peg$silentFails === 0) {
|
|
1440
1222
|
peg$fail(peg$c35);
|
|
1441
1223
|
}
|
|
1442
1224
|
}
|
|
1443
|
-
|
|
1444
1225
|
if (s2 !== peg$FAILED) {
|
|
1445
1226
|
s1 = [s1, s2];
|
|
1446
1227
|
s0 = s1;
|
|
@@ -1452,38 +1233,30 @@ function peg$parse(input, options) {
|
|
|
1452
1233
|
peg$currPos = s0;
|
|
1453
1234
|
s0 = peg$FAILED;
|
|
1454
1235
|
}
|
|
1455
|
-
|
|
1456
1236
|
peg$silentFails--;
|
|
1457
|
-
|
|
1458
1237
|
if (s0 === peg$FAILED) {
|
|
1459
1238
|
s1 = peg$FAILED;
|
|
1460
|
-
|
|
1461
1239
|
if (peg$silentFails === 0) {
|
|
1462
1240
|
peg$fail(peg$c33);
|
|
1463
1241
|
}
|
|
1464
1242
|
}
|
|
1465
|
-
|
|
1466
1243
|
return s0;
|
|
1467
1244
|
}
|
|
1468
|
-
|
|
1469
1245
|
function peg$parsereferences() {
|
|
1470
1246
|
var s0, s1, s2;
|
|
1471
1247
|
peg$silentFails++;
|
|
1472
1248
|
s0 = peg$currPos;
|
|
1473
1249
|
s1 = peg$parsecharacter();
|
|
1474
|
-
|
|
1475
1250
|
if (s1 !== peg$FAILED) {
|
|
1476
1251
|
if (input.substr(peg$currPos, 11) === peg$c37) {
|
|
1477
1252
|
s2 = peg$c37;
|
|
1478
1253
|
peg$currPos += 11;
|
|
1479
1254
|
} else {
|
|
1480
1255
|
s2 = peg$FAILED;
|
|
1481
|
-
|
|
1482
1256
|
if (peg$silentFails === 0) {
|
|
1483
1257
|
peg$fail(peg$c38);
|
|
1484
1258
|
}
|
|
1485
1259
|
}
|
|
1486
|
-
|
|
1487
1260
|
if (s2 !== peg$FAILED) {
|
|
1488
1261
|
s1 = [s1, s2];
|
|
1489
1262
|
s0 = s1;
|
|
@@ -1495,211 +1268,160 @@ function peg$parse(input, options) {
|
|
|
1495
1268
|
peg$currPos = s0;
|
|
1496
1269
|
s0 = peg$FAILED;
|
|
1497
1270
|
}
|
|
1498
|
-
|
|
1499
1271
|
peg$silentFails--;
|
|
1500
|
-
|
|
1501
1272
|
if (s0 === peg$FAILED) {
|
|
1502
1273
|
s1 = peg$FAILED;
|
|
1503
|
-
|
|
1504
1274
|
if (peg$silentFails === 0) {
|
|
1505
1275
|
peg$fail(peg$c36);
|
|
1506
1276
|
}
|
|
1507
1277
|
}
|
|
1508
|
-
|
|
1509
1278
|
return s0;
|
|
1510
1279
|
}
|
|
1511
|
-
|
|
1512
1280
|
function peg$parseadd_foreign_key() {
|
|
1513
1281
|
var s0, s1;
|
|
1514
1282
|
peg$silentFails++;
|
|
1515
|
-
|
|
1516
1283
|
if (input.substr(peg$currPos, 15).toLowerCase() === peg$c40) {
|
|
1517
1284
|
s0 = input.substr(peg$currPos, 15);
|
|
1518
1285
|
peg$currPos += 15;
|
|
1519
1286
|
} else {
|
|
1520
1287
|
s0 = peg$FAILED;
|
|
1521
|
-
|
|
1522
1288
|
if (peg$silentFails === 0) {
|
|
1523
1289
|
peg$fail(peg$c41);
|
|
1524
1290
|
}
|
|
1525
1291
|
}
|
|
1526
|
-
|
|
1527
1292
|
peg$silentFails--;
|
|
1528
|
-
|
|
1529
1293
|
if (s0 === peg$FAILED) {
|
|
1530
1294
|
s1 = peg$FAILED;
|
|
1531
|
-
|
|
1532
1295
|
if (peg$silentFails === 0) {
|
|
1533
1296
|
peg$fail(peg$c39);
|
|
1534
1297
|
}
|
|
1535
1298
|
}
|
|
1536
|
-
|
|
1537
1299
|
return s0;
|
|
1538
1300
|
}
|
|
1539
|
-
|
|
1540
1301
|
function peg$parsecolumn() {
|
|
1541
1302
|
var s0, s1;
|
|
1542
1303
|
peg$silentFails++;
|
|
1543
|
-
|
|
1544
1304
|
if (input.substr(peg$currPos, 6) === peg$c43) {
|
|
1545
1305
|
s0 = peg$c43;
|
|
1546
1306
|
peg$currPos += 6;
|
|
1547
1307
|
} else {
|
|
1548
1308
|
s0 = peg$FAILED;
|
|
1549
|
-
|
|
1550
1309
|
if (peg$silentFails === 0) {
|
|
1551
1310
|
peg$fail(peg$c44);
|
|
1552
1311
|
}
|
|
1553
1312
|
}
|
|
1554
|
-
|
|
1555
1313
|
peg$silentFails--;
|
|
1556
|
-
|
|
1557
1314
|
if (s0 === peg$FAILED) {
|
|
1558
1315
|
s1 = peg$FAILED;
|
|
1559
|
-
|
|
1560
1316
|
if (peg$silentFails === 0) {
|
|
1561
1317
|
peg$fail(peg$c42);
|
|
1562
1318
|
}
|
|
1563
1319
|
}
|
|
1564
|
-
|
|
1565
1320
|
return s0;
|
|
1566
1321
|
}
|
|
1567
|
-
|
|
1568
1322
|
function peg$parseprimary_key() {
|
|
1569
1323
|
var s0, s1;
|
|
1570
1324
|
peg$silentFails++;
|
|
1571
|
-
|
|
1572
1325
|
if (input.substr(peg$currPos, 11) === peg$c46) {
|
|
1573
1326
|
s0 = peg$c46;
|
|
1574
1327
|
peg$currPos += 11;
|
|
1575
1328
|
} else {
|
|
1576
1329
|
s0 = peg$FAILED;
|
|
1577
|
-
|
|
1578
1330
|
if (peg$silentFails === 0) {
|
|
1579
1331
|
peg$fail(peg$c47);
|
|
1580
1332
|
}
|
|
1581
1333
|
}
|
|
1582
|
-
|
|
1583
1334
|
peg$silentFails--;
|
|
1584
|
-
|
|
1585
1335
|
if (s0 === peg$FAILED) {
|
|
1586
1336
|
s1 = peg$FAILED;
|
|
1587
|
-
|
|
1588
1337
|
if (peg$silentFails === 0) {
|
|
1589
1338
|
peg$fail(peg$c45);
|
|
1590
1339
|
}
|
|
1591
1340
|
}
|
|
1592
|
-
|
|
1593
1341
|
return s0;
|
|
1594
1342
|
}
|
|
1595
|
-
|
|
1596
1343
|
function peg$parseversion() {
|
|
1597
1344
|
var s0;
|
|
1598
|
-
|
|
1599
1345
|
if (input.substr(peg$currPos, 7) === peg$c48) {
|
|
1600
1346
|
s0 = peg$c48;
|
|
1601
1347
|
peg$currPos += 7;
|
|
1602
1348
|
} else {
|
|
1603
1349
|
s0 = peg$FAILED;
|
|
1604
|
-
|
|
1605
1350
|
if (peg$silentFails === 0) {
|
|
1606
1351
|
peg$fail(peg$c49);
|
|
1607
1352
|
}
|
|
1608
1353
|
}
|
|
1609
|
-
|
|
1610
1354
|
return s0;
|
|
1611
1355
|
}
|
|
1612
|
-
|
|
1613
1356
|
function peg$parsedo() {
|
|
1614
1357
|
var s0;
|
|
1615
|
-
|
|
1616
1358
|
if (input.substr(peg$currPos, 2) === peg$c50) {
|
|
1617
1359
|
s0 = peg$c50;
|
|
1618
1360
|
peg$currPos += 2;
|
|
1619
1361
|
} else {
|
|
1620
1362
|
s0 = peg$FAILED;
|
|
1621
|
-
|
|
1622
1363
|
if (peg$silentFails === 0) {
|
|
1623
1364
|
peg$fail(peg$c51);
|
|
1624
1365
|
}
|
|
1625
1366
|
}
|
|
1626
|
-
|
|
1627
1367
|
return s0;
|
|
1628
1368
|
}
|
|
1629
|
-
|
|
1630
1369
|
function peg$parseend() {
|
|
1631
1370
|
var s0;
|
|
1632
|
-
|
|
1633
1371
|
if (input.substr(peg$currPos, 3) === peg$c52) {
|
|
1634
1372
|
s0 = peg$c52;
|
|
1635
1373
|
peg$currPos += 3;
|
|
1636
1374
|
} else {
|
|
1637
1375
|
s0 = peg$FAILED;
|
|
1638
|
-
|
|
1639
1376
|
if (peg$silentFails === 0) {
|
|
1640
1377
|
peg$fail(peg$c53);
|
|
1641
1378
|
}
|
|
1642
1379
|
}
|
|
1643
|
-
|
|
1644
1380
|
return s0;
|
|
1645
1381
|
}
|
|
1646
|
-
|
|
1647
1382
|
function peg$parselambda_function() {
|
|
1648
1383
|
var s0, s1;
|
|
1649
1384
|
peg$silentFails++;
|
|
1650
|
-
|
|
1651
1385
|
if (input.substr(peg$currPos, 2) === peg$c55) {
|
|
1652
1386
|
s0 = peg$c55;
|
|
1653
1387
|
peg$currPos += 2;
|
|
1654
1388
|
} else {
|
|
1655
1389
|
s0 = peg$FAILED;
|
|
1656
|
-
|
|
1657
1390
|
if (peg$silentFails === 0) {
|
|
1658
1391
|
peg$fail(peg$c56);
|
|
1659
1392
|
}
|
|
1660
1393
|
}
|
|
1661
|
-
|
|
1662
1394
|
if (s0 === peg$FAILED) {
|
|
1663
1395
|
if (input.substr(peg$currPos, 2) === peg$c57) {
|
|
1664
1396
|
s0 = peg$c57;
|
|
1665
1397
|
peg$currPos += 2;
|
|
1666
1398
|
} else {
|
|
1667
1399
|
s0 = peg$FAILED;
|
|
1668
|
-
|
|
1669
1400
|
if (peg$silentFails === 0) {
|
|
1670
1401
|
peg$fail(peg$c58);
|
|
1671
1402
|
}
|
|
1672
1403
|
}
|
|
1673
1404
|
}
|
|
1674
|
-
|
|
1675
1405
|
peg$silentFails--;
|
|
1676
|
-
|
|
1677
1406
|
if (s0 === peg$FAILED) {
|
|
1678
1407
|
s1 = peg$FAILED;
|
|
1679
|
-
|
|
1680
1408
|
if (peg$silentFails === 0) {
|
|
1681
1409
|
peg$fail(peg$c54);
|
|
1682
1410
|
}
|
|
1683
1411
|
}
|
|
1684
|
-
|
|
1685
1412
|
return s0;
|
|
1686
1413
|
}
|
|
1687
|
-
|
|
1688
1414
|
function peg$parseother_class_prop() {
|
|
1689
1415
|
var s0, s1, s2, s3;
|
|
1690
1416
|
s0 = peg$currPos;
|
|
1691
1417
|
s1 = peg$parsevariable();
|
|
1692
|
-
|
|
1693
1418
|
if (s1 !== peg$FAILED) {
|
|
1694
1419
|
s2 = peg$parsewhateters();
|
|
1695
|
-
|
|
1696
1420
|
if (s2 !== peg$FAILED) {
|
|
1697
1421
|
s3 = peg$parseendline();
|
|
1698
|
-
|
|
1699
1422
|
if (s3 === peg$FAILED) {
|
|
1700
1423
|
s3 = null;
|
|
1701
1424
|
}
|
|
1702
|
-
|
|
1703
1425
|
if (s3 !== peg$FAILED) {
|
|
1704
1426
|
s1 = [s1, s2, s3];
|
|
1705
1427
|
s0 = s1;
|
|
@@ -1715,58 +1437,45 @@ function peg$parse(input, options) {
|
|
|
1715
1437
|
peg$currPos = s0;
|
|
1716
1438
|
s0 = peg$FAILED;
|
|
1717
1439
|
}
|
|
1718
|
-
|
|
1719
1440
|
return s0;
|
|
1720
1441
|
}
|
|
1721
|
-
|
|
1722
1442
|
function peg$parsename() {
|
|
1723
1443
|
var s0;
|
|
1724
1444
|
s0 = peg$parsedouble_quote_name();
|
|
1725
|
-
|
|
1726
1445
|
if (s0 === peg$FAILED) {
|
|
1727
1446
|
s0 = peg$parsesingle_quote_name();
|
|
1728
1447
|
}
|
|
1729
|
-
|
|
1730
1448
|
return s0;
|
|
1731
1449
|
}
|
|
1732
|
-
|
|
1733
1450
|
function peg$parsedouble_quote_name() {
|
|
1734
1451
|
var s0, s1, s2, s3;
|
|
1735
1452
|
s0 = peg$currPos;
|
|
1736
1453
|
s1 = peg$parsedouble_quote();
|
|
1737
|
-
|
|
1738
1454
|
if (s1 !== peg$FAILED) {
|
|
1739
1455
|
s2 = [];
|
|
1740
|
-
|
|
1741
1456
|
if (peg$c59.test(input.charAt(peg$currPos))) {
|
|
1742
1457
|
s3 = input.charAt(peg$currPos);
|
|
1743
1458
|
peg$currPos++;
|
|
1744
1459
|
} else {
|
|
1745
1460
|
s3 = peg$FAILED;
|
|
1746
|
-
|
|
1747
1461
|
if (peg$silentFails === 0) {
|
|
1748
1462
|
peg$fail(peg$c60);
|
|
1749
1463
|
}
|
|
1750
1464
|
}
|
|
1751
|
-
|
|
1752
1465
|
while (s3 !== peg$FAILED) {
|
|
1753
1466
|
s2.push(s3);
|
|
1754
|
-
|
|
1755
1467
|
if (peg$c59.test(input.charAt(peg$currPos))) {
|
|
1756
1468
|
s3 = input.charAt(peg$currPos);
|
|
1757
1469
|
peg$currPos++;
|
|
1758
1470
|
} else {
|
|
1759
1471
|
s3 = peg$FAILED;
|
|
1760
|
-
|
|
1761
1472
|
if (peg$silentFails === 0) {
|
|
1762
1473
|
peg$fail(peg$c60);
|
|
1763
1474
|
}
|
|
1764
1475
|
}
|
|
1765
1476
|
}
|
|
1766
|
-
|
|
1767
1477
|
if (s2 !== peg$FAILED) {
|
|
1768
1478
|
s3 = peg$parsedouble_quote();
|
|
1769
|
-
|
|
1770
1479
|
if (s3 !== peg$FAILED) {
|
|
1771
1480
|
peg$savedPos = s0;
|
|
1772
1481
|
s1 = peg$c61(s2);
|
|
@@ -1783,47 +1492,37 @@ function peg$parse(input, options) {
|
|
|
1783
1492
|
peg$currPos = s0;
|
|
1784
1493
|
s0 = peg$FAILED;
|
|
1785
1494
|
}
|
|
1786
|
-
|
|
1787
1495
|
return s0;
|
|
1788
1496
|
}
|
|
1789
|
-
|
|
1790
1497
|
function peg$parsesingle_quote_name() {
|
|
1791
1498
|
var s0, s1, s2, s3;
|
|
1792
1499
|
s0 = peg$currPos;
|
|
1793
1500
|
s1 = peg$parsesingle_quote();
|
|
1794
|
-
|
|
1795
1501
|
if (s1 !== peg$FAILED) {
|
|
1796
1502
|
s2 = [];
|
|
1797
|
-
|
|
1798
1503
|
if (peg$c62.test(input.charAt(peg$currPos))) {
|
|
1799
1504
|
s3 = input.charAt(peg$currPos);
|
|
1800
1505
|
peg$currPos++;
|
|
1801
1506
|
} else {
|
|
1802
1507
|
s3 = peg$FAILED;
|
|
1803
|
-
|
|
1804
1508
|
if (peg$silentFails === 0) {
|
|
1805
1509
|
peg$fail(peg$c63);
|
|
1806
1510
|
}
|
|
1807
1511
|
}
|
|
1808
|
-
|
|
1809
1512
|
while (s3 !== peg$FAILED) {
|
|
1810
1513
|
s2.push(s3);
|
|
1811
|
-
|
|
1812
1514
|
if (peg$c62.test(input.charAt(peg$currPos))) {
|
|
1813
1515
|
s3 = input.charAt(peg$currPos);
|
|
1814
1516
|
peg$currPos++;
|
|
1815
1517
|
} else {
|
|
1816
1518
|
s3 = peg$FAILED;
|
|
1817
|
-
|
|
1818
1519
|
if (peg$silentFails === 0) {
|
|
1819
1520
|
peg$fail(peg$c63);
|
|
1820
1521
|
}
|
|
1821
1522
|
}
|
|
1822
1523
|
}
|
|
1823
|
-
|
|
1824
1524
|
if (s2 !== peg$FAILED) {
|
|
1825
1525
|
s3 = peg$parsesingle_quote();
|
|
1826
|
-
|
|
1827
1526
|
if (s3 !== peg$FAILED) {
|
|
1828
1527
|
peg$savedPos = s0;
|
|
1829
1528
|
s1 = peg$c61(s2);
|
|
@@ -1840,34 +1539,27 @@ function peg$parse(input, options) {
|
|
|
1840
1539
|
peg$currPos = s0;
|
|
1841
1540
|
s0 = peg$FAILED;
|
|
1842
1541
|
}
|
|
1843
|
-
|
|
1844
1542
|
return s0;
|
|
1845
1543
|
}
|
|
1846
|
-
|
|
1847
1544
|
function peg$parsesymbol() {
|
|
1848
1545
|
var s0, s1, s2, s3;
|
|
1849
1546
|
s0 = peg$currPos;
|
|
1850
|
-
|
|
1851
1547
|
if (input.charCodeAt(peg$currPos) === 58) {
|
|
1852
1548
|
s1 = peg$c6;
|
|
1853
1549
|
peg$currPos++;
|
|
1854
1550
|
} else {
|
|
1855
1551
|
s1 = peg$FAILED;
|
|
1856
|
-
|
|
1857
1552
|
if (peg$silentFails === 0) {
|
|
1858
1553
|
peg$fail(peg$c7);
|
|
1859
1554
|
}
|
|
1860
1555
|
}
|
|
1861
|
-
|
|
1862
1556
|
if (s1 !== peg$FAILED) {
|
|
1863
1557
|
s2 = [];
|
|
1864
1558
|
s3 = peg$parsecharacter();
|
|
1865
|
-
|
|
1866
1559
|
while (s3 !== peg$FAILED) {
|
|
1867
1560
|
s2.push(s3);
|
|
1868
1561
|
s3 = peg$parsecharacter();
|
|
1869
1562
|
}
|
|
1870
|
-
|
|
1871
1563
|
if (s2 !== peg$FAILED) {
|
|
1872
1564
|
peg$savedPos = s0;
|
|
1873
1565
|
s1 = peg$c61(s2);
|
|
@@ -1880,16 +1572,13 @@ function peg$parse(input, options) {
|
|
|
1880
1572
|
peg$currPos = s0;
|
|
1881
1573
|
s0 = peg$FAILED;
|
|
1882
1574
|
}
|
|
1883
|
-
|
|
1884
1575
|
return s0;
|
|
1885
1576
|
}
|
|
1886
|
-
|
|
1887
1577
|
function peg$parsevariable() {
|
|
1888
1578
|
var s0, s1, s2;
|
|
1889
1579
|
s0 = peg$currPos;
|
|
1890
1580
|
s1 = [];
|
|
1891
1581
|
s2 = peg$parsecharacter();
|
|
1892
|
-
|
|
1893
1582
|
if (s2 !== peg$FAILED) {
|
|
1894
1583
|
while (s2 !== peg$FAILED) {
|
|
1895
1584
|
s1.push(s2);
|
|
@@ -1898,37 +1587,30 @@ function peg$parse(input, options) {
|
|
|
1898
1587
|
} else {
|
|
1899
1588
|
s1 = peg$FAILED;
|
|
1900
1589
|
}
|
|
1901
|
-
|
|
1902
1590
|
if (s1 !== peg$FAILED) {
|
|
1903
1591
|
peg$savedPos = s0;
|
|
1904
1592
|
s1 = peg$c61(s1);
|
|
1905
1593
|
}
|
|
1906
|
-
|
|
1907
1594
|
s0 = s1;
|
|
1908
1595
|
return s0;
|
|
1909
1596
|
}
|
|
1910
|
-
|
|
1911
1597
|
function peg$parsefield_type() {
|
|
1912
1598
|
var s0, s1, s2, s3, s4;
|
|
1913
1599
|
s0 = peg$currPos;
|
|
1914
1600
|
s1 = peg$parsecharacter();
|
|
1915
|
-
|
|
1916
1601
|
if (s1 !== peg$FAILED) {
|
|
1917
1602
|
if (input.charCodeAt(peg$currPos) === 46) {
|
|
1918
1603
|
s2 = peg$c64;
|
|
1919
1604
|
peg$currPos++;
|
|
1920
1605
|
} else {
|
|
1921
1606
|
s2 = peg$FAILED;
|
|
1922
|
-
|
|
1923
1607
|
if (peg$silentFails === 0) {
|
|
1924
1608
|
peg$fail(peg$c65);
|
|
1925
1609
|
}
|
|
1926
1610
|
}
|
|
1927
|
-
|
|
1928
1611
|
if (s2 !== peg$FAILED) {
|
|
1929
1612
|
s3 = [];
|
|
1930
1613
|
s4 = peg$parsecharacter();
|
|
1931
|
-
|
|
1932
1614
|
if (s4 !== peg$FAILED) {
|
|
1933
1615
|
while (s4 !== peg$FAILED) {
|
|
1934
1616
|
s3.push(s4);
|
|
@@ -1937,7 +1619,6 @@ function peg$parse(input, options) {
|
|
|
1937
1619
|
} else {
|
|
1938
1620
|
s3 = peg$FAILED;
|
|
1939
1621
|
}
|
|
1940
|
-
|
|
1941
1622
|
if (s3 !== peg$FAILED) {
|
|
1942
1623
|
peg$savedPos = s0;
|
|
1943
1624
|
s1 = peg$c61(s3);
|
|
@@ -1954,10 +1635,8 @@ function peg$parse(input, options) {
|
|
|
1954
1635
|
peg$currPos = s0;
|
|
1955
1636
|
s0 = peg$FAILED;
|
|
1956
1637
|
}
|
|
1957
|
-
|
|
1958
1638
|
return s0;
|
|
1959
1639
|
}
|
|
1960
|
-
|
|
1961
1640
|
function peg$parsenot_whitespace() {
|
|
1962
1641
|
var s0, s1, s2;
|
|
1963
1642
|
s0 = peg$currPos;
|
|
@@ -1965,26 +1644,22 @@ function peg$parse(input, options) {
|
|
|
1965
1644
|
peg$silentFails++;
|
|
1966
1645
|
s2 = peg$parsewhitespace();
|
|
1967
1646
|
peg$silentFails--;
|
|
1968
|
-
|
|
1969
1647
|
if (s2 === peg$FAILED) {
|
|
1970
1648
|
s1 = void 0;
|
|
1971
1649
|
} else {
|
|
1972
1650
|
peg$currPos = s1;
|
|
1973
1651
|
s1 = peg$FAILED;
|
|
1974
1652
|
}
|
|
1975
|
-
|
|
1976
1653
|
if (s1 !== peg$FAILED) {
|
|
1977
1654
|
if (input.length > peg$currPos) {
|
|
1978
1655
|
s2 = input.charAt(peg$currPos);
|
|
1979
1656
|
peg$currPos++;
|
|
1980
1657
|
} else {
|
|
1981
1658
|
s2 = peg$FAILED;
|
|
1982
|
-
|
|
1983
1659
|
if (peg$silentFails === 0) {
|
|
1984
1660
|
peg$fail(peg$c66);
|
|
1985
1661
|
}
|
|
1986
1662
|
}
|
|
1987
|
-
|
|
1988
1663
|
if (s2 !== peg$FAILED) {
|
|
1989
1664
|
peg$savedPos = s0;
|
|
1990
1665
|
s1 = peg$c67();
|
|
@@ -1997,76 +1672,58 @@ function peg$parse(input, options) {
|
|
|
1997
1672
|
peg$currPos = s0;
|
|
1998
1673
|
s0 = peg$FAILED;
|
|
1999
1674
|
}
|
|
2000
|
-
|
|
2001
1675
|
return s0;
|
|
2002
1676
|
}
|
|
2003
|
-
|
|
2004
1677
|
function peg$parsenumber() {
|
|
2005
1678
|
var s0;
|
|
2006
|
-
|
|
2007
1679
|
if (peg$c68.test(input.charAt(peg$currPos))) {
|
|
2008
1680
|
s0 = input.charAt(peg$currPos);
|
|
2009
1681
|
peg$currPos++;
|
|
2010
1682
|
} else {
|
|
2011
1683
|
s0 = peg$FAILED;
|
|
2012
|
-
|
|
2013
1684
|
if (peg$silentFails === 0) {
|
|
2014
1685
|
peg$fail(peg$c69);
|
|
2015
1686
|
}
|
|
2016
1687
|
}
|
|
2017
|
-
|
|
2018
1688
|
return s0;
|
|
2019
1689
|
}
|
|
2020
|
-
|
|
2021
1690
|
function peg$parsecharacter() {
|
|
2022
1691
|
var s0, s1;
|
|
2023
1692
|
peg$silentFails++;
|
|
2024
|
-
|
|
2025
1693
|
if (peg$c71.test(input.charAt(peg$currPos))) {
|
|
2026
1694
|
s0 = input.charAt(peg$currPos);
|
|
2027
1695
|
peg$currPos++;
|
|
2028
1696
|
} else {
|
|
2029
1697
|
s0 = peg$FAILED;
|
|
2030
|
-
|
|
2031
1698
|
if (peg$silentFails === 0) {
|
|
2032
1699
|
peg$fail(peg$c72);
|
|
2033
1700
|
}
|
|
2034
1701
|
}
|
|
2035
|
-
|
|
2036
1702
|
peg$silentFails--;
|
|
2037
|
-
|
|
2038
1703
|
if (s0 === peg$FAILED) {
|
|
2039
1704
|
s1 = peg$FAILED;
|
|
2040
|
-
|
|
2041
1705
|
if (peg$silentFails === 0) {
|
|
2042
1706
|
peg$fail(peg$c70);
|
|
2043
1707
|
}
|
|
2044
1708
|
}
|
|
2045
|
-
|
|
2046
1709
|
return s0;
|
|
2047
1710
|
}
|
|
2048
|
-
|
|
2049
1711
|
function peg$parseend_line() {
|
|
2050
1712
|
var s0, s1, s2, s3;
|
|
2051
1713
|
s0 = peg$currPos;
|
|
2052
1714
|
s1 = [];
|
|
2053
1715
|
s2 = peg$parsewhitespace();
|
|
2054
|
-
|
|
2055
1716
|
while (s2 !== peg$FAILED) {
|
|
2056
1717
|
s1.push(s2);
|
|
2057
1718
|
s2 = peg$parsewhitespace();
|
|
2058
1719
|
}
|
|
2059
|
-
|
|
2060
1720
|
if (s1 !== peg$FAILED) {
|
|
2061
1721
|
s2 = peg$parseend();
|
|
2062
|
-
|
|
2063
1722
|
if (s2 !== peg$FAILED) {
|
|
2064
1723
|
s3 = peg$parseendline();
|
|
2065
|
-
|
|
2066
1724
|
if (s3 === peg$FAILED) {
|
|
2067
1725
|
s3 = null;
|
|
2068
1726
|
}
|
|
2069
|
-
|
|
2070
1727
|
if (s3 !== peg$FAILED) {
|
|
2071
1728
|
s1 = [s1, s2, s3];
|
|
2072
1729
|
s0 = s1;
|
|
@@ -2082,38 +1739,31 @@ function peg$parse(input, options) {
|
|
|
2082
1739
|
peg$currPos = s0;
|
|
2083
1740
|
s0 = peg$FAILED;
|
|
2084
1741
|
}
|
|
2085
|
-
|
|
2086
1742
|
return s0;
|
|
2087
1743
|
}
|
|
2088
|
-
|
|
2089
1744
|
function peg$parsewhatever_line() {
|
|
2090
1745
|
var s0, s1, s2, s3, s4, s5;
|
|
2091
1746
|
s0 = peg$currPos;
|
|
2092
1747
|
s1 = [];
|
|
2093
1748
|
s2 = peg$parsewhitespace();
|
|
2094
|
-
|
|
2095
1749
|
while (s2 !== peg$FAILED) {
|
|
2096
1750
|
s1.push(s2);
|
|
2097
1751
|
s2 = peg$parsewhitespace();
|
|
2098
1752
|
}
|
|
2099
|
-
|
|
2100
1753
|
if (s1 !== peg$FAILED) {
|
|
2101
1754
|
s2 = peg$currPos;
|
|
2102
1755
|
s3 = peg$parsewhateters();
|
|
2103
|
-
|
|
2104
1756
|
if (s3 !== peg$FAILED) {
|
|
2105
1757
|
s4 = peg$currPos;
|
|
2106
1758
|
peg$silentFails++;
|
|
2107
1759
|
s5 = peg$parseend();
|
|
2108
1760
|
peg$silentFails--;
|
|
2109
|
-
|
|
2110
1761
|
if (s5 === peg$FAILED) {
|
|
2111
1762
|
s4 = void 0;
|
|
2112
1763
|
} else {
|
|
2113
1764
|
peg$currPos = s4;
|
|
2114
1765
|
s4 = peg$FAILED;
|
|
2115
1766
|
}
|
|
2116
|
-
|
|
2117
1767
|
if (s4 !== peg$FAILED) {
|
|
2118
1768
|
s3 = [s3, s4];
|
|
2119
1769
|
s2 = s3;
|
|
@@ -2125,14 +1775,11 @@ function peg$parse(input, options) {
|
|
|
2125
1775
|
peg$currPos = s2;
|
|
2126
1776
|
s2 = peg$FAILED;
|
|
2127
1777
|
}
|
|
2128
|
-
|
|
2129
1778
|
if (s2 !== peg$FAILED) {
|
|
2130
1779
|
s3 = peg$parseendline();
|
|
2131
|
-
|
|
2132
1780
|
if (s3 === peg$FAILED) {
|
|
2133
1781
|
s3 = null;
|
|
2134
1782
|
}
|
|
2135
|
-
|
|
2136
1783
|
if (s3 !== peg$FAILED) {
|
|
2137
1784
|
s1 = [s1, s2, s3];
|
|
2138
1785
|
s0 = s1;
|
|
@@ -2148,44 +1795,35 @@ function peg$parse(input, options) {
|
|
|
2148
1795
|
peg$currPos = s0;
|
|
2149
1796
|
s0 = peg$FAILED;
|
|
2150
1797
|
}
|
|
2151
|
-
|
|
2152
1798
|
return s0;
|
|
2153
1799
|
}
|
|
2154
|
-
|
|
2155
1800
|
function peg$parsecomment_line() {
|
|
2156
1801
|
var s0, s1, s2, s3, s4;
|
|
2157
1802
|
peg$silentFails++;
|
|
2158
1803
|
s0 = peg$currPos;
|
|
2159
1804
|
s1 = [];
|
|
2160
1805
|
s2 = peg$parsewhitespace();
|
|
2161
|
-
|
|
2162
1806
|
while (s2 !== peg$FAILED) {
|
|
2163
1807
|
s1.push(s2);
|
|
2164
1808
|
s2 = peg$parsewhitespace();
|
|
2165
1809
|
}
|
|
2166
|
-
|
|
2167
1810
|
if (s1 !== peg$FAILED) {
|
|
2168
1811
|
if (input.charCodeAt(peg$currPos) === 35) {
|
|
2169
1812
|
s2 = peg$c74;
|
|
2170
1813
|
peg$currPos++;
|
|
2171
1814
|
} else {
|
|
2172
1815
|
s2 = peg$FAILED;
|
|
2173
|
-
|
|
2174
1816
|
if (peg$silentFails === 0) {
|
|
2175
1817
|
peg$fail(peg$c75);
|
|
2176
1818
|
}
|
|
2177
1819
|
}
|
|
2178
|
-
|
|
2179
1820
|
if (s2 !== peg$FAILED) {
|
|
2180
1821
|
s3 = peg$parsewhateters();
|
|
2181
|
-
|
|
2182
1822
|
if (s3 !== peg$FAILED) {
|
|
2183
1823
|
s4 = peg$parseendline();
|
|
2184
|
-
|
|
2185
1824
|
if (s4 === peg$FAILED) {
|
|
2186
1825
|
s4 = null;
|
|
2187
1826
|
}
|
|
2188
|
-
|
|
2189
1827
|
if (s4 !== peg$FAILED) {
|
|
2190
1828
|
s1 = [s1, s2, s3, s4];
|
|
2191
1829
|
s0 = s1;
|
|
@@ -2205,150 +1843,115 @@ function peg$parse(input, options) {
|
|
|
2205
1843
|
peg$currPos = s0;
|
|
2206
1844
|
s0 = peg$FAILED;
|
|
2207
1845
|
}
|
|
2208
|
-
|
|
2209
1846
|
peg$silentFails--;
|
|
2210
|
-
|
|
2211
1847
|
if (s0 === peg$FAILED) {
|
|
2212
1848
|
s1 = peg$FAILED;
|
|
2213
|
-
|
|
2214
1849
|
if (peg$silentFails === 0) {
|
|
2215
1850
|
peg$fail(peg$c73);
|
|
2216
1851
|
}
|
|
2217
1852
|
}
|
|
2218
|
-
|
|
2219
1853
|
return s0;
|
|
2220
1854
|
}
|
|
2221
|
-
|
|
2222
1855
|
function peg$parsewhateters() {
|
|
2223
1856
|
var s0, s1;
|
|
2224
1857
|
peg$silentFails++;
|
|
2225
1858
|
s0 = [];
|
|
2226
|
-
|
|
2227
1859
|
if (peg$c77.test(input.charAt(peg$currPos))) {
|
|
2228
1860
|
s1 = input.charAt(peg$currPos);
|
|
2229
1861
|
peg$currPos++;
|
|
2230
1862
|
} else {
|
|
2231
1863
|
s1 = peg$FAILED;
|
|
2232
|
-
|
|
2233
1864
|
if (peg$silentFails === 0) {
|
|
2234
1865
|
peg$fail(peg$c78);
|
|
2235
1866
|
}
|
|
2236
1867
|
}
|
|
2237
|
-
|
|
2238
1868
|
while (s1 !== peg$FAILED) {
|
|
2239
1869
|
s0.push(s1);
|
|
2240
|
-
|
|
2241
1870
|
if (peg$c77.test(input.charAt(peg$currPos))) {
|
|
2242
1871
|
s1 = input.charAt(peg$currPos);
|
|
2243
1872
|
peg$currPos++;
|
|
2244
1873
|
} else {
|
|
2245
1874
|
s1 = peg$FAILED;
|
|
2246
|
-
|
|
2247
1875
|
if (peg$silentFails === 0) {
|
|
2248
1876
|
peg$fail(peg$c78);
|
|
2249
1877
|
}
|
|
2250
1878
|
}
|
|
2251
1879
|
}
|
|
2252
|
-
|
|
2253
1880
|
peg$silentFails--;
|
|
2254
|
-
|
|
2255
1881
|
if (s0 === peg$FAILED) {
|
|
2256
1882
|
s1 = peg$FAILED;
|
|
2257
|
-
|
|
2258
1883
|
if (peg$silentFails === 0) {
|
|
2259
1884
|
peg$fail(peg$c76);
|
|
2260
1885
|
}
|
|
2261
1886
|
}
|
|
2262
|
-
|
|
2263
1887
|
return s0;
|
|
2264
1888
|
}
|
|
2265
|
-
|
|
2266
1889
|
function peg$parsewhatever() {
|
|
2267
1890
|
var s0;
|
|
2268
|
-
|
|
2269
1891
|
if (peg$c77.test(input.charAt(peg$currPos))) {
|
|
2270
1892
|
s0 = input.charAt(peg$currPos);
|
|
2271
1893
|
peg$currPos++;
|
|
2272
1894
|
} else {
|
|
2273
1895
|
s0 = peg$FAILED;
|
|
2274
|
-
|
|
2275
1896
|
if (peg$silentFails === 0) {
|
|
2276
1897
|
peg$fail(peg$c78);
|
|
2277
1898
|
}
|
|
2278
1899
|
}
|
|
2279
|
-
|
|
2280
1900
|
return s0;
|
|
2281
1901
|
}
|
|
2282
|
-
|
|
2283
1902
|
function peg$parsesingle_quote() {
|
|
2284
1903
|
var s0;
|
|
2285
|
-
|
|
2286
1904
|
if (input.charCodeAt(peg$currPos) === 39) {
|
|
2287
1905
|
s0 = peg$c79;
|
|
2288
1906
|
peg$currPos++;
|
|
2289
1907
|
} else {
|
|
2290
1908
|
s0 = peg$FAILED;
|
|
2291
|
-
|
|
2292
1909
|
if (peg$silentFails === 0) {
|
|
2293
1910
|
peg$fail(peg$c80);
|
|
2294
1911
|
}
|
|
2295
1912
|
}
|
|
2296
|
-
|
|
2297
1913
|
return s0;
|
|
2298
1914
|
}
|
|
2299
|
-
|
|
2300
1915
|
function peg$parsedouble_quote() {
|
|
2301
1916
|
var s0;
|
|
2302
|
-
|
|
2303
1917
|
if (input.charCodeAt(peg$currPos) === 34) {
|
|
2304
1918
|
s0 = peg$c81;
|
|
2305
1919
|
peg$currPos++;
|
|
2306
1920
|
} else {
|
|
2307
1921
|
s0 = peg$FAILED;
|
|
2308
|
-
|
|
2309
1922
|
if (peg$silentFails === 0) {
|
|
2310
1923
|
peg$fail(peg$c82);
|
|
2311
1924
|
}
|
|
2312
1925
|
}
|
|
2313
|
-
|
|
2314
1926
|
return s0;
|
|
2315
1927
|
}
|
|
2316
|
-
|
|
2317
1928
|
function peg$parse_() {
|
|
2318
1929
|
var s0, s1;
|
|
2319
1930
|
s0 = [];
|
|
2320
1931
|
s1 = peg$parsecomment();
|
|
2321
|
-
|
|
2322
1932
|
if (s1 === peg$FAILED) {
|
|
2323
1933
|
s1 = peg$parsewhitespace();
|
|
2324
1934
|
}
|
|
2325
|
-
|
|
2326
1935
|
while (s1 !== peg$FAILED) {
|
|
2327
1936
|
s0.push(s1);
|
|
2328
1937
|
s1 = peg$parsecomment();
|
|
2329
|
-
|
|
2330
1938
|
if (s1 === peg$FAILED) {
|
|
2331
1939
|
s1 = peg$parsewhitespace();
|
|
2332
1940
|
}
|
|
2333
1941
|
}
|
|
2334
|
-
|
|
2335
1942
|
return s0;
|
|
2336
1943
|
}
|
|
2337
|
-
|
|
2338
1944
|
function peg$parse__() {
|
|
2339
1945
|
var s0, s1;
|
|
2340
1946
|
s0 = [];
|
|
2341
1947
|
s1 = peg$parsecomment();
|
|
2342
|
-
|
|
2343
1948
|
if (s1 === peg$FAILED) {
|
|
2344
1949
|
s1 = peg$parsewhitespace();
|
|
2345
1950
|
}
|
|
2346
|
-
|
|
2347
1951
|
if (s1 !== peg$FAILED) {
|
|
2348
1952
|
while (s1 !== peg$FAILED) {
|
|
2349
1953
|
s0.push(s1);
|
|
2350
1954
|
s1 = peg$parsecomment();
|
|
2351
|
-
|
|
2352
1955
|
if (s1 === peg$FAILED) {
|
|
2353
1956
|
s1 = peg$parsewhitespace();
|
|
2354
1957
|
}
|
|
@@ -2356,41 +1959,32 @@ function peg$parse(input, options) {
|
|
|
2356
1959
|
} else {
|
|
2357
1960
|
s0 = peg$FAILED;
|
|
2358
1961
|
}
|
|
2359
|
-
|
|
2360
1962
|
return s0;
|
|
2361
1963
|
}
|
|
2362
|
-
|
|
2363
1964
|
function peg$parseabs() {
|
|
2364
1965
|
var s0;
|
|
2365
|
-
|
|
2366
1966
|
if (input.charCodeAt(peg$currPos) === 124) {
|
|
2367
1967
|
s0 = peg$c83;
|
|
2368
1968
|
peg$currPos++;
|
|
2369
1969
|
} else {
|
|
2370
1970
|
s0 = peg$FAILED;
|
|
2371
|
-
|
|
2372
1971
|
if (peg$silentFails === 0) {
|
|
2373
1972
|
peg$fail(peg$c84);
|
|
2374
1973
|
}
|
|
2375
1974
|
}
|
|
2376
|
-
|
|
2377
1975
|
return s0;
|
|
2378
1976
|
}
|
|
2379
|
-
|
|
2380
1977
|
function peg$parseendline() {
|
|
2381
1978
|
var s0, s1, s2;
|
|
2382
1979
|
s0 = peg$currPos;
|
|
2383
1980
|
s1 = [];
|
|
2384
1981
|
s2 = peg$parsesp();
|
|
2385
|
-
|
|
2386
1982
|
while (s2 !== peg$FAILED) {
|
|
2387
1983
|
s1.push(s2);
|
|
2388
1984
|
s2 = peg$parsesp();
|
|
2389
1985
|
}
|
|
2390
|
-
|
|
2391
1986
|
if (s1 !== peg$FAILED) {
|
|
2392
1987
|
s2 = peg$parsenewline();
|
|
2393
|
-
|
|
2394
1988
|
if (s2 !== peg$FAILED) {
|
|
2395
1989
|
s1 = [s1, s2];
|
|
2396
1990
|
s0 = s1;
|
|
@@ -2402,42 +1996,34 @@ function peg$parse(input, options) {
|
|
|
2402
1996
|
peg$currPos = s0;
|
|
2403
1997
|
s0 = peg$FAILED;
|
|
2404
1998
|
}
|
|
2405
|
-
|
|
2406
1999
|
return s0;
|
|
2407
2000
|
}
|
|
2408
|
-
|
|
2409
2001
|
function peg$parsecomment() {
|
|
2410
2002
|
var s0, s1, s2;
|
|
2411
2003
|
peg$silentFails++;
|
|
2412
2004
|
s0 = peg$currPos;
|
|
2413
|
-
|
|
2414
2005
|
if (input.substr(peg$currPos, 2) === peg$c86) {
|
|
2415
2006
|
s1 = peg$c86;
|
|
2416
2007
|
peg$currPos += 2;
|
|
2417
2008
|
} else {
|
|
2418
2009
|
s1 = peg$FAILED;
|
|
2419
|
-
|
|
2420
2010
|
if (peg$silentFails === 0) {
|
|
2421
2011
|
peg$fail(peg$c87);
|
|
2422
2012
|
}
|
|
2423
2013
|
}
|
|
2424
|
-
|
|
2425
2014
|
if (s1 !== peg$FAILED) {
|
|
2426
2015
|
if (peg$c88.test(input.charAt(peg$currPos))) {
|
|
2427
2016
|
s2 = input.charAt(peg$currPos);
|
|
2428
2017
|
peg$currPos++;
|
|
2429
2018
|
} else {
|
|
2430
2019
|
s2 = peg$FAILED;
|
|
2431
|
-
|
|
2432
2020
|
if (peg$silentFails === 0) {
|
|
2433
2021
|
peg$fail(peg$c89);
|
|
2434
2022
|
}
|
|
2435
2023
|
}
|
|
2436
|
-
|
|
2437
2024
|
if (s2 === peg$FAILED) {
|
|
2438
2025
|
s2 = null;
|
|
2439
2026
|
}
|
|
2440
|
-
|
|
2441
2027
|
if (s2 !== peg$FAILED) {
|
|
2442
2028
|
s1 = [s1, s2];
|
|
2443
2029
|
s0 = s1;
|
|
@@ -2449,115 +2035,87 @@ function peg$parse(input, options) {
|
|
|
2449
2035
|
peg$currPos = s0;
|
|
2450
2036
|
s0 = peg$FAILED;
|
|
2451
2037
|
}
|
|
2452
|
-
|
|
2453
2038
|
peg$silentFails--;
|
|
2454
|
-
|
|
2455
2039
|
if (s0 === peg$FAILED) {
|
|
2456
2040
|
s1 = peg$FAILED;
|
|
2457
|
-
|
|
2458
2041
|
if (peg$silentFails === 0) {
|
|
2459
2042
|
peg$fail(peg$c85);
|
|
2460
2043
|
}
|
|
2461
2044
|
}
|
|
2462
|
-
|
|
2463
2045
|
return s0;
|
|
2464
2046
|
}
|
|
2465
|
-
|
|
2466
2047
|
function peg$parsenewline() {
|
|
2467
2048
|
var s0, s1;
|
|
2468
2049
|
peg$silentFails++;
|
|
2469
|
-
|
|
2470
2050
|
if (input.substr(peg$currPos, 2) === peg$c91) {
|
|
2471
2051
|
s0 = peg$c91;
|
|
2472
2052
|
peg$currPos += 2;
|
|
2473
2053
|
} else {
|
|
2474
2054
|
s0 = peg$FAILED;
|
|
2475
|
-
|
|
2476
2055
|
if (peg$silentFails === 0) {
|
|
2477
2056
|
peg$fail(peg$c92);
|
|
2478
2057
|
}
|
|
2479
2058
|
}
|
|
2480
|
-
|
|
2481
2059
|
if (s0 === peg$FAILED) {
|
|
2482
2060
|
if (input.charCodeAt(peg$currPos) === 10) {
|
|
2483
2061
|
s0 = peg$c93;
|
|
2484
2062
|
peg$currPos++;
|
|
2485
2063
|
} else {
|
|
2486
2064
|
s0 = peg$FAILED;
|
|
2487
|
-
|
|
2488
2065
|
if (peg$silentFails === 0) {
|
|
2489
2066
|
peg$fail(peg$c94);
|
|
2490
2067
|
}
|
|
2491
2068
|
}
|
|
2492
2069
|
}
|
|
2493
|
-
|
|
2494
2070
|
peg$silentFails--;
|
|
2495
|
-
|
|
2496
2071
|
if (s0 === peg$FAILED) {
|
|
2497
2072
|
s1 = peg$FAILED;
|
|
2498
|
-
|
|
2499
2073
|
if (peg$silentFails === 0) {
|
|
2500
2074
|
peg$fail(peg$c90);
|
|
2501
2075
|
}
|
|
2502
2076
|
}
|
|
2503
|
-
|
|
2504
2077
|
return s0;
|
|
2505
2078
|
}
|
|
2506
|
-
|
|
2507
2079
|
function peg$parsewhitespace() {
|
|
2508
2080
|
var s0, s1;
|
|
2509
2081
|
peg$silentFails++;
|
|
2510
|
-
|
|
2511
2082
|
if (peg$c96.test(input.charAt(peg$currPos))) {
|
|
2512
2083
|
s0 = input.charAt(peg$currPos);
|
|
2513
2084
|
peg$currPos++;
|
|
2514
2085
|
} else {
|
|
2515
2086
|
s0 = peg$FAILED;
|
|
2516
|
-
|
|
2517
2087
|
if (peg$silentFails === 0) {
|
|
2518
2088
|
peg$fail(peg$c97);
|
|
2519
2089
|
}
|
|
2520
2090
|
}
|
|
2521
|
-
|
|
2522
2091
|
peg$silentFails--;
|
|
2523
|
-
|
|
2524
2092
|
if (s0 === peg$FAILED) {
|
|
2525
2093
|
s1 = peg$FAILED;
|
|
2526
|
-
|
|
2527
2094
|
if (peg$silentFails === 0) {
|
|
2528
2095
|
peg$fail(peg$c95);
|
|
2529
2096
|
}
|
|
2530
2097
|
}
|
|
2531
|
-
|
|
2532
2098
|
return s0;
|
|
2533
2099
|
}
|
|
2534
|
-
|
|
2535
2100
|
function peg$parsesp() {
|
|
2536
2101
|
var s0;
|
|
2537
|
-
|
|
2538
2102
|
if (input.charCodeAt(peg$currPos) === 32) {
|
|
2539
2103
|
s0 = peg$c98;
|
|
2540
2104
|
peg$currPos++;
|
|
2541
2105
|
} else {
|
|
2542
2106
|
s0 = peg$FAILED;
|
|
2543
|
-
|
|
2544
2107
|
if (peg$silentFails === 0) {
|
|
2545
2108
|
peg$fail(peg$c99);
|
|
2546
2109
|
}
|
|
2547
2110
|
}
|
|
2548
|
-
|
|
2549
2111
|
return s0;
|
|
2550
2112
|
}
|
|
2551
|
-
|
|
2552
2113
|
var pluralize = require('pluralize');
|
|
2553
|
-
|
|
2554
2114
|
var lodash = require('lodash');
|
|
2555
|
-
|
|
2556
2115
|
var data = {
|
|
2557
2116
|
tables: [],
|
|
2558
2117
|
refs: []
|
|
2559
2118
|
};
|
|
2560
|
-
|
|
2561
2119
|
function pushTable(table) {
|
|
2562
2120
|
if (data.tables.find(function (t) {
|
|
2563
2121
|
return t.name == table.name;
|
|
@@ -2567,7 +2125,6 @@ function peg$parse(input, options) {
|
|
|
2567
2125
|
var idField = table.fields.find(function (field) {
|
|
2568
2126
|
return field.name === "id";
|
|
2569
2127
|
});
|
|
2570
|
-
|
|
2571
2128
|
if (!idField) {
|
|
2572
2129
|
table.fields.unshift({
|
|
2573
2130
|
name: "id",
|
|
@@ -2576,11 +2133,9 @@ function peg$parse(input, options) {
|
|
|
2576
2133
|
}
|
|
2577
2134
|
});
|
|
2578
2135
|
}
|
|
2579
|
-
|
|
2580
2136
|
data.tables.push(table);
|
|
2581
2137
|
}
|
|
2582
2138
|
}
|
|
2583
|
-
|
|
2584
2139
|
function addPrimaryKey() {
|
|
2585
2140
|
var fields = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
2586
2141
|
var props = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
@@ -2588,13 +2143,12 @@ function peg$parse(input, options) {
|
|
|
2588
2143
|
return prop.name === 'primary_key';
|
|
2589
2144
|
});
|
|
2590
2145
|
if (!primaryKey) return fields;
|
|
2591
|
-
|
|
2592
2146
|
if (fields.find(function (key) {
|
|
2593
2147
|
return key.name === primaryKey.value;
|
|
2594
2148
|
})) {
|
|
2595
2149
|
return fields.map(function (_ref) {
|
|
2596
2150
|
var name = _ref.name,
|
|
2597
|
-
|
|
2151
|
+
type = _ref.type;
|
|
2598
2152
|
return {
|
|
2599
2153
|
name: name,
|
|
2600
2154
|
type: type,
|
|
@@ -2602,7 +2156,6 @@ function peg$parse(input, options) {
|
|
|
2602
2156
|
};
|
|
2603
2157
|
});
|
|
2604
2158
|
}
|
|
2605
|
-
|
|
2606
2159
|
var newFields = [{
|
|
2607
2160
|
name: primaryKey.value,
|
|
2608
2161
|
type: {
|
|
@@ -2612,52 +2165,40 @@ function peg$parse(input, options) {
|
|
|
2612
2165
|
}];
|
|
2613
2166
|
return newFields.concat(fields);
|
|
2614
2167
|
}
|
|
2615
|
-
|
|
2616
2168
|
function findTableByNameOrAlias(name) {
|
|
2617
2169
|
var table = data.tables.find(function (t) {
|
|
2618
2170
|
return t.name == name || t.alias == name;
|
|
2619
2171
|
});
|
|
2620
|
-
|
|
2621
2172
|
if (table === undefined) {
|
|
2622
2173
|
error("Table " + name + " not found");
|
|
2623
2174
|
}
|
|
2624
|
-
|
|
2625
2175
|
return table;
|
|
2626
2176
|
}
|
|
2627
|
-
|
|
2628
2177
|
function isSameEndpoints(endpoint1, endpoint2) {
|
|
2629
2178
|
return endpoint1.tableName == endpoint2.tableName && lodash.isEqual(lodash.sortBy(endpoint1.fieldNames), lodash.sortBy(endpoint2.fieldNames));
|
|
2630
2179
|
}
|
|
2631
|
-
|
|
2632
2180
|
function isSameEndpointsPairs(endpointsPair1, endpointsPair2) {
|
|
2633
2181
|
return isSameEndpoints(endpointsPair1[0], endpointsPair2[0]) && isSameEndpoints(endpointsPair1[1], endpointsPair2[1]);
|
|
2634
2182
|
}
|
|
2635
|
-
|
|
2636
2183
|
function isSameEndpointsRefs(ref1, ref2) {
|
|
2637
2184
|
return isSameEndpointsPairs(ref1.endpoints, ref2.endpoints) || isSameEndpointsPairs(ref1.endpoints, ref2.endpoints.slice().reverse());
|
|
2638
2185
|
}
|
|
2639
|
-
|
|
2640
2186
|
function pushRef(ref) {
|
|
2641
2187
|
if (!ref) return;
|
|
2642
|
-
|
|
2643
2188
|
if (data.refs.find(function (p) {
|
|
2644
2189
|
return isSameEndpointsRefs(p, ref);
|
|
2645
2190
|
})) {
|
|
2646
2191
|
error("Duplicated references");
|
|
2647
2192
|
}
|
|
2648
|
-
|
|
2649
2193
|
data.refs.push(ref);
|
|
2650
2194
|
}
|
|
2651
|
-
|
|
2652
2195
|
function pushRefs() {
|
|
2653
2196
|
var refs = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
2654
2197
|
if (!refs || refs.length === 0) return;
|
|
2655
|
-
|
|
2656
2198
|
for (var i = 0; i < refs.length; i += 1) {
|
|
2657
2199
|
pushRef(refs[i]);
|
|
2658
2200
|
}
|
|
2659
2201
|
}
|
|
2660
|
-
|
|
2661
2202
|
function refactorForeign(ref) {
|
|
2662
2203
|
// add relation
|
|
2663
2204
|
var tables = data.tables;
|
|
@@ -2665,7 +2206,6 @@ function peg$parse(input, options) {
|
|
|
2665
2206
|
var fromTable = tables.find(function (table) {
|
|
2666
2207
|
return table.name === endpoints[0].tableName;
|
|
2667
2208
|
});
|
|
2668
|
-
|
|
2669
2209
|
if (!fromTable) {
|
|
2670
2210
|
// TODO: handle error
|
|
2671
2211
|
// throw {
|
|
@@ -2674,11 +2214,9 @@ function peg$parse(input, options) {
|
|
|
2674
2214
|
// return ref;
|
|
2675
2215
|
return null;
|
|
2676
2216
|
}
|
|
2677
|
-
|
|
2678
2217
|
var toTable = tables.find(function (table) {
|
|
2679
2218
|
return table.name === endpoints[1].tableName;
|
|
2680
2219
|
});
|
|
2681
|
-
|
|
2682
2220
|
if (!toTable) {
|
|
2683
2221
|
// TODO: handle error
|
|
2684
2222
|
// throw {
|
|
@@ -2687,7 +2225,6 @@ function peg$parse(input, options) {
|
|
|
2687
2225
|
// return ref;
|
|
2688
2226
|
return null;
|
|
2689
2227
|
}
|
|
2690
|
-
|
|
2691
2228
|
if (!endpoints[0].fieldNames) {
|
|
2692
2229
|
var singleNameOfPrimaryTable = pluralize.singular(endpoints[1].tableName);
|
|
2693
2230
|
var columnName = "".concat(singleNameOfPrimaryTable, "_id");
|
|
@@ -2695,7 +2232,6 @@ function peg$parse(input, options) {
|
|
|
2695
2232
|
var columnField = fromTable.fields.find(function (field) {
|
|
2696
2233
|
return field.name === columnName;
|
|
2697
2234
|
});
|
|
2698
|
-
|
|
2699
2235
|
if (!columnField) {
|
|
2700
2236
|
// TODO: handle erro
|
|
2701
2237
|
// throw {
|
|
@@ -2704,18 +2240,14 @@ function peg$parse(input, options) {
|
|
|
2704
2240
|
// return ref;
|
|
2705
2241
|
return null;
|
|
2706
2242
|
}
|
|
2707
|
-
|
|
2708
2243
|
endpoints[0].fieldNames = [columnName];
|
|
2709
2244
|
}
|
|
2710
|
-
|
|
2711
2245
|
if (!endpoints[1].fieldNames) {
|
|
2712
2246
|
var primaryKey = 'id';
|
|
2713
2247
|
endpoints[1].fieldNames = [primaryKey];
|
|
2714
2248
|
}
|
|
2715
|
-
|
|
2716
2249
|
return ref;
|
|
2717
2250
|
}
|
|
2718
|
-
|
|
2719
2251
|
function createForeign(fromTable, toTable, props) {
|
|
2720
2252
|
var endpoints = [{
|
|
2721
2253
|
tableName: fromTable,
|
|
@@ -2725,58 +2257,47 @@ function peg$parse(input, options) {
|
|
|
2725
2257
|
relation: '1'
|
|
2726
2258
|
}];
|
|
2727
2259
|
var refProp = {};
|
|
2728
|
-
|
|
2729
2260
|
for (var i = 0; i < props.length; i += 1) {
|
|
2730
2261
|
var currentProp = props[i];
|
|
2731
|
-
|
|
2732
2262
|
if (currentProp.columnName) {
|
|
2733
2263
|
endpoints[0].fieldNames = [currentProp.columnName];
|
|
2734
2264
|
}
|
|
2735
|
-
|
|
2736
2265
|
if (currentProp.primaryKey) {
|
|
2737
2266
|
endpoints[1].fieldNames = [currentProp.primaryKey];
|
|
2738
2267
|
}
|
|
2739
|
-
|
|
2740
2268
|
if (currentProp.onDelete) {
|
|
2741
2269
|
refProp = _objectSpread(_objectSpread({}, refProp), {}, {
|
|
2742
2270
|
onDelete: currentProp.onDelete
|
|
2743
2271
|
});
|
|
2744
2272
|
}
|
|
2745
|
-
|
|
2746
2273
|
if (currentProp.onUpdate) {
|
|
2747
2274
|
refProp = _objectSpread(_objectSpread({}, refProp), {}, {
|
|
2748
2275
|
onUpdate: currentProp.onUpdate
|
|
2749
2276
|
});
|
|
2750
2277
|
}
|
|
2751
2278
|
}
|
|
2752
|
-
|
|
2753
2279
|
return _objectSpread({
|
|
2754
2280
|
name: "fk_rails_".concat(fromTable, "_").concat(toTable),
|
|
2755
2281
|
endpoints: endpoints
|
|
2756
2282
|
}, refProp);
|
|
2757
2283
|
}
|
|
2758
|
-
|
|
2759
2284
|
function createRefFromTableWithReference(table, references) {
|
|
2760
2285
|
if (!references || references.length === 0) {
|
|
2761
2286
|
return [];
|
|
2762
2287
|
}
|
|
2763
|
-
|
|
2764
2288
|
var refs = [];
|
|
2765
|
-
|
|
2766
|
-
var _loop = function _loop(i) {
|
|
2289
|
+
var _loop = function _loop() {
|
|
2767
2290
|
var reference = references[i];
|
|
2768
2291
|
var referenceTable = pluralize.plural(reference);
|
|
2769
2292
|
var tables = data.tables;
|
|
2770
2293
|
var toTable = tables.find(function (table) {
|
|
2771
2294
|
return table.name === referenceTable;
|
|
2772
2295
|
});
|
|
2773
|
-
|
|
2774
2296
|
if (!toTable) {
|
|
2775
2297
|
return "continue";
|
|
2776
|
-
}
|
|
2298
|
+
}
|
|
2299
|
+
// add field to table if not exists (`${reference}_id`)
|
|
2777
2300
|
// auto add type of new field to be varchar if primaryKey not found
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
2301
|
var columnName = "".concat(reference, "_id");
|
|
2781
2302
|
var primaryKeyName = 'id';
|
|
2782
2303
|
var column = table.fields.find(function (field) {
|
|
@@ -2785,7 +2306,6 @@ function peg$parse(input, options) {
|
|
|
2785
2306
|
var primaryKey = toTable.fields.find(function (field) {
|
|
2786
2307
|
return field.name === primaryKeyName;
|
|
2787
2308
|
});
|
|
2788
|
-
|
|
2789
2309
|
if (!column) {
|
|
2790
2310
|
table.fields.push({
|
|
2791
2311
|
name: columnName,
|
|
@@ -2794,7 +2314,6 @@ function peg$parse(input, options) {
|
|
|
2794
2314
|
}
|
|
2795
2315
|
});
|
|
2796
2316
|
}
|
|
2797
|
-
|
|
2798
2317
|
refs.push({
|
|
2799
2318
|
name: "fk_rails_".concat(table.name, "_").concat(referenceTable),
|
|
2800
2319
|
endpoints: [{
|
|
@@ -2808,19 +2327,15 @@ function peg$parse(input, options) {
|
|
|
2808
2327
|
}]
|
|
2809
2328
|
});
|
|
2810
2329
|
};
|
|
2811
|
-
|
|
2812
2330
|
for (var i = 0; i < references.length; i += 1) {
|
|
2813
|
-
var _ret = _loop(
|
|
2814
|
-
|
|
2331
|
+
var _ret = _loop();
|
|
2815
2332
|
if (_ret === "continue") continue;
|
|
2816
2333
|
}
|
|
2817
|
-
|
|
2818
2334
|
return refs;
|
|
2819
2335
|
}
|
|
2820
|
-
|
|
2821
2336
|
function implicityRef(data) {
|
|
2822
2337
|
var tables = data.tables,
|
|
2823
|
-
|
|
2338
|
+
refs = data.refs;
|
|
2824
2339
|
var tableWithFieldName = tables.map(function (table) {
|
|
2825
2340
|
var name = table.name;
|
|
2826
2341
|
var singularName = pluralize.singular(name);
|
|
@@ -2829,17 +2344,14 @@ function peg$parse(input, options) {
|
|
|
2829
2344
|
field: "".concat(singularName, "_id")
|
|
2830
2345
|
};
|
|
2831
2346
|
});
|
|
2832
|
-
|
|
2833
2347
|
for (var i = 0; i < tables.length; i += 1) {
|
|
2834
2348
|
var table = tables[i];
|
|
2835
2349
|
var fields = table.fields;
|
|
2836
|
-
|
|
2837
|
-
var _loop2 = function _loop2(j) {
|
|
2350
|
+
var _loop2 = function _loop2() {
|
|
2838
2351
|
var field = fields[j];
|
|
2839
2352
|
var refWithTable = tableWithFieldName.find(function (table) {
|
|
2840
2353
|
return table.field === field.name;
|
|
2841
2354
|
});
|
|
2842
|
-
|
|
2843
2355
|
if (refWithTable) {
|
|
2844
2356
|
var newRef = {
|
|
2845
2357
|
name: "fk_rails_".concat(table.name, "_").concat(refWithTable.name),
|
|
@@ -2856,34 +2368,27 @@ function peg$parse(input, options) {
|
|
|
2856
2368
|
var duplicateRef = refs.find(function (ref) {
|
|
2857
2369
|
return isSameEndpointsRefs(ref, newRef);
|
|
2858
2370
|
});
|
|
2859
|
-
|
|
2860
2371
|
if (!duplicateRef) {
|
|
2861
2372
|
refs.push(newRef);
|
|
2862
2373
|
}
|
|
2863
2374
|
}
|
|
2864
2375
|
};
|
|
2865
|
-
|
|
2866
2376
|
for (var j = 0; j < fields.length; j += 1) {
|
|
2867
|
-
_loop2(
|
|
2377
|
+
_loop2();
|
|
2868
2378
|
}
|
|
2869
2379
|
}
|
|
2870
|
-
|
|
2871
2380
|
return data;
|
|
2872
2381
|
}
|
|
2873
|
-
|
|
2874
2382
|
peg$result = peg$startRuleFunction();
|
|
2875
|
-
|
|
2876
2383
|
if (peg$result !== peg$FAILED && peg$currPos === input.length) {
|
|
2877
2384
|
return peg$result;
|
|
2878
2385
|
} else {
|
|
2879
2386
|
if (peg$result !== peg$FAILED && peg$currPos < input.length) {
|
|
2880
2387
|
peg$fail(peg$endExpectation());
|
|
2881
2388
|
}
|
|
2882
|
-
|
|
2883
2389
|
throw peg$buildStructuredError(peg$maxFailExpected, peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null, peg$maxFailPos < input.length ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1) : peg$computeLocation(peg$maxFailPos, peg$maxFailPos));
|
|
2884
2390
|
}
|
|
2885
2391
|
}
|
|
2886
|
-
|
|
2887
2392
|
module.exports = {
|
|
2888
2393
|
SyntaxError: peg$SyntaxError,
|
|
2889
2394
|
parse: peg$parse
|