sqlui 0.1.60 → 0.1.62
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.release-version +1 -1
- data/app/database_config.rb +2 -2
- data/app/server.rb +40 -32
- data/app/sqlui_config.rb +5 -5
- data/app/views/databases.erb +4 -4
- data/app/views/error.erb +1 -1
- data/app/views/sqlui.erb +8 -6
- data/client/resources/sqlui.css +14 -10
- data/client/resources/sqlui.js +364 -212
- data/client/resources/vertical-resizer.svg +5 -0
- metadata +3 -2
data/client/resources/sqlui.js
CHANGED
@@ -3056,7 +3056,7 @@
|
|
3056
3056
|
@internal
|
3057
3057
|
*/
|
3058
3058
|
static create(from, to, value) {
|
3059
|
-
return new Range
|
3059
|
+
return new Range(from, to, value);
|
3060
3060
|
}
|
3061
3061
|
};
|
3062
3062
|
function cmpRange(a, b) {
|
@@ -5503,7 +5503,9 @@
|
|
5503
5503
|
super(-200000000 /* Side.Line */, -200000000 /* Side.Line */, null, spec);
|
5504
5504
|
}
|
5505
5505
|
eq(other) {
|
5506
|
-
return other instanceof LineDecoration &&
|
5506
|
+
return other instanceof LineDecoration &&
|
5507
|
+
this.spec.class == other.spec.class &&
|
5508
|
+
attrsEq(this.spec.attributes, other.spec.attributes);
|
5507
5509
|
}
|
5508
5510
|
range(from, to = from) {
|
5509
5511
|
if (to != from)
|
@@ -7254,7 +7256,8 @@
|
|
7254
7256
|
closestRect = rect;
|
7255
7257
|
closestX = dx;
|
7256
7258
|
closestY = dy;
|
7257
|
-
|
7259
|
+
let side = dy ? (y < rect.top ? -1 : 1) : dx ? (x < rect.left ? -1 : 1) : 0;
|
7260
|
+
closestOverlap = !side || (side > 0 ? i < rects.length - 1 : i > 0);
|
7258
7261
|
}
|
7259
7262
|
if (dx == 0) {
|
7260
7263
|
if (y > rect.bottom && (!aboveRect || aboveRect.bottom < rect.bottom)) {
|
@@ -9478,7 +9481,7 @@
|
|
9478
9481
|
});
|
9479
9482
|
}
|
9480
9483
|
const baseTheme$1$3 = /*@__PURE__*/buildTheme("." + baseThemeID, {
|
9481
|
-
"
|
9484
|
+
"&": {
|
9482
9485
|
position: "relative !important",
|
9483
9486
|
boxSizing: "border-box",
|
9484
9487
|
"&.cm-focused": {
|
@@ -9762,7 +9765,7 @@
|
|
9762
9765
|
insert: Text.of(domChange.text.slice(diff.from, diff.toB).split(LineBreakPlaceholder)) };
|
9763
9766
|
}
|
9764
9767
|
}
|
9765
|
-
else if (newSel && (!view.hasFocus
|
9768
|
+
else if (newSel && (!view.hasFocus && view.state.facet(editable) || newSel.main.eq(sel))) {
|
9766
9769
|
newSel = null;
|
9767
9770
|
}
|
9768
9771
|
if (!change && !newSel)
|
@@ -10826,6 +10829,8 @@
|
|
10826
10829
|
if (this.measureScheduled < 0)
|
10827
10830
|
this.measureScheduled = this.win.requestAnimationFrame(() => this.measure());
|
10828
10831
|
if (request) {
|
10832
|
+
if (this.measureRequests.indexOf(request) > -1)
|
10833
|
+
return;
|
10829
10834
|
if (request.key != null)
|
10830
10835
|
for (let i = 0; i < this.measureRequests.length; i++) {
|
10831
10836
|
if (this.measureRequests[i].key === request.key) {
|
@@ -11509,6 +11514,8 @@
|
|
11509
11514
|
if (runFor(scopeObj[prefix + modifiers(name, event, !isChar)]))
|
11510
11515
|
return true;
|
11511
11516
|
if (isChar && (event.altKey || event.metaKey || event.ctrlKey) &&
|
11517
|
+
// Ctrl-Alt may be used for AltGr on Windows
|
11518
|
+
!(browser.windows && event.ctrlKey && event.altKey) &&
|
11512
11519
|
(baseName = base[event.keyCode]) && baseName != name) {
|
11513
11520
|
if (runFor(scopeObj[prefix + modifiers(baseName, event, true)]))
|
11514
11521
|
return true;
|
@@ -11803,7 +11810,7 @@
|
|
11803
11810
|
];
|
11804
11811
|
}
|
11805
11812
|
function configChanged(update) {
|
11806
|
-
return update.startState.facet(selectionConfig) != update.
|
11813
|
+
return update.startState.facet(selectionConfig) != update.state.facet(selectionConfig);
|
11807
11814
|
}
|
11808
11815
|
const cursorLayer = /*@__PURE__*/layer({
|
11809
11816
|
above: true,
|
@@ -11822,7 +11829,7 @@
|
|
11822
11829
|
return cursors;
|
11823
11830
|
},
|
11824
11831
|
update(update, dom) {
|
11825
|
-
if (update.transactions.some(tr => tr.
|
11832
|
+
if (update.transactions.some(tr => tr.selection))
|
11826
11833
|
dom.style.animationName = dom.style.animationName == "cm-blink" ? "cm-blink2" : "cm-blink";
|
11827
11834
|
let confChange = configChanged(update);
|
11828
11835
|
if (confChange)
|
@@ -13329,15 +13336,14 @@
|
|
13329
13336
|
constructor(gutter, viewport, height) {
|
13330
13337
|
this.gutter = gutter;
|
13331
13338
|
this.height = height;
|
13332
|
-
this.localMarkers = [];
|
13333
13339
|
this.i = 0;
|
13334
13340
|
this.cursor = RangeSet.iter(gutter.markers, viewport.from);
|
13335
13341
|
}
|
13336
13342
|
line(view, line, extraMarkers) {
|
13337
|
-
|
13338
|
-
|
13339
|
-
|
13340
|
-
|
13343
|
+
let localMarkers = [];
|
13344
|
+
advanceCursor(this.cursor, localMarkers, line.from);
|
13345
|
+
if (extraMarkers.length)
|
13346
|
+
localMarkers = localMarkers.concat(extraMarkers);
|
13341
13347
|
let forLine = this.gutter.config.lineMarker(view, line, localMarkers);
|
13342
13348
|
if (forLine)
|
13343
13349
|
localMarkers.unshift(forLine);
|
@@ -13375,7 +13381,17 @@
|
|
13375
13381
|
this.dom.className = "cm-gutter" + (this.config.class ? " " + this.config.class : "");
|
13376
13382
|
for (let prop in config.domEventHandlers) {
|
13377
13383
|
this.dom.addEventListener(prop, (event) => {
|
13378
|
-
let
|
13384
|
+
let target = event.target, y;
|
13385
|
+
if (target != this.dom && this.dom.contains(target)) {
|
13386
|
+
while (target.parentNode != this.dom)
|
13387
|
+
target = target.parentNode;
|
13388
|
+
let rect = target.getBoundingClientRect();
|
13389
|
+
y = (rect.top + rect.bottom) / 2;
|
13390
|
+
}
|
13391
|
+
else {
|
13392
|
+
y = event.clientY;
|
13393
|
+
}
|
13394
|
+
let line = view.lineBlockAtHeight(y - view.documentTop);
|
13379
13395
|
if (config.domEventHandlers[prop](view, line, event))
|
13380
13396
|
event.preventDefault();
|
13381
13397
|
});
|
@@ -17128,6 +17144,15 @@
|
|
17128
17144
|
function bracketMatching(config = {}) {
|
17129
17145
|
return [bracketMatchingConfig.of(config), bracketMatchingUnique];
|
17130
17146
|
}
|
17147
|
+
/**
|
17148
|
+
When larger syntax nodes, such as HTML tags, are marked as
|
17149
|
+
opening/closing, it can be a bit messy to treat the whole node as
|
17150
|
+
a matchable bracket. This node prop allows you to define, for such
|
17151
|
+
a node, a ‘handle’—the part of the node that is highlighted, and
|
17152
|
+
that the cursor must be on to activate highlighting in the first
|
17153
|
+
place.
|
17154
|
+
*/
|
17155
|
+
const bracketMatchingHandle = /*@__PURE__*/new NodeProp();
|
17131
17156
|
function matchingNodes(node, dir, brackets) {
|
17132
17157
|
let byProp = node.prop(dir < 0 ? NodeProp.openedBy : NodeProp.closedBy);
|
17133
17158
|
if (byProp)
|
@@ -17139,6 +17164,10 @@
|
|
17139
17164
|
}
|
17140
17165
|
return null;
|
17141
17166
|
}
|
17167
|
+
function findHandle(node) {
|
17168
|
+
let hasHandle = node.type.prop(bracketMatchingHandle);
|
17169
|
+
return hasHandle ? hasHandle(node.node) : node;
|
17170
|
+
}
|
17142
17171
|
/**
|
17143
17172
|
Find the matching bracket for the token at `pos`, scanning
|
17144
17173
|
direction `dir`. Only the `brackets` and `maxScanDistance`
|
@@ -17150,30 +17179,36 @@
|
|
17150
17179
|
let tree = syntaxTree(state), node = tree.resolveInner(pos, dir);
|
17151
17180
|
for (let cur = node; cur; cur = cur.parent) {
|
17152
17181
|
let matches = matchingNodes(cur.type, dir, brackets);
|
17153
|
-
if (matches && cur.from < cur.to)
|
17154
|
-
|
17182
|
+
if (matches && cur.from < cur.to) {
|
17183
|
+
let handle = findHandle(cur);
|
17184
|
+
if (handle && (dir > 0 ? pos >= handle.from && pos < handle.to : pos > handle.from && pos <= handle.to))
|
17185
|
+
return matchMarkedBrackets(state, pos, dir, cur, handle, matches, brackets);
|
17186
|
+
}
|
17155
17187
|
}
|
17156
17188
|
return matchPlainBrackets(state, pos, dir, tree, node.type, maxScanDistance, brackets);
|
17157
17189
|
}
|
17158
|
-
function matchMarkedBrackets(_state, _pos, dir, token, matching, brackets) {
|
17159
|
-
let parent = token.parent, firstToken = { from:
|
17190
|
+
function matchMarkedBrackets(_state, _pos, dir, token, handle, matching, brackets) {
|
17191
|
+
let parent = token.parent, firstToken = { from: handle.from, to: handle.to };
|
17160
17192
|
let depth = 0, cursor = parent === null || parent === void 0 ? void 0 : parent.cursor();
|
17161
17193
|
if (cursor && (dir < 0 ? cursor.childBefore(token.from) : cursor.childAfter(token.to)))
|
17162
17194
|
do {
|
17163
17195
|
if (dir < 0 ? cursor.to <= token.from : cursor.from >= token.to) {
|
17164
17196
|
if (depth == 0 && matching.indexOf(cursor.type.name) > -1 && cursor.from < cursor.to) {
|
17165
|
-
|
17197
|
+
let endHandle = findHandle(cursor);
|
17198
|
+
return { start: firstToken, end: endHandle ? { from: endHandle.from, to: endHandle.to } : undefined, matched: true };
|
17166
17199
|
}
|
17167
17200
|
else if (matchingNodes(cursor.type, dir, brackets)) {
|
17168
17201
|
depth++;
|
17169
17202
|
}
|
17170
17203
|
else if (matchingNodes(cursor.type, -dir, brackets)) {
|
17171
|
-
if (depth == 0)
|
17204
|
+
if (depth == 0) {
|
17205
|
+
let endHandle = findHandle(cursor);
|
17172
17206
|
return {
|
17173
17207
|
start: firstToken,
|
17174
|
-
end:
|
17208
|
+
end: endHandle && endHandle.from < endHandle.to ? { from: endHandle.from, to: endHandle.to } : undefined,
|
17175
17209
|
matched: false
|
17176
17210
|
};
|
17211
|
+
}
|
17177
17212
|
depth--;
|
17178
17213
|
}
|
17179
17214
|
}
|
@@ -17453,8 +17488,13 @@
|
|
17453
17488
|
combine(configs) {
|
17454
17489
|
return combineConfig(configs, {
|
17455
17490
|
minDepth: 100,
|
17456
|
-
newGroupDelay: 500
|
17457
|
-
|
17491
|
+
newGroupDelay: 500,
|
17492
|
+
joinToEvent: (_t, isAdjacent) => isAdjacent,
|
17493
|
+
}, {
|
17494
|
+
minDepth: Math.max,
|
17495
|
+
newGroupDelay: Math.min,
|
17496
|
+
joinToEvent: (a, b) => (tr, adj) => a(tr, adj) || b(tr, adj)
|
17497
|
+
});
|
17458
17498
|
}
|
17459
17499
|
});
|
17460
17500
|
function changeEnd(changes) {
|
@@ -17487,7 +17527,7 @@
|
|
17487
17527
|
let event = HistEvent.fromTransaction(tr);
|
17488
17528
|
let time = tr.annotation(Transaction.time), userEvent = tr.annotation(Transaction.userEvent);
|
17489
17529
|
if (event)
|
17490
|
-
state = state.addChanges(event, time, userEvent, config
|
17530
|
+
state = state.addChanges(event, time, userEvent, config, tr);
|
17491
17531
|
else if (tr.selection)
|
17492
17532
|
state = state.addSelection(tr.startState.selection, time, userEvent, config.newGroupDelay);
|
17493
17533
|
if (isolate == "full" || isolate == "after")
|
@@ -17699,19 +17739,19 @@
|
|
17699
17739
|
isolate() {
|
17700
17740
|
return this.prevTime ? new HistoryState(this.done, this.undone) : this;
|
17701
17741
|
}
|
17702
|
-
addChanges(event, time, userEvent,
|
17742
|
+
addChanges(event, time, userEvent, config, tr) {
|
17703
17743
|
let done = this.done, lastEvent = done[done.length - 1];
|
17704
17744
|
if (lastEvent && lastEvent.changes && !lastEvent.changes.empty && event.changes &&
|
17705
17745
|
(!userEvent || joinableUserEvent.test(userEvent)) &&
|
17706
17746
|
((!lastEvent.selectionsAfter.length &&
|
17707
|
-
time - this.prevTime < newGroupDelay &&
|
17708
|
-
isAdjacent(lastEvent.changes, event.changes)) ||
|
17747
|
+
time - this.prevTime < config.newGroupDelay &&
|
17748
|
+
config.joinToEvent(tr, isAdjacent(lastEvent.changes, event.changes))) ||
|
17709
17749
|
// For compose (but not compose.start) events, always join with previous event
|
17710
17750
|
userEvent == "input.type.compose")) {
|
17711
|
-
done = updateBranch(done, done.length - 1,
|
17751
|
+
done = updateBranch(done, done.length - 1, config.minDepth, new HistEvent(event.changes.compose(lastEvent.changes), conc(event.effects, lastEvent.effects), lastEvent.mapped, lastEvent.startSelection, none$1));
|
17712
17752
|
}
|
17713
17753
|
else {
|
17714
|
-
done = updateBranch(done, done.length,
|
17754
|
+
done = updateBranch(done, done.length, config.minDepth, event);
|
17715
17755
|
}
|
17716
17756
|
return new HistoryState(done, none$1, time, userEvent);
|
17717
17757
|
}
|
@@ -21995,7 +22035,8 @@
|
|
21995
22035
|
// Apply a reduce action
|
21996
22036
|
/// @internal
|
21997
22037
|
reduce(action) {
|
21998
|
-
|
22038
|
+
var _a;
|
22039
|
+
let depth = action >> 19 /* Action.ReduceDepthShift */, type = action & 65535 /* Action.ValueMask */;
|
21999
22040
|
let { parser } = this.p;
|
22000
22041
|
let dPrec = parser.dynamicPrecedence(type);
|
22001
22042
|
if (dPrec)
|
@@ -22014,15 +22055,29 @@
|
|
22014
22055
|
// consume two extra frames (the dummy parent node for the skipped
|
22015
22056
|
// expression and the state that we'll be staying in, which should
|
22016
22057
|
// be moved to `this.state`).
|
22017
|
-
let base = this.stack.length - ((depth - 1) * 3) - (action & 262144 /* StayFlag */ ? 6 : 0);
|
22018
|
-
let start = this.stack[base - 2];
|
22019
|
-
|
22058
|
+
let base = this.stack.length - ((depth - 1) * 3) - (action & 262144 /* Action.StayFlag */ ? 6 : 0);
|
22059
|
+
let start = base ? this.stack[base - 2] : this.p.ranges[0].from, size = this.reducePos - start;
|
22060
|
+
// This is a kludge to try and detect overly deep left-associative
|
22061
|
+
// trees, which will not increase the parse stack depth and thus
|
22062
|
+
// won't be caught by the regular stack-depth limit check.
|
22063
|
+
if (size >= 2000 /* Recover.MinBigReduction */ && !((_a = this.p.parser.nodeSet.types[type]) === null || _a === void 0 ? void 0 : _a.isAnonymous)) {
|
22064
|
+
if (start == this.p.lastBigReductionStart) {
|
22065
|
+
this.p.bigReductionCount++;
|
22066
|
+
this.p.lastBigReductionSize = size;
|
22067
|
+
}
|
22068
|
+
else if (this.p.lastBigReductionSize < size) {
|
22069
|
+
this.p.bigReductionCount = 1;
|
22070
|
+
this.p.lastBigReductionStart = start;
|
22071
|
+
this.p.lastBigReductionSize = size;
|
22072
|
+
}
|
22073
|
+
}
|
22074
|
+
let bufferBase = base ? this.stack[base - 1] : 0, count = this.bufferBase + this.buffer.length - bufferBase;
|
22020
22075
|
// Store normal terms or `R -> R R` repeat reductions
|
22021
|
-
if (type < parser.minRepeatTerm || (action & 131072 /* RepeatFlag */)) {
|
22022
|
-
let pos = parser.stateFlag(this.state, 1 /* Skipped */) ? this.pos : this.reducePos;
|
22076
|
+
if (type < parser.minRepeatTerm || (action & 131072 /* Action.RepeatFlag */)) {
|
22077
|
+
let pos = parser.stateFlag(this.state, 1 /* StateFlag.Skipped */) ? this.pos : this.reducePos;
|
22023
22078
|
this.storeNode(type, start, pos, count + 4, true);
|
22024
22079
|
}
|
22025
|
-
if (action & 262144 /* StayFlag */) {
|
22080
|
+
if (action & 262144 /* Action.StayFlag */) {
|
22026
22081
|
this.state = this.stack[base];
|
22027
22082
|
}
|
22028
22083
|
else {
|
@@ -22036,7 +22091,7 @@
|
|
22036
22091
|
// Shift a value into the buffer
|
22037
22092
|
/// @internal
|
22038
22093
|
storeNode(term, start, end, size = 4, isReduce = false) {
|
22039
|
-
if (term == 0 /* Err */ &&
|
22094
|
+
if (term == 0 /* Term.Err */ &&
|
22040
22095
|
(!this.stack.length || this.stack[this.stack.length - 1] < this.buffer.length + this.bufferBase)) {
|
22041
22096
|
// Try to omit/merge adjacent error nodes
|
22042
22097
|
let cur = this, top = this.buffer.length;
|
@@ -22044,7 +22099,7 @@
|
|
22044
22099
|
top = cur.bufferBase - cur.parent.bufferBase;
|
22045
22100
|
cur = cur.parent;
|
22046
22101
|
}
|
22047
|
-
if (top > 0 && cur.buffer[top - 4] == 0 /* Err */ && cur.buffer[top - 1] > -1) {
|
22102
|
+
if (top > 0 && cur.buffer[top - 4] == 0 /* Term.Err */ && cur.buffer[top - 1] > -1) {
|
22048
22103
|
if (start == end)
|
22049
22104
|
return;
|
22050
22105
|
if (cur.buffer[top - 2] >= start) {
|
@@ -22058,7 +22113,7 @@
|
|
22058
22113
|
}
|
22059
22114
|
else { // There may be skipped nodes that have to be moved forward
|
22060
22115
|
let index = this.buffer.length;
|
22061
|
-
if (index > 0 && this.buffer[index - 4] != 0 /* Err */)
|
22116
|
+
if (index > 0 && this.buffer[index - 4] != 0 /* Term.Err */)
|
22062
22117
|
while (index > 0 && this.buffer[index - 2] > end) {
|
22063
22118
|
// Move this record forward
|
22064
22119
|
this.buffer[index] = this.buffer[index - 4];
|
@@ -22079,14 +22134,14 @@
|
|
22079
22134
|
/// @internal
|
22080
22135
|
shift(action, next, nextEnd) {
|
22081
22136
|
let start = this.pos;
|
22082
|
-
if (action & 131072 /* GotoFlag */) {
|
22083
|
-
this.pushState(action & 65535 /* ValueMask */, this.pos);
|
22137
|
+
if (action & 131072 /* Action.GotoFlag */) {
|
22138
|
+
this.pushState(action & 65535 /* Action.ValueMask */, this.pos);
|
22084
22139
|
}
|
22085
|
-
else if ((action & 262144 /* StayFlag */) == 0) { // Regular shift
|
22140
|
+
else if ((action & 262144 /* Action.StayFlag */) == 0) { // Regular shift
|
22086
22141
|
let nextState = action, { parser } = this.p;
|
22087
22142
|
if (nextEnd > this.pos || next <= parser.maxNode) {
|
22088
22143
|
this.pos = nextEnd;
|
22089
|
-
if (!parser.stateFlag(nextState, 1 /* Skipped */))
|
22144
|
+
if (!parser.stateFlag(nextState, 1 /* StateFlag.Skipped */))
|
22090
22145
|
this.reducePos = nextEnd;
|
22091
22146
|
}
|
22092
22147
|
this.pushState(nextState, start);
|
@@ -22104,7 +22159,7 @@
|
|
22104
22159
|
// Apply an action
|
22105
22160
|
/// @internal
|
22106
22161
|
apply(action, next, nextEnd) {
|
22107
|
-
if (action & 65536 /* ReduceFlag */)
|
22162
|
+
if (action & 65536 /* Action.ReduceFlag */)
|
22108
22163
|
this.reduce(action);
|
22109
22164
|
else
|
22110
22165
|
this.shift(action, next, nextEnd);
|
@@ -22149,9 +22204,9 @@
|
|
22149
22204
|
let isNode = next <= this.p.parser.maxNode;
|
22150
22205
|
if (isNode)
|
22151
22206
|
this.storeNode(next, this.pos, nextEnd, 4);
|
22152
|
-
this.storeNode(0 /* Err */, this.pos, nextEnd, isNode ? 8 : 4);
|
22207
|
+
this.storeNode(0 /* Term.Err */, this.pos, nextEnd, isNode ? 8 : 4);
|
22153
22208
|
this.pos = this.reducePos = nextEnd;
|
22154
|
-
this.score -= 190 /* Delete */;
|
22209
|
+
this.score -= 190 /* Recover.Delete */;
|
22155
22210
|
}
|
22156
22211
|
/// Check if the given term would be able to be shifted (optionally
|
22157
22212
|
/// after some reductions) on this stack. This can be useful for
|
@@ -22159,10 +22214,10 @@
|
|
22159
22214
|
/// given token when it applies.
|
22160
22215
|
canShift(term) {
|
22161
22216
|
for (let sim = new SimulatedStack(this);;) {
|
22162
|
-
let action = this.p.parser.stateSlot(sim.state, 4 /* DefaultReduce */) || this.p.parser.hasAction(sim.state, term);
|
22217
|
+
let action = this.p.parser.stateSlot(sim.state, 4 /* ParseState.DefaultReduce */) || this.p.parser.hasAction(sim.state, term);
|
22163
22218
|
if (action == 0)
|
22164
22219
|
return false;
|
22165
|
-
if ((action & 65536 /* ReduceFlag */) == 0)
|
22220
|
+
if ((action & 65536 /* Action.ReduceFlag */) == 0)
|
22166
22221
|
return true;
|
22167
22222
|
sim.reduce(action);
|
22168
22223
|
}
|
@@ -22171,17 +22226,17 @@
|
|
22171
22226
|
// inserts some missing token or rule.
|
22172
22227
|
/// @internal
|
22173
22228
|
recoverByInsert(next) {
|
22174
|
-
if (this.stack.length >= 300 /* MaxInsertStackDepth */)
|
22229
|
+
if (this.stack.length >= 300 /* Recover.MaxInsertStackDepth */)
|
22175
22230
|
return [];
|
22176
22231
|
let nextStates = this.p.parser.nextStates(this.state);
|
22177
|
-
if (nextStates.length > 4 /* MaxNext */ << 1 || this.stack.length >= 120 /* DampenInsertStackDepth */) {
|
22232
|
+
if (nextStates.length > 4 /* Recover.MaxNext */ << 1 || this.stack.length >= 120 /* Recover.DampenInsertStackDepth */) {
|
22178
22233
|
let best = [];
|
22179
22234
|
for (let i = 0, s; i < nextStates.length; i += 2) {
|
22180
22235
|
if ((s = nextStates[i + 1]) != this.state && this.p.parser.hasAction(s, next))
|
22181
22236
|
best.push(nextStates[i], s);
|
22182
22237
|
}
|
22183
|
-
if (this.stack.length < 120 /* DampenInsertStackDepth */)
|
22184
|
-
for (let i = 0; best.length < 4 /* MaxNext */ << 1 && i < nextStates.length; i += 2) {
|
22238
|
+
if (this.stack.length < 120 /* Recover.DampenInsertStackDepth */)
|
22239
|
+
for (let i = 0; best.length < 4 /* Recover.MaxNext */ << 1 && i < nextStates.length; i += 2) {
|
22185
22240
|
let s = nextStates[i + 1];
|
22186
22241
|
if (!best.some((v, i) => (i & 1) && v == s))
|
22187
22242
|
best.push(nextStates[i], s);
|
@@ -22189,15 +22244,15 @@
|
|
22189
22244
|
nextStates = best;
|
22190
22245
|
}
|
22191
22246
|
let result = [];
|
22192
|
-
for (let i = 0; i < nextStates.length && result.length < 4 /* MaxNext */; i += 2) {
|
22247
|
+
for (let i = 0; i < nextStates.length && result.length < 4 /* Recover.MaxNext */; i += 2) {
|
22193
22248
|
let s = nextStates[i + 1];
|
22194
22249
|
if (s == this.state)
|
22195
22250
|
continue;
|
22196
22251
|
let stack = this.split();
|
22197
22252
|
stack.pushState(s, this.pos);
|
22198
|
-
stack.storeNode(0 /* Err */, stack.pos, stack.pos, 4, true);
|
22253
|
+
stack.storeNode(0 /* Term.Err */, stack.pos, stack.pos, 4, true);
|
22199
22254
|
stack.shiftContext(nextStates[i], this.pos);
|
22200
|
-
stack.score -= 200 /* Insert */;
|
22255
|
+
stack.score -= 200 /* Recover.Insert */;
|
22201
22256
|
result.push(stack);
|
22202
22257
|
}
|
22203
22258
|
return result;
|
@@ -22206,17 +22261,17 @@
|
|
22206
22261
|
// be done.
|
22207
22262
|
/// @internal
|
22208
22263
|
forceReduce() {
|
22209
|
-
let reduce = this.p.parser.stateSlot(this.state, 5 /* ForcedReduce */);
|
22210
|
-
if ((reduce & 65536 /* ReduceFlag */) == 0)
|
22264
|
+
let reduce = this.p.parser.stateSlot(this.state, 5 /* ParseState.ForcedReduce */);
|
22265
|
+
if ((reduce & 65536 /* Action.ReduceFlag */) == 0)
|
22211
22266
|
return false;
|
22212
22267
|
let { parser } = this.p;
|
22213
22268
|
if (!parser.validAction(this.state, reduce)) {
|
22214
|
-
let depth = reduce >> 19 /* ReduceDepthShift */, term = reduce & 65535 /* ValueMask */;
|
22269
|
+
let depth = reduce >> 19 /* Action.ReduceDepthShift */, term = reduce & 65535 /* Action.ValueMask */;
|
22215
22270
|
let target = this.stack.length - depth * 3;
|
22216
22271
|
if (target < 0 || parser.getGoto(this.stack[target], term, false) < 0)
|
22217
22272
|
return false;
|
22218
|
-
this.storeNode(0 /* Err */, this.reducePos, this.reducePos, 4, true);
|
22219
|
-
this.score -= 100 /* Reduce */;
|
22273
|
+
this.storeNode(0 /* Term.Err */, this.reducePos, this.reducePos, 4, true);
|
22274
|
+
this.score -= 100 /* Recover.Reduce */;
|
22220
22275
|
}
|
22221
22276
|
this.reducePos = this.pos;
|
22222
22277
|
this.reduce(reduce);
|
@@ -22224,9 +22279,9 @@
|
|
22224
22279
|
}
|
22225
22280
|
/// @internal
|
22226
22281
|
forceAll() {
|
22227
|
-
while (!this.p.parser.stateFlag(this.state, 2 /* Accepting */)) {
|
22282
|
+
while (!this.p.parser.stateFlag(this.state, 2 /* StateFlag.Accepting */)) {
|
22228
22283
|
if (!this.forceReduce()) {
|
22229
|
-
this.storeNode(0 /* Err */, this.pos, this.pos, 4, true);
|
22284
|
+
this.storeNode(0 /* Term.Err */, this.pos, this.pos, 4, true);
|
22230
22285
|
break;
|
22231
22286
|
}
|
22232
22287
|
}
|
@@ -22239,8 +22294,8 @@
|
|
22239
22294
|
if (this.stack.length != 3)
|
22240
22295
|
return false;
|
22241
22296
|
let { parser } = this.p;
|
22242
|
-
return parser.data[parser.stateSlot(this.state, 1 /* Actions */)] == 65535 /* End */ &&
|
22243
|
-
!parser.stateSlot(this.state, 4 /* DefaultReduce */);
|
22297
|
+
return parser.data[parser.stateSlot(this.state, 1 /* ParseState.Actions */)] == 65535 /* Seq.End */ &&
|
22298
|
+
!parser.stateSlot(this.state, 4 /* ParseState.DefaultReduce */);
|
22244
22299
|
}
|
22245
22300
|
/// Restart the stack (put it back in its start state). Only safe
|
22246
22301
|
/// when this.stack.length == 3 (state is directly below the top
|
@@ -22321,6 +22376,7 @@
|
|
22321
22376
|
Recover[Recover["MaxNext"] = 4] = "MaxNext";
|
22322
22377
|
Recover[Recover["MaxInsertStackDepth"] = 300] = "MaxInsertStackDepth";
|
22323
22378
|
Recover[Recover["DampenInsertStackDepth"] = 120] = "DampenInsertStackDepth";
|
22379
|
+
Recover[Recover["MinBigReduction"] = 2000] = "MinBigReduction";
|
22324
22380
|
})(Recover || (Recover = {}));
|
22325
22381
|
// Used to cheaply run some reductions to scan ahead without mutating
|
22326
22382
|
// an entire stack
|
@@ -22332,7 +22388,7 @@
|
|
22332
22388
|
this.base = this.stack.length;
|
22333
22389
|
}
|
22334
22390
|
reduce(action) {
|
22335
|
-
let term = action & 65535 /* ValueMask */, depth = action >> 19 /* ReduceDepthShift */;
|
22391
|
+
let term = action & 65535 /* Action.ValueMask */, depth = action >> 19 /* Action.ReduceDepthShift */;
|
22336
22392
|
if (depth == 0) {
|
22337
22393
|
if (this.stack == this.start.stack)
|
22338
22394
|
this.stack = this.stack.slice();
|
@@ -22383,6 +22439,42 @@
|
|
22383
22439
|
}
|
22384
22440
|
}
|
22385
22441
|
|
22442
|
+
// See lezer-generator/src/encode.ts for comments about the encoding
|
22443
|
+
// used here
|
22444
|
+
function decodeArray(input, Type = Uint16Array) {
|
22445
|
+
if (typeof input != "string")
|
22446
|
+
return input;
|
22447
|
+
let array = null;
|
22448
|
+
for (let pos = 0, out = 0; pos < input.length;) {
|
22449
|
+
let value = 0;
|
22450
|
+
for (;;) {
|
22451
|
+
let next = input.charCodeAt(pos++), stop = false;
|
22452
|
+
if (next == 126 /* Encode.BigValCode */) {
|
22453
|
+
value = 65535 /* Encode.BigVal */;
|
22454
|
+
break;
|
22455
|
+
}
|
22456
|
+
if (next >= 92 /* Encode.Gap2 */)
|
22457
|
+
next--;
|
22458
|
+
if (next >= 34 /* Encode.Gap1 */)
|
22459
|
+
next--;
|
22460
|
+
let digit = next - 32 /* Encode.Start */;
|
22461
|
+
if (digit >= 46 /* Encode.Base */) {
|
22462
|
+
digit -= 46 /* Encode.Base */;
|
22463
|
+
stop = true;
|
22464
|
+
}
|
22465
|
+
value += digit;
|
22466
|
+
if (stop)
|
22467
|
+
break;
|
22468
|
+
value *= 46 /* Encode.Base */;
|
22469
|
+
}
|
22470
|
+
if (array)
|
22471
|
+
array[out++] = value;
|
22472
|
+
else
|
22473
|
+
array = new Type(value);
|
22474
|
+
}
|
22475
|
+
return array;
|
22476
|
+
}
|
22477
|
+
|
22386
22478
|
class CachedToken {
|
22387
22479
|
constructor() {
|
22388
22480
|
this.start = -1;
|
@@ -22607,9 +22699,13 @@
|
|
22607
22699
|
this.data = data;
|
22608
22700
|
this.id = id;
|
22609
22701
|
}
|
22610
|
-
token(input, stack) {
|
22702
|
+
token(input, stack) {
|
22703
|
+
let { parser } = stack.p;
|
22704
|
+
readToken(this.data, input, stack, this.id, parser.data, parser.tokenPrecTable);
|
22705
|
+
}
|
22611
22706
|
}
|
22612
22707
|
TokenGroup.prototype.contextual = TokenGroup.prototype.fallback = TokenGroup.prototype.extend = false;
|
22708
|
+
TokenGroup.prototype.fallback = TokenGroup.prototype.extend = false;
|
22613
22709
|
/// `@external tokens` declarations in the grammar should resolve to
|
22614
22710
|
/// an instance of this class.
|
22615
22711
|
class ExternalTokenizer {
|
@@ -22647,8 +22743,8 @@
|
|
22647
22743
|
// This function interprets that data, running through a stream as
|
22648
22744
|
// long as new states with the a matching group mask can be reached,
|
22649
22745
|
// and updating `input.token` when it matches a token.
|
22650
|
-
function readToken(data, input, stack, group) {
|
22651
|
-
let state = 0, groupMask = 1 << group, {
|
22746
|
+
function readToken(data, input, stack, group, precTable, precOffset) {
|
22747
|
+
let state = 0, groupMask = 1 << group, { dialect } = stack.p.parser;
|
22652
22748
|
scan: for (;;) {
|
22653
22749
|
if ((groupMask & data[state]) == 0)
|
22654
22750
|
break;
|
@@ -22660,14 +22756,15 @@
|
|
22660
22756
|
if ((data[i + 1] & groupMask) > 0) {
|
22661
22757
|
let term = data[i];
|
22662
22758
|
if (dialect.allows(term) &&
|
22663
|
-
(input.token.value == -1 || input.token.value == term ||
|
22759
|
+
(input.token.value == -1 || input.token.value == term ||
|
22760
|
+
overrides(term, input.token.value, precTable, precOffset))) {
|
22664
22761
|
input.acceptToken(term);
|
22665
22762
|
break;
|
22666
22763
|
}
|
22667
22764
|
}
|
22668
22765
|
let next = input.next, low = 0, high = data[state + 2];
|
22669
22766
|
// Special case for EOF
|
22670
|
-
if (input.next < 0 && high > low && data[accEnd + high * 3 - 3] == 65535 /* End */ && data[accEnd + high * 3 - 3] == 65535 /* End */) {
|
22767
|
+
if (input.next < 0 && high > low && data[accEnd + high * 3 - 3] == 65535 /* Seq.End */ && data[accEnd + high * 3 - 3] == 65535 /* Seq.End */) {
|
22671
22768
|
state = data[accEnd + high * 3 - 1];
|
22672
22769
|
continue scan;
|
22673
22770
|
}
|
@@ -22689,41 +22786,15 @@
|
|
22689
22786
|
break;
|
22690
22787
|
}
|
22691
22788
|
}
|
22692
|
-
|
22693
|
-
|
22694
|
-
|
22695
|
-
|
22696
|
-
|
22697
|
-
|
22698
|
-
|
22699
|
-
|
22700
|
-
|
22701
|
-
for (;;) {
|
22702
|
-
let next = input.charCodeAt(pos++), stop = false;
|
22703
|
-
if (next == 126 /* BigValCode */) {
|
22704
|
-
value = 65535 /* BigVal */;
|
22705
|
-
break;
|
22706
|
-
}
|
22707
|
-
if (next >= 92 /* Gap2 */)
|
22708
|
-
next--;
|
22709
|
-
if (next >= 34 /* Gap1 */)
|
22710
|
-
next--;
|
22711
|
-
let digit = next - 32 /* Start */;
|
22712
|
-
if (digit >= 46 /* Base */) {
|
22713
|
-
digit -= 46 /* Base */;
|
22714
|
-
stop = true;
|
22715
|
-
}
|
22716
|
-
value += digit;
|
22717
|
-
if (stop)
|
22718
|
-
break;
|
22719
|
-
value *= 46 /* Base */;
|
22720
|
-
}
|
22721
|
-
if (array)
|
22722
|
-
array[out++] = value;
|
22723
|
-
else
|
22724
|
-
array = new Type(value);
|
22725
|
-
}
|
22726
|
-
return array;
|
22789
|
+
function findOffset(data, start, term) {
|
22790
|
+
for (let i = start, next; (next = data[i]) != 65535 /* Seq.End */; i++)
|
22791
|
+
if (next == term)
|
22792
|
+
return i - start;
|
22793
|
+
return -1;
|
22794
|
+
}
|
22795
|
+
function overrides(token, prev, tableData, tableOffset) {
|
22796
|
+
let iPrev = findOffset(tableData, tableOffset, prev);
|
22797
|
+
return iPrev < 0 || findOffset(tableData, tableOffset, token) < iPrev;
|
22727
22798
|
}
|
22728
22799
|
|
22729
22800
|
// Environment variable used to control console output
|
@@ -22740,8 +22811,8 @@
|
|
22740
22811
|
if (!(side < 0 ? cursor.childBefore(pos) : cursor.childAfter(pos)))
|
22741
22812
|
for (;;) {
|
22742
22813
|
if ((side < 0 ? cursor.to < pos : cursor.from > pos) && !cursor.type.isError)
|
22743
|
-
return side < 0 ? Math.max(0, Math.min(cursor.to - 1, pos - 25 /* Margin */))
|
22744
|
-
: Math.min(tree.length, Math.max(cursor.from + 1, pos + 25 /* Margin */));
|
22814
|
+
return side < 0 ? Math.max(0, Math.min(cursor.to - 1, pos - 25 /* Safety.Margin */))
|
22815
|
+
: Math.min(tree.length, Math.max(cursor.from + 1, pos + 25 /* Safety.Margin */));
|
22745
22816
|
if (side < 0 ? cursor.prevSibling() : cursor.nextSibling())
|
22746
22817
|
break;
|
22747
22818
|
if (!cursor.parent())
|
@@ -22845,7 +22916,7 @@
|
|
22845
22916
|
let actionIndex = 0;
|
22846
22917
|
let main = null;
|
22847
22918
|
let { parser } = stack.p, { tokenizers } = parser;
|
22848
|
-
let mask = parser.stateSlot(stack.state, 3 /* TokenizerMask */);
|
22919
|
+
let mask = parser.stateSlot(stack.state, 3 /* ParseState.TokenizerMask */);
|
22849
22920
|
let context = stack.curContext ? stack.curContext.hash : 0;
|
22850
22921
|
let lookAhead = 0;
|
22851
22922
|
for (let i = 0; i < tokenizers.length; i++) {
|
@@ -22859,9 +22930,9 @@
|
|
22859
22930
|
token.mask = mask;
|
22860
22931
|
token.context = context;
|
22861
22932
|
}
|
22862
|
-
if (token.lookAhead > token.end + 25 /* Margin */)
|
22933
|
+
if (token.lookAhead > token.end + 25 /* Safety.Margin */)
|
22863
22934
|
lookAhead = Math.max(token.lookAhead, lookAhead);
|
22864
|
-
if (token.value != 0 /* Err */) {
|
22935
|
+
if (token.value != 0 /* Term.Err */) {
|
22865
22936
|
let startIndex = actionIndex;
|
22866
22937
|
if (token.extended > -1)
|
22867
22938
|
actionIndex = this.addActions(stack, token.extended, token.end, actionIndex);
|
@@ -22892,7 +22963,7 @@
|
|
22892
22963
|
let main = new CachedToken, { pos, p } = stack;
|
22893
22964
|
main.start = pos;
|
22894
22965
|
main.end = Math.min(pos + 1, p.stream.end);
|
22895
|
-
main.value = pos == p.stream.end ? p.parser.eofTerm : 0 /* Err */;
|
22966
|
+
main.value = pos == p.stream.end ? p.parser.eofTerm : 0 /* Term.Err */;
|
22896
22967
|
return main;
|
22897
22968
|
}
|
22898
22969
|
updateCachedToken(token, tokenizer, stack) {
|
@@ -22904,7 +22975,7 @@
|
|
22904
22975
|
if (parser.specialized[i] == token.value) {
|
22905
22976
|
let result = parser.specializers[i](this.stream.read(token.start, token.end), stack);
|
22906
22977
|
if (result >= 0 && stack.p.parser.dialect.allows(result >> 1)) {
|
22907
|
-
if ((result & 1) == 0 /* Specialize */)
|
22978
|
+
if ((result & 1) == 0 /* Specialize.Specialize */)
|
22908
22979
|
token.value = result >> 1;
|
22909
22980
|
else
|
22910
22981
|
token.extended = result >> 1;
|
@@ -22913,7 +22984,7 @@
|
|
22913
22984
|
}
|
22914
22985
|
}
|
22915
22986
|
else {
|
22916
|
-
token.value = 0 /* Err */;
|
22987
|
+
token.value = 0 /* Term.Err */;
|
22917
22988
|
token.end = this.stream.clipPos(start + 1);
|
22918
22989
|
}
|
22919
22990
|
}
|
@@ -22930,13 +23001,13 @@
|
|
22930
23001
|
addActions(stack, token, end, index) {
|
22931
23002
|
let { state } = stack, { parser } = stack.p, { data } = parser;
|
22932
23003
|
for (let set = 0; set < 2; set++) {
|
22933
|
-
for (let i = parser.stateSlot(state, set ? 2 /* Skip */ : 1 /* Actions */);; i += 3) {
|
22934
|
-
if (data[i] == 65535 /* End */) {
|
22935
|
-
if (data[i + 1] == 1 /* Next */) {
|
23004
|
+
for (let i = parser.stateSlot(state, set ? 2 /* ParseState.Skip */ : 1 /* ParseState.Actions */);; i += 3) {
|
23005
|
+
if (data[i] == 65535 /* Seq.End */) {
|
23006
|
+
if (data[i + 1] == 1 /* Seq.Next */) {
|
22936
23007
|
i = pair(data, i + 2);
|
22937
23008
|
}
|
22938
23009
|
else {
|
22939
|
-
if (index == 0 && data[i + 1] == 2 /* Other */)
|
23010
|
+
if (index == 0 && data[i + 1] == 2 /* Seq.Other */)
|
22940
23011
|
index = this.putAction(pair(data, i + 2), token, end, index);
|
22941
23012
|
break;
|
22942
23013
|
}
|
@@ -22961,6 +23032,11 @@
|
|
22961
23032
|
// on recursive traversal.
|
22962
23033
|
Rec[Rec["CutDepth"] = 15000] = "CutDepth";
|
22963
23034
|
Rec[Rec["CutTo"] = 9000] = "CutTo";
|
23035
|
+
Rec[Rec["MaxLeftAssociativeReductionCount"] = 300] = "MaxLeftAssociativeReductionCount";
|
23036
|
+
// The maximum number of non-recovering stacks to explore (to avoid
|
23037
|
+
// getting bogged down with exponentially multiplying stacks in
|
23038
|
+
// ambiguous content)
|
23039
|
+
Rec[Rec["MaxStackCount"] = 12] = "MaxStackCount";
|
22964
23040
|
})(Rec || (Rec = {}));
|
22965
23041
|
class Parse {
|
22966
23042
|
constructor(parser, input, fragments, ranges) {
|
@@ -22972,6 +23048,9 @@
|
|
22972
23048
|
this.minStackPos = 0;
|
22973
23049
|
this.reused = [];
|
22974
23050
|
this.stoppedAt = null;
|
23051
|
+
this.lastBigReductionStart = -1;
|
23052
|
+
this.lastBigReductionSize = 0;
|
23053
|
+
this.bigReductionCount = 0;
|
22975
23054
|
this.stream = new InputStream(input, ranges);
|
22976
23055
|
this.tokens = new TokenCache(parser, this.stream);
|
22977
23056
|
this.topTerm = parser.top[1];
|
@@ -22994,6 +23073,18 @@
|
|
22994
23073
|
// This will hold stacks beyond `pos`.
|
22995
23074
|
let newStacks = this.stacks = [];
|
22996
23075
|
let stopped, stoppedTokens;
|
23076
|
+
// If a large amount of reductions happened with the same start
|
23077
|
+
// position, force the stack out of that production in order to
|
23078
|
+
// avoid creating a tree too deep to recurse through.
|
23079
|
+
// (This is an ugly kludge, because unfortunately there is no
|
23080
|
+
// straightforward, cheap way to check for this happening, due to
|
23081
|
+
// the history of reductions only being available in an
|
23082
|
+
// expensive-to-access format in the stack buffers.)
|
23083
|
+
if (this.bigReductionCount > 300 /* Rec.MaxLeftAssociativeReductionCount */ && stacks.length == 1) {
|
23084
|
+
let [s] = stacks;
|
23085
|
+
while (s.forceReduce() && s.stack.length && s.stack[s.stack.length - 2] >= this.lastBigReductionStart) { }
|
23086
|
+
this.bigReductionCount = this.lastBigReductionSize = 0;
|
23087
|
+
}
|
22997
23088
|
// Keep advancing any stacks at `pos` until they either move
|
22998
23089
|
// forward or can't be advanced. Gather stacks that can't be
|
22999
23090
|
// advanced further in `stopped`.
|
@@ -23029,7 +23120,7 @@
|
|
23029
23120
|
throw new SyntaxError("No parse at " + pos);
|
23030
23121
|
}
|
23031
23122
|
if (!this.recovering)
|
23032
|
-
this.recovering = 5 /* Distance */;
|
23123
|
+
this.recovering = 5 /* Rec.Distance */;
|
23033
23124
|
}
|
23034
23125
|
if (this.recovering && stopped) {
|
23035
23126
|
let finished = this.stoppedAt != null && stopped[0].pos > this.stoppedAt ? stopped[0]
|
@@ -23038,7 +23129,7 @@
|
|
23038
23129
|
return this.stackToTree(finished.forceAll());
|
23039
23130
|
}
|
23040
23131
|
if (this.recovering) {
|
23041
|
-
let maxRemaining = this.recovering == 1 ? 1 : this.recovering * 3 /* MaxRemainingPerStep */;
|
23132
|
+
let maxRemaining = this.recovering == 1 ? 1 : this.recovering * 3 /* Rec.MaxRemainingPerStep */;
|
23042
23133
|
if (newStacks.length > maxRemaining) {
|
23043
23134
|
newStacks.sort((a, b) => b.score - a.score);
|
23044
23135
|
while (newStacks.length > maxRemaining)
|
@@ -23056,7 +23147,7 @@
|
|
23056
23147
|
for (let j = i + 1; j < newStacks.length; j++) {
|
23057
23148
|
let other = newStacks[j];
|
23058
23149
|
if (stack.sameState(other) ||
|
23059
|
-
stack.buffer.length > 500 /* MinBufferLengthPrune */ && other.buffer.length > 500 /* MinBufferLengthPrune */) {
|
23150
|
+
stack.buffer.length > 500 /* Rec.MinBufferLengthPrune */ && other.buffer.length > 500 /* Rec.MinBufferLengthPrune */) {
|
23060
23151
|
if (((stack.score - other.score) || (stack.buffer.length - other.buffer.length)) > 0) {
|
23061
23152
|
newStacks.splice(j--, 1);
|
23062
23153
|
}
|
@@ -23067,6 +23158,8 @@
|
|
23067
23158
|
}
|
23068
23159
|
}
|
23069
23160
|
}
|
23161
|
+
if (newStacks.length > 12 /* Rec.MaxStackCount */)
|
23162
|
+
newStacks.splice(12 /* Rec.MaxStackCount */, newStacks.length - 12 /* Rec.MaxStackCount */);
|
23070
23163
|
}
|
23071
23164
|
this.minStackPos = newStacks[0].pos;
|
23072
23165
|
for (let i = 1; i < newStacks.length; i++)
|
@@ -23107,15 +23200,15 @@
|
|
23107
23200
|
break;
|
23108
23201
|
}
|
23109
23202
|
}
|
23110
|
-
let defaultReduce = parser.stateSlot(stack.state, 4 /* DefaultReduce */);
|
23203
|
+
let defaultReduce = parser.stateSlot(stack.state, 4 /* ParseState.DefaultReduce */);
|
23111
23204
|
if (defaultReduce > 0) {
|
23112
23205
|
stack.reduce(defaultReduce);
|
23113
23206
|
if (verbose)
|
23114
|
-
console.log(base + this.stackID(stack) + ` (via always-reduce ${parser.getName(defaultReduce & 65535 /* ValueMask */)})`);
|
23207
|
+
console.log(base + this.stackID(stack) + ` (via always-reduce ${parser.getName(defaultReduce & 65535 /* Action.ValueMask */)})`);
|
23115
23208
|
return true;
|
23116
23209
|
}
|
23117
|
-
if (stack.stack.length >= 15000 /* CutDepth */) {
|
23118
|
-
while (stack.stack.length > 9000 /* CutTo */ && stack.forceReduce()) { }
|
23210
|
+
if (stack.stack.length >= 15000 /* Rec.CutDepth */) {
|
23211
|
+
while (stack.stack.length > 9000 /* Rec.CutTo */ && stack.forceReduce()) { }
|
23119
23212
|
}
|
23120
23213
|
let actions = this.tokens.getActions(stack);
|
23121
23214
|
for (let i = 0; i < actions.length;) {
|
@@ -23124,8 +23217,8 @@
|
|
23124
23217
|
let localStack = last ? stack : stack.split();
|
23125
23218
|
localStack.apply(action, term, end);
|
23126
23219
|
if (verbose)
|
23127
|
-
console.log(base + this.stackID(localStack) + ` (via ${(action & 65536 /* ReduceFlag */) == 0 ? "shift"
|
23128
|
-
: `reduce of ${parser.getName(action & 65535 /* ValueMask */)}`} for ${parser.getName(term)} @ ${start}${localStack == stack ? "" : ", split"})`);
|
23220
|
+
console.log(base + this.stackID(localStack) + ` (via ${(action & 65536 /* Action.ReduceFlag */) == 0 ? "shift"
|
23221
|
+
: `reduce of ${parser.getName(action & 65535 /* Action.ValueMask */)}`} for ${parser.getName(term)} @ ${start}${localStack == stack ? "" : ", split"})`);
|
23129
23222
|
if (last)
|
23130
23223
|
return true;
|
23131
23224
|
else if (localStack.pos > start)
|
@@ -23166,7 +23259,7 @@
|
|
23166
23259
|
continue;
|
23167
23260
|
}
|
23168
23261
|
let force = stack.split(), forceBase = base;
|
23169
|
-
for (let j = 0; force.forceReduce() && j < 10 /* ForceReduceLimit */; j++) {
|
23262
|
+
for (let j = 0; force.forceReduce() && j < 10 /* Rec.ForceReduceLimit */; j++) {
|
23170
23263
|
if (verbose)
|
23171
23264
|
console.log(forceBase + this.stackID(force) + " (via force-reduce)");
|
23172
23265
|
let done = this.advanceFully(force, newStacks);
|
@@ -23183,7 +23276,7 @@
|
|
23183
23276
|
if (this.stream.end > stack.pos) {
|
23184
23277
|
if (tokenEnd == stack.pos) {
|
23185
23278
|
tokenEnd++;
|
23186
|
-
token = 0 /* Err */;
|
23279
|
+
token = 0 /* Term.Err */;
|
23187
23280
|
}
|
23188
23281
|
stack.recoverByDelete(token, tokenEnd);
|
23189
23282
|
if (verbose)
|
@@ -23243,8 +23336,8 @@
|
|
23243
23336
|
super();
|
23244
23337
|
/// @internal
|
23245
23338
|
this.wrappers = [];
|
23246
|
-
if (spec.version != 14 /* Version */)
|
23247
|
-
throw new RangeError(`Parser version (${spec.version}) doesn't match runtime version (${14 /* Version */})`);
|
23339
|
+
if (spec.version != 14 /* File.Version */)
|
23340
|
+
throw new RangeError(`Parser version (${spec.version}) doesn't match runtime version (${14 /* File.Version */})`);
|
23248
23341
|
let nodeNames = spec.nodeNames.split(" ");
|
23249
23342
|
this.minRepeatTerm = nodeNames.length;
|
23250
23343
|
for (let i = 0; i < spec.repeatNodeCount; i++)
|
@@ -23334,16 +23427,16 @@
|
|
23334
23427
|
hasAction(state, terminal) {
|
23335
23428
|
let data = this.data;
|
23336
23429
|
for (let set = 0; set < 2; set++) {
|
23337
|
-
for (let i = this.stateSlot(state, set ? 2 /* Skip */ : 1 /* Actions */), next;; i += 3) {
|
23338
|
-
if ((next = data[i]) == 65535 /* End */) {
|
23339
|
-
if (data[i + 1] == 1 /* Next */)
|
23430
|
+
for (let i = this.stateSlot(state, set ? 2 /* ParseState.Skip */ : 1 /* ParseState.Actions */), next;; i += 3) {
|
23431
|
+
if ((next = data[i]) == 65535 /* Seq.End */) {
|
23432
|
+
if (data[i + 1] == 1 /* Seq.Next */)
|
23340
23433
|
next = data[i = pair(data, i + 2)];
|
23341
|
-
else if (data[i + 1] == 2 /* Other */)
|
23434
|
+
else if (data[i + 1] == 2 /* Seq.Other */)
|
23342
23435
|
return pair(data, i + 2);
|
23343
23436
|
else
|
23344
23437
|
break;
|
23345
23438
|
}
|
23346
|
-
if (next == terminal || next == 0 /* Err */)
|
23439
|
+
if (next == terminal || next == 0 /* Term.Err */)
|
23347
23440
|
return pair(data, i + 1);
|
23348
23441
|
}
|
23349
23442
|
}
|
@@ -23351,19 +23444,19 @@
|
|
23351
23444
|
}
|
23352
23445
|
/// @internal
|
23353
23446
|
stateSlot(state, slot) {
|
23354
|
-
return this.states[(state * 6 /* Size */) + slot];
|
23447
|
+
return this.states[(state * 6 /* ParseState.Size */) + slot];
|
23355
23448
|
}
|
23356
23449
|
/// @internal
|
23357
23450
|
stateFlag(state, flag) {
|
23358
|
-
return (this.stateSlot(state, 0 /* Flags */) & flag) > 0;
|
23451
|
+
return (this.stateSlot(state, 0 /* ParseState.Flags */) & flag) > 0;
|
23359
23452
|
}
|
23360
23453
|
/// @internal
|
23361
23454
|
validAction(state, action) {
|
23362
|
-
if (action == this.stateSlot(state, 4 /* DefaultReduce */))
|
23455
|
+
if (action == this.stateSlot(state, 4 /* ParseState.DefaultReduce */))
|
23363
23456
|
return true;
|
23364
|
-
for (let i = this.stateSlot(state, 1 /* Actions */);; i += 3) {
|
23365
|
-
if (this.data[i] == 65535 /* End */) {
|
23366
|
-
if (this.data[i + 1] == 1 /* Next */)
|
23457
|
+
for (let i = this.stateSlot(state, 1 /* ParseState.Actions */);; i += 3) {
|
23458
|
+
if (this.data[i] == 65535 /* Seq.End */) {
|
23459
|
+
if (this.data[i + 1] == 1 /* Seq.Next */)
|
23367
23460
|
i = pair(this.data, i + 2);
|
23368
23461
|
else
|
23369
23462
|
return false;
|
@@ -23376,14 +23469,14 @@
|
|
23376
23469
|
/// goto jumps. @internal
|
23377
23470
|
nextStates(state) {
|
23378
23471
|
let result = [];
|
23379
|
-
for (let i = this.stateSlot(state, 1 /* Actions */);; i += 3) {
|
23380
|
-
if (this.data[i] == 65535 /* End */) {
|
23381
|
-
if (this.data[i + 1] == 1 /* Next */)
|
23472
|
+
for (let i = this.stateSlot(state, 1 /* ParseState.Actions */);; i += 3) {
|
23473
|
+
if (this.data[i] == 65535 /* Seq.End */) {
|
23474
|
+
if (this.data[i + 1] == 1 /* Seq.Next */)
|
23382
23475
|
i = pair(this.data, i + 2);
|
23383
23476
|
else
|
23384
23477
|
break;
|
23385
23478
|
}
|
23386
|
-
if ((this.data[i + 2] & (65536 /* ReduceFlag */ >> 16)) == 0) {
|
23479
|
+
if ((this.data[i + 2] & (65536 /* Action.ReduceFlag */ >> 16)) == 0) {
|
23387
23480
|
let value = this.data[i + 1];
|
23388
23481
|
if (!result.some((v, i) => (i & 1) && v == value))
|
23389
23482
|
result.push(this.data[i], value);
|
@@ -23391,11 +23484,6 @@
|
|
23391
23484
|
}
|
23392
23485
|
return result;
|
23393
23486
|
}
|
23394
|
-
/// @internal
|
23395
|
-
overrides(token, prev) {
|
23396
|
-
let iPrev = findOffset(this.data, this.tokenPrecTable, prev);
|
23397
|
-
return iPrev < 0 || findOffset(this.data, this.tokenPrecTable, token) < iPrev;
|
23398
|
-
}
|
23399
23487
|
/// Configure the parser. Returns a new parser instance that has the
|
23400
23488
|
/// given settings modified. Settings not provided in `config` are
|
23401
23489
|
/// kept from the original parser.
|
@@ -23473,30 +23561,24 @@
|
|
23473
23561
|
let disabled = null;
|
23474
23562
|
for (let i = 0; i < values.length; i++)
|
23475
23563
|
if (!flags[i]) {
|
23476
|
-
for (let j = this.dialects[values[i]], id; (id = this.data[j++]) != 65535 /* End */;)
|
23564
|
+
for (let j = this.dialects[values[i]], id; (id = this.data[j++]) != 65535 /* Seq.End */;)
|
23477
23565
|
(disabled || (disabled = new Uint8Array(this.maxTerm + 1)))[id] = 1;
|
23478
23566
|
}
|
23479
23567
|
return new Dialect(dialect, flags, disabled);
|
23480
23568
|
}
|
23481
23569
|
/// Used by the output of the parser generator. Not available to
|
23482
|
-
/// user code.
|
23570
|
+
/// user code. @hide
|
23483
23571
|
static deserialize(spec) {
|
23484
23572
|
return new LRParser(spec);
|
23485
23573
|
}
|
23486
23574
|
}
|
23487
23575
|
function pair(data, off) { return data[off] | (data[off + 1] << 16); }
|
23488
|
-
function findOffset(data, start, term) {
|
23489
|
-
for (let i = start, next; (next = data[i]) != 65535 /* End */; i++)
|
23490
|
-
if (next == term)
|
23491
|
-
return i - start;
|
23492
|
-
return -1;
|
23493
|
-
}
|
23494
23576
|
function findFinished(stacks) {
|
23495
23577
|
let best = null;
|
23496
23578
|
for (let stack of stacks) {
|
23497
23579
|
let stopped = stack.p.stoppedAt;
|
23498
23580
|
if ((stack.pos == stack.p.stream.end || stopped != null && stack.pos > stopped) &&
|
23499
|
-
stack.p.parser.stateFlag(stack.state, 2 /* Accepting */) &&
|
23581
|
+
stack.p.parser.stateFlag(stack.state, 2 /* StateFlag.Accepting */) &&
|
23500
23582
|
(!best || best.score < stack.score))
|
23501
23583
|
best = stack;
|
23502
23584
|
}
|
@@ -23504,7 +23586,7 @@
|
|
23504
23586
|
}
|
23505
23587
|
function getSpecializer(spec) {
|
23506
23588
|
if (spec.external) {
|
23507
|
-
let mask = spec.extend ? 1 /* Extend */ : 0 /* Specialize */;
|
23589
|
+
let mask = spec.extend ? 1 /* Specialize.Extend */ : 0 /* Specialize.Specialize */;
|
23508
23590
|
return (value, stack) => (spec.external(value, stack) << 1) | mask;
|
23509
23591
|
}
|
23510
23592
|
return spec.get;
|
@@ -23829,7 +23911,7 @@
|
|
23829
23911
|
states: "%vQ]QQOOO#wQRO'#DSO$OQQO'#CwO%eQQO'#CxO%lQQO'#CyO%sQQO'#CzOOQQ'#DS'#DSOOQQ'#C}'#C}O'UQRO'#C{OOQQ'#Cv'#CvOOQQ'#C|'#C|Q]QQOOQOQQOOO'`QQO'#DOO(xQRO,59cO)PQQO,59cO)UQQO'#DSOOQQ,59d,59dO)cQQO,59dOOQQ,59e,59eO)jQQO,59eOOQQ,59f,59fO)qQQO,59fOOQQ-E6{-E6{OOQQ,59b,59bOOQQ-E6z-E6zOOQQ,59j,59jOOQQ-E6|-E6|O+VQRO1G.}O+^QQO,59cOOQQ1G/O1G/OOOQQ1G/P1G/POOQQ1G/Q1G/QP+kQQO'#C}O+rQQO1G.}O)PQQO,59cO,PQQO'#Cw",
|
23830
23912
|
stateData: ",[~OtOSPOSQOS~ORUOSUOTUOUUOVROXSOZTO]XO^QO_UO`UOaPObPOcPOdUOeUOfUOgUOhUO~O^]ORvXSvXTvXUvXVvXXvXZvX]vX_vX`vXavXbvXcvXdvXevXfvXgvXhvX~OsvX~P!jOa_Ob_Oc_O~ORUOSUOTUOUUOVROXSOZTO^tO_UO`UOa`Ob`Oc`OdUOeUOfUOgUOhUO~OWaO~P$ZOYcO~P$ZO[eO~P$ZORUOSUOTUOUUOVROXSOZTO^QO_UO`UOaPObPOcPOdUOeUOfUOgUOhUO~O]hOsoX~P%zOajObjOcjO~O^]ORkaSkaTkaUkaVkaXkaZka]ka_ka`kaakabkackadkaekafkagkahka~Oska~P'kO^]O~OWvXYvX[vX~P!jOWnO~P$ZOYoO~P$ZO[pO~P$ZO^]ORkiSkiTkiUkiVkiXkiZki]ki_ki`kiakibkickidkiekifkigkihki~Oski~P)xOWkaYka[ka~P'kO]hO~P$ZOWkiYki[ki~P)xOasObsOcsO~O",
|
23831
23913
|
goto: "#hwPPPPPPPPPPPPPPPPPPPPPPPPPPx||||!Y!^!d!xPPP#[TYOZeUORSTWZbdfqT[OZQZORiZSWOZQbRQdSQfTZgWbdfqQ^PWk^lmrQl_Qm`RrseVORSTWZbdfq",
|
23832
|
-
nodeNames: "⚠ LineComment BlockComment String Number Bool Null ( ) [ ]
|
23914
|
+
nodeNames: "⚠ LineComment BlockComment String Number Bool Null ( ) { } [ ] ; . Operator Punctuation SpecialVar Identifier QuotedIdentifier Keyword Type Bits Bytes Builtin Script Statement CompositeIdentifier Parens Braces Brackets Statement",
|
23833
23915
|
maxTerm: 38,
|
23834
23916
|
skippedNodes: [0,1,2],
|
23835
23917
|
repeatNodeCount: 3,
|
@@ -23943,7 +24025,7 @@
|
|
23943
24025
|
return this.children ? Object.keys(this.children).filter(x => x).map(name => ({ label: name, type })) : [];
|
23944
24026
|
}
|
23945
24027
|
}
|
23946
|
-
function completeFromSchema(schema, tables, defaultTableName, defaultSchemaName) {
|
24028
|
+
function completeFromSchema(schema, tables, schemas, defaultTableName, defaultSchemaName) {
|
23947
24029
|
let top = new CompletionLevel;
|
23948
24030
|
let defaultSchema = top.child(defaultSchemaName || "");
|
23949
24031
|
for (let table in schema) {
|
@@ -23959,7 +24041,7 @@
|
|
23959
24041
|
if (!schema.list.length)
|
23960
24042
|
schema.list = schema.childCompletions("type");
|
23961
24043
|
}
|
23962
|
-
top.list = defaultSchema.list.concat(top.childCompletions("type"));
|
24044
|
+
top.list = defaultSchema.list.concat(schemas || top.childCompletions("type"));
|
23963
24045
|
return (context) => {
|
23964
24046
|
let { parents, from, quoted, empty, aliases } = sourceContext(context.state, context.pos);
|
23965
24047
|
if (empty && !context.explicit)
|
@@ -24081,7 +24163,7 @@
|
|
24081
24163
|
for the given configuration.
|
24082
24164
|
*/
|
24083
24165
|
function schemaCompletionSource(config) {
|
24084
|
-
return config.schema ? completeFromSchema(config.schema, config.tables, config.defaultTable, config.defaultSchema)
|
24166
|
+
return config.schema ? completeFromSchema(config.schema, config.tables, config.schemas, config.defaultTable, config.defaultSchema)
|
24085
24167
|
: () => null;
|
24086
24168
|
}
|
24087
24169
|
const MySQLKeywords = "accessible algorithm analyze asensitive authors auto_increment autocommit avg avg_row_length binlog btree cache catalog_name chain change changed checkpoint checksum class_origin client_statistics coalesce code collations columns comment committed completion concurrent consistent contains contributors convert database databases day_hour day_microsecond day_minute day_second delay_key_write delayed delimiter des_key_file dev_pop dev_samp deviance directory disable discard distinctrow div dual dumpfile enable enclosed ends engine engines enum errors escaped even event events every explain extended fast field fields flush force found_rows fulltext grants handler hash high_priority hosts hour_microsecond hour_minute hour_second ignore ignore_server_ids import index index_statistics infile innodb insensitive insert_method install invoker iterate keys kill linear lines list load lock logs low_priority master master_heartbeat_period master_ssl_verify_server_cert masters max max_rows maxvalue message_text middleint migrate min min_rows minute_microsecond minute_second mod mode modify mutex mysql_errno no_write_to_binlog offline offset one online optimize optionally outfile pack_keys parser partition partitions password phase plugin plugins prev processlist profile profiles purge query quick range read_write rebuild recover regexp relaylog remove rename reorganize repair repeatable replace require resume rlike row_format rtree schedule schema_name schemas second_microsecond security sensitive separator serializable server share show slave slow snapshot soname spatial sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_no_cache sql_small_result ssl starting starts std stddev stddev_pop stddev_samp storage straight_join subclass_origin sum suspend table_name table_statistics tables tablespace terminated triggers truncate uncommitted uninstall unlock upgrade use use_frm user_resources user_statistics utc_date utc_time utc_timestamp variables views warnings xa xor year_month zerofill";
|
@@ -24107,9 +24189,7 @@
|
|
24107
24189
|
function createEditor (parent, metadata, onSubmit, onShiftSubmit) {
|
24108
24190
|
const fixedHeightEditor = EditorView.theme({
|
24109
24191
|
'.cm-scroller': {
|
24110
|
-
|
24111
|
-
overflow: 'auto',
|
24112
|
-
resize: 'vertical'
|
24192
|
+
overflow: 'auto'
|
24113
24193
|
}
|
24114
24194
|
});
|
24115
24195
|
const schemas = Object.entries(metadata.schemas);
|
@@ -24199,7 +24279,7 @@
|
|
24199
24279
|
]);
|
24200
24280
|
const sqlConfig = {
|
24201
24281
|
dialect: MySQL,
|
24202
|
-
upperCaseKeywords:
|
24282
|
+
upperCaseKeywords: false,
|
24203
24283
|
schema: editorSchema,
|
24204
24284
|
tables
|
24205
24285
|
};
|
@@ -24336,7 +24416,7 @@
|
|
24336
24416
|
}
|
24337
24417
|
}),
|
24338
24418
|
MySQL.language.data.of({
|
24339
|
-
autocomplete: keywordCompletionSource(MySQL,
|
24419
|
+
autocomplete: keywordCompletionSource(MySQL, false)
|
24340
24420
|
})
|
24341
24421
|
]
|
24342
24422
|
);
|
@@ -24615,48 +24695,79 @@
|
|
24615
24695
|
}
|
24616
24696
|
}
|
24617
24697
|
|
24618
|
-
var css_248z = ".popup_popup-wrapper__huCTg {\n position: absolute;\n
|
24619
|
-
var styles = {"popup-wrapper":"popup_popup-wrapper__huCTg","popup
|
24698
|
+
var css_248z$1 = ".popup_popup-wrapper__huCTg {\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n z-index: 2;\n margin: 0;\n padding: 0;\n background: rgba(0, 0, 0, 0.3);\n}\n\n.popup_popup__co5G- {\n position: absolute;\n top: 60px;\n right: 60px;\n bottom: 60px;\n left: 60px;\n display: flex;\n flex-direction: column;\n margin: 0;\n padding: 0;\n background: #fff;\n border: 1px solid #888;\n}\n\n.popup_title__JT4Lb {\n margin: 0;\n padding: 10px;\n font-weight: bold;\n font-family: Helvetica, sans-serif;\n font-size: 18px;\n color: #333;\n white-space: nowrap;\n text-overflow: ellipsis;\n overflow: hidden;\n}\n\n.popup_content__m7uSh {\n flex: 1;\n margin: 0;\n padding: 10px;\n overflow: auto;\n font-family: monospace;\n font-size: 18px;\n border-top: 1px solid #888;\n border-bottom: 1px solid #888;\n color: #333;\n}\n\n.popup_content__m7uSh:focus {\n outline: none;\n}\n\n.popup_button-bar__VCxAC {\n display: flex;\n flex-direction: row;\n justify-content: right;\n margin: 0;\n padding: 10px;\n}\n\n.popup_button__CkIzv {\n width: 100px;\n height: 30px;\n margin: 0 5px;\n cursor: pointer;\n font-family: Helvetica, sans-serif;\n display: flex;\n justify-content: center;\n font-size: 18px;\n color: #333;\n border: 1px solid #888;\n}\n\n.popup_button__CkIzv:active {\n background-color: #e6e6e6;\n}\n";
|
24699
|
+
var styles$1 = {"popup-wrapper":"popup_popup-wrapper__huCTg","popup":"popup_popup__co5G-","title":"popup_title__JT4Lb","content":"popup_content__m7uSh","button-bar":"popup_button-bar__VCxAC","button":"popup_button__CkIzv"};
|
24700
|
+
styleInject(css_248z$1);
|
24701
|
+
|
24702
|
+
var css_248z = ".toast_toast__019Ay {\n min-width: 250px; /* Set a default minimum width */\n margin-left: -125px; /* Divide value of min-width by 2 */\n position: fixed; /* Sit on top of the screen */\n left: 50%; /* Center on screen. */\n top: 30px; /* 30px from the top of the screen */\n z-index: 3;\n background-color: white;\n font-family: Helvetica, sans-serif;\n font-size: 18px;\n box-shadow: 2px 2px 2px rgb(0, 0, 0, .2);\n color: #333;\n border: 1px solid #888;\n text-align: center;\n border-radius: 2px;\n padding: 10px;\n -webkit-animation: toast_fadein__g6ghy 0.5s, toast_fadeout__8dF5T 0.5s 2.5s;\n animation: toast_fadein__g6ghy 0.5s, toast_fadeout__8dF5T 0.5s 2.5s;\n}\n\n@-webkit-keyframes toast_fadein__g6ghy {\n from {top: 0; opacity: 0;}\n to {top: 30px; opacity: 1;}\n}\n\n@keyframes toast_fadein__g6ghy {\n from {top: 0; opacity: 0;}\n to {top: 30px; opacity: 1;}\n}\n\n@-webkit-keyframes toast_fadeout__8dF5T {\n from {top: 30px; opacity: 1;}\n to {top: 0; opacity: 0;}\n}\n\n@keyframes toast_fadeout__8dF5T {\n from {top: 30px; opacity: 1;}\n to {top: 0; opacity: 0;}\n}\n";
|
24703
|
+
var styles = {"toast":"toast_toast__019Ay","fadein":"toast_fadein__g6ghy","fadeout":"toast_fadeout__8dF5T"};
|
24620
24704
|
styleInject(css_248z);
|
24621
24705
|
|
24706
|
+
function toast (text) {
|
24707
|
+
const toastElement = document.createElement('div');
|
24708
|
+
toastElement.innerText = text;
|
24709
|
+
toastElement.classList.add(styles.toast);
|
24710
|
+
document.body.appendChild(toastElement);
|
24711
|
+
toastElement.onanimationend = (e) => {
|
24712
|
+
if (e.animationName === styles.fadeout) {
|
24713
|
+
document.body.removeChild(toastElement);
|
24714
|
+
}
|
24715
|
+
};
|
24716
|
+
}
|
24717
|
+
|
24622
24718
|
function createPopup (title, text) {
|
24623
|
-
const
|
24624
|
-
|
24625
|
-
|
24626
|
-
document.body.appendChild(
|
24719
|
+
const popupWrapperElement = document.createElement('div');
|
24720
|
+
popupWrapperElement.id = 'popup-wrapper';
|
24721
|
+
popupWrapperElement.classList.add(styles$1['popup-wrapper']);
|
24722
|
+
document.body.appendChild(popupWrapperElement);
|
24627
24723
|
|
24628
|
-
|
24629
|
-
|
24630
|
-
|
24724
|
+
popupWrapperElement.addEventListener('click', () => {
|
24725
|
+
document.body.removeChild(popupWrapperElement);
|
24726
|
+
});
|
24631
24727
|
|
24632
|
-
const
|
24633
|
-
|
24634
|
-
|
24635
|
-
|
24636
|
-
closeElement.value = 'Close';
|
24637
|
-
contentElement.appendChild(closeElement);
|
24728
|
+
const popupElement = document.createElement('div');
|
24729
|
+
popupElement.id = 'popup';
|
24730
|
+
popupElement.classList.add(styles$1.popup);
|
24731
|
+
popupWrapperElement.appendChild(popupElement);
|
24638
24732
|
|
24639
|
-
|
24640
|
-
|
24733
|
+
popupElement.addEventListener('click', (event) => {
|
24734
|
+
event.stopPropagation();
|
24641
24735
|
});
|
24642
24736
|
|
24643
24737
|
const titleElement = document.createElement('div');
|
24644
|
-
titleElement.classList.add(styles
|
24738
|
+
titleElement.classList.add(styles$1.title);
|
24645
24739
|
titleElement.innerText = title;
|
24646
|
-
|
24647
|
-
|
24648
|
-
const
|
24649
|
-
|
24650
|
-
|
24651
|
-
|
24652
|
-
|
24653
|
-
|
24654
|
-
|
24655
|
-
|
24740
|
+
popupElement.appendChild(titleElement);
|
24741
|
+
|
24742
|
+
const contentElement = document.createElement('pre');
|
24743
|
+
contentElement.classList.add(styles$1.content);
|
24744
|
+
contentElement.innerText = text;
|
24745
|
+
popupElement.appendChild(contentElement);
|
24746
|
+
|
24747
|
+
const buttonBarElement = document.createElement('div');
|
24748
|
+
buttonBarElement.classList.add(styles$1['button-bar']);
|
24749
|
+
popupElement.appendChild(buttonBarElement);
|
24750
|
+
|
24751
|
+
const copyElement = document.createElement('input');
|
24752
|
+
copyElement.classList.add(styles$1.button);
|
24753
|
+
copyElement.type = 'button';
|
24754
|
+
copyElement.value = 'Copy';
|
24755
|
+
buttonBarElement.appendChild(copyElement);
|
24756
|
+
|
24757
|
+
copyElement.addEventListener('click', (event) => {
|
24758
|
+
copyTextToClipboard(text);
|
24759
|
+
toast('Text copied to clipboard.');
|
24656
24760
|
});
|
24657
24761
|
|
24658
|
-
|
24659
|
-
|
24762
|
+
const closeElement = document.createElement('input');
|
24763
|
+
closeElement.id = 'popup-close';
|
24764
|
+
closeElement.classList.add(styles$1.button);
|
24765
|
+
closeElement.type = 'button';
|
24766
|
+
closeElement.value = 'Close';
|
24767
|
+
buttonBarElement.appendChild(closeElement);
|
24768
|
+
|
24769
|
+
closeElement.addEventListener('click', (event) => {
|
24770
|
+
document.body.removeChild(popupWrapperElement);
|
24660
24771
|
});
|
24661
24772
|
|
24662
24773
|
closeElement.focus();
|
@@ -24664,13 +24775,13 @@
|
|
24664
24775
|
|
24665
24776
|
document.addEventListener('keydown', (event) => {
|
24666
24777
|
if (event.code === 'Escape') {
|
24667
|
-
const wrapperElement = document.getElementById('popup');
|
24778
|
+
const wrapperElement = document.getElementById('popup-wrapper');
|
24668
24779
|
if (wrapperElement) {
|
24669
24780
|
event.preventDefault();
|
24670
24781
|
document.body.removeChild(wrapperElement);
|
24671
24782
|
}
|
24672
24783
|
} else if (event.code === 'Tab') {
|
24673
|
-
const wrapperElement = document.getElementById('popup');
|
24784
|
+
const wrapperElement = document.getElementById('popup-wrapper');
|
24674
24785
|
if (wrapperElement) {
|
24675
24786
|
event.preventDefault();
|
24676
24787
|
document.getElementById('popup-close').focus();
|
@@ -24678,6 +24789,31 @@
|
|
24678
24789
|
}
|
24679
24790
|
});
|
24680
24791
|
|
24792
|
+
function createVerticalResizer (resizerElement, resizableElement, min, max) {
|
24793
|
+
let startY = null;
|
24794
|
+
let startHeight = null;
|
24795
|
+
|
24796
|
+
const moveListener = (event) => {
|
24797
|
+
const y = event.clientY - startY;
|
24798
|
+
const height = Math.min(max, Math.max(min, startHeight + y));
|
24799
|
+
console.log(`y: ${y}, height: ${height}`);
|
24800
|
+
resizableElement.style.height = `${height}px`;
|
24801
|
+
};
|
24802
|
+
|
24803
|
+
resizerElement.addEventListener('mousedown', (event) => {
|
24804
|
+
if (event.button !== 0) return
|
24805
|
+
event.preventDefault();
|
24806
|
+
startY = event.clientY;
|
24807
|
+
startHeight = resizableElement.clientHeight;
|
24808
|
+
document.addEventListener('mousemove', moveListener);
|
24809
|
+
});
|
24810
|
+
|
24811
|
+
document.addEventListener('mouseup', (_) => {
|
24812
|
+
startY = null;
|
24813
|
+
document.removeEventListener('mousemove', moveListener);
|
24814
|
+
});
|
24815
|
+
}
|
24816
|
+
|
24681
24817
|
/* global google */
|
24682
24818
|
|
24683
24819
|
const PAGE_SIZE = 100;
|
@@ -24808,6 +24944,11 @@
|
|
24808
24944
|
});
|
24809
24945
|
|
24810
24946
|
window.editorView = createEditor(parent, window.metadata, onSubmit, onShiftSubmit);
|
24947
|
+
const cmScroller = document.getElementsByClassName('cm-scroller')[0];
|
24948
|
+
cmScroller.style.height = '200px';
|
24949
|
+
|
24950
|
+
const editorResizer = document.getElementById('editor-resizer');
|
24951
|
+
createVerticalResizer(editorResizer, cmScroller, 100, 500);
|
24811
24952
|
}
|
24812
24953
|
|
24813
24954
|
function addEventListener (elementOrSelector, type, func) {
|
@@ -25073,7 +25214,7 @@
|
|
25073
25214
|
document.getElementById('submit-box').style.display = 'flex';
|
25074
25215
|
document.getElementById('graph-box').style.display = 'flex';
|
25075
25216
|
document.getElementById('fetch-sql-box').style.display = 'none';
|
25076
|
-
document.getElementById('cancel-button').style.
|
25217
|
+
document.getElementById('cancel-button').style.visibility = 'hidden';
|
25077
25218
|
updateDownloadButtons(window?.sqlFetch);
|
25078
25219
|
maybeFetchResult(internal);
|
25079
25220
|
|
@@ -25085,7 +25226,7 @@
|
|
25085
25226
|
document.getElementById('submit-box').style.display = 'flex';
|
25086
25227
|
document.getElementById('result-box').style.display = 'flex';
|
25087
25228
|
document.getElementById('fetch-sql-box').style.display = 'none';
|
25088
|
-
document.getElementById('cancel-button').style.
|
25229
|
+
document.getElementById('cancel-button').style.visibility = 'hidden';
|
25089
25230
|
focus(getSelection());
|
25090
25231
|
maybeFetchResult(internal);
|
25091
25232
|
}
|
@@ -25512,7 +25653,7 @@
|
|
25512
25653
|
return
|
25513
25654
|
}
|
25514
25655
|
|
25515
|
-
document.getElementById('cancel-button').style.
|
25656
|
+
document.getElementById('cancel-button').style.visibility = 'hidden';
|
25516
25657
|
document.getElementById('fetch-sql-box').style.display = 'none';
|
25517
25658
|
document.getElementById('result-box').style.display = 'flex';
|
25518
25659
|
|
@@ -25558,25 +25699,36 @@
|
|
25558
25699
|
|
25559
25700
|
function registerTableCellPopup (tableElement) {
|
25560
25701
|
const listener = (event) => {
|
25561
|
-
if (event.which === 1 && event.
|
25702
|
+
if (event.which === 1 && (event.metaKey || event.altKey)) {
|
25562
25703
|
let node = event.target;
|
25563
25704
|
while (!['td', 'th', 'table'].includes(node.tagName.toLowerCase()) && node.parentNode) {
|
25564
25705
|
node = node.parentNode;
|
25565
25706
|
}
|
25707
|
+
|
25566
25708
|
if (node.tagName.toLowerCase() === 'td') {
|
25567
|
-
if (event.type === 'mousedown') {
|
25709
|
+
if (event.type === 'mousedown' && node.dataset.row) {
|
25568
25710
|
const row = parseInt(node.dataset.row);
|
25569
25711
|
const column = parseInt(node.dataset.column);
|
25570
25712
|
const title = window.sqlFetch.result.columns[column].replaceAll('\n', '¶');
|
25571
|
-
|
25713
|
+
if (event.metaKey) {
|
25714
|
+
createPopup(title, window.sqlFetch.result.rows[row][column]);
|
25715
|
+
} else if (event.altKey) {
|
25716
|
+
copyTextToClipboard(window.sqlFetch.result.rows[row][column]);
|
25717
|
+
toast('Text copied to clipboard.');
|
25718
|
+
}
|
25572
25719
|
}
|
25573
25720
|
event.preventDefault();
|
25574
25721
|
} else if (node.tagName.toLowerCase() === 'th') {
|
25575
|
-
if (event.type === 'mousedown') {
|
25722
|
+
if (event.type === 'mousedown' && node.dataset.column) {
|
25576
25723
|
const column = parseInt(node.dataset.column);
|
25577
25724
|
const value = window.sqlFetch.result.columns[column];
|
25578
25725
|
const title = value.replaceAll('\n', '¶');
|
25579
|
-
|
25726
|
+
if (event.metaKey) {
|
25727
|
+
createPopup(title, value);
|
25728
|
+
} else if (event.altKey) {
|
25729
|
+
copyTextToClipboard(value);
|
25730
|
+
toast('Text copied to clipboard.');
|
25731
|
+
}
|
25580
25732
|
}
|
25581
25733
|
event.preventDefault();
|
25582
25734
|
}
|
@@ -25624,12 +25776,12 @@
|
|
25624
25776
|
}
|
25625
25777
|
|
25626
25778
|
function clearSpinner () {
|
25627
|
-
document.getElementById('cancel-button').style.
|
25779
|
+
document.getElementById('cancel-button').style.visibility = 'hidden';
|
25628
25780
|
document.getElementById('fetch-sql-box').style.display = 'none';
|
25629
25781
|
}
|
25630
25782
|
|
25631
25783
|
function displaySpinner (fetch) {
|
25632
|
-
document.getElementById('cancel-button').style.
|
25784
|
+
document.getElementById('cancel-button').style.visibility = 'visible';
|
25633
25785
|
document.getElementById('fetch-sql-box').style.display = 'flex';
|
25634
25786
|
|
25635
25787
|
const elapsed = window.performance.now() - fetch.startedAt;
|
@@ -25664,7 +25816,7 @@
|
|
25664
25816
|
return
|
25665
25817
|
}
|
25666
25818
|
|
25667
|
-
document.getElementById('cancel-button').style.
|
25819
|
+
document.getElementById('cancel-button').style.visibility = 'hidden';
|
25668
25820
|
document.getElementById('fetch-sql-box').style.display = 'none';
|
25669
25821
|
document.getElementById('graph-box').style.display = 'flex';
|
25670
25822
|
|
@@ -25818,7 +25970,7 @@
|
|
25818
25970
|
document.getElementById('main-box').style.display = 'flex';
|
25819
25971
|
document.getElementById('server-name').innerText = window.metadata.server;
|
25820
25972
|
document.title = `SQLUI ${window.metadata.server}`;
|
25821
|
-
document.getElementById('header-link').href = result.
|
25973
|
+
document.getElementById('header-link').href = result.base_url_path;
|
25822
25974
|
const queryElement = document.getElementById('query');
|
25823
25975
|
|
25824
25976
|
init(queryElement, submitCurrent, submitAll);
|