@vuu-ui/vuu-popups 0.8.0-debug → 0.8.1-debug

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/cjs/index.js CHANGED
@@ -6995,26 +6995,58 @@ var Stack3 = class {
6995
6995
  // be done.
6996
6996
  /// @internal
6997
6997
  forceReduce() {
6998
- let reduce = this.p.parser.stateSlot(
6998
+ let { parser: parser2 } = this.p;
6999
+ let reduce = parser2.stateSlot(
6999
7000
  this.state,
7000
7001
  5
7001
7002
  /* ParseState.ForcedReduce */
7002
7003
  );
7003
7004
  if ((reduce & 65536) == 0)
7004
7005
  return false;
7005
- let { parser: parser2 } = this.p;
7006
7006
  if (!parser2.validAction(this.state, reduce)) {
7007
7007
  let depth = reduce >> 19, term = reduce & 65535;
7008
7008
  let target = this.stack.length - depth * 3;
7009
- if (target < 0 || parser2.getGoto(this.stack[target], term, false) < 0)
7010
- return false;
7011
- this.storeNode(0, this.reducePos, this.reducePos, 4, true);
7009
+ if (target < 0 || parser2.getGoto(this.stack[target], term, false) < 0) {
7010
+ let backup = this.findForcedReduction();
7011
+ if (backup == null)
7012
+ return false;
7013
+ reduce = backup;
7014
+ }
7015
+ this.storeNode(0, this.pos, this.pos, 4, true);
7012
7016
  this.score -= 100;
7013
7017
  }
7014
7018
  this.reducePos = this.pos;
7015
7019
  this.reduce(reduce);
7016
7020
  return true;
7017
7021
  }
7022
+ /// Try to scan through the automaton to find some kind of reduction
7023
+ /// that can be applied. Used when the regular ForcedReduce field
7024
+ /// isn't a valid action. @internal
7025
+ findForcedReduction() {
7026
+ let { parser: parser2 } = this.p, seen = [];
7027
+ let explore = (state, depth) => {
7028
+ if (seen.includes(state))
7029
+ return;
7030
+ seen.push(state);
7031
+ return parser2.allActions(state, (action) => {
7032
+ if (action & (262144 | 131072))
7033
+ ;
7034
+ else if (action & 65536) {
7035
+ let rDepth = (action >> 19) - depth;
7036
+ if (rDepth > 1) {
7037
+ let term = action & 65535, target = this.stack.length - rDepth * 3;
7038
+ if (target >= 0 && parser2.getGoto(this.stack[target], term, false) >= 0)
7039
+ return rDepth << 19 | 65536 | term;
7040
+ }
7041
+ } else {
7042
+ let found = explore(action, depth + 1);
7043
+ if (found != null)
7044
+ return found;
7045
+ }
7046
+ });
7047
+ };
7048
+ return explore(this.state, 0);
7049
+ }
7018
7050
  /// @internal
7019
7051
  forceAll() {
7020
7052
  while (!this.p.parser.stateFlag(
@@ -7083,13 +7115,13 @@ var Stack3 = class {
7083
7115
  emitContext() {
7084
7116
  let last = this.buffer.length - 1;
7085
7117
  if (last < 0 || this.buffer[last] != -3)
7086
- this.buffer.push(this.curContext.hash, this.reducePos, this.reducePos, -3);
7118
+ this.buffer.push(this.curContext.hash, this.pos, this.pos, -3);
7087
7119
  }
7088
7120
  /// @internal
7089
7121
  emitLookAhead() {
7090
7122
  let last = this.buffer.length - 1;
7091
7123
  if (last < 0 || this.buffer[last] != -4)
7092
- this.buffer.push(this.lookAhead, this.reducePos, this.reducePos, -4);
7124
+ this.buffer.push(this.lookAhead, this.pos, this.pos, -4);
7093
7125
  }
7094
7126
  updateContext(context) {
7095
7127
  if (context != this.curContext.context) {
@@ -7446,16 +7478,17 @@ var LocalTokenGroup = class {
7446
7478
  token(input, stack) {
7447
7479
  let start2 = input.pos, skipped = 0;
7448
7480
  for (; ; ) {
7481
+ let atEof = input.next < 0, nextPos = input.resolveOffset(1, 1);
7449
7482
  readToken(this.data, input, stack, 0, this.data, this.precTable);
7450
7483
  if (input.token.value > -1)
7451
7484
  break;
7452
7485
  if (this.elseToken == null)
7453
7486
  return;
7454
- if (input.next < 0)
7487
+ if (!atEof)
7488
+ skipped++;
7489
+ if (nextPos == null)
7455
7490
  break;
7456
- input.advance();
7457
- input.reset(input.pos, input.token);
7458
- skipped++;
7491
+ input.reset(nextPos, input.token);
7459
7492
  }
7460
7493
  if (skipped) {
7461
7494
  input.reset(start2, input.token);
@@ -8168,26 +8201,30 @@ var LRParser = class extends Parser {
8168
8201
  }
8169
8202
  /// @internal
8170
8203
  validAction(state, action) {
8171
- if (action == this.stateSlot(
8204
+ return !!this.allActions(state, (a) => a == action ? true : null);
8205
+ }
8206
+ /// @internal
8207
+ allActions(state, action) {
8208
+ let deflt = this.stateSlot(
8172
8209
  state,
8173
8210
  4
8174
8211
  /* ParseState.DefaultReduce */
8175
- ))
8176
- return true;
8212
+ );
8213
+ let result = deflt ? action(deflt) : void 0;
8177
8214
  for (let i = this.stateSlot(
8178
8215
  state,
8179
8216
  1
8180
8217
  /* ParseState.Actions */
8181
- ); ; i += 3) {
8218
+ ); result == null; i += 3) {
8182
8219
  if (this.data[i] == 65535) {
8183
8220
  if (this.data[i + 1] == 1)
8184
8221
  i = pair(this.data, i + 2);
8185
8222
  else
8186
- return false;
8223
+ break;
8187
8224
  }
8188
- if (action == pair(this.data, i + 1))
8189
- return true;
8225
+ result = action(pair(this.data, i + 1));
8190
8226
  }
8227
+ return result;
8191
8228
  }
8192
8229
  /// Get the states that can follow this one through shift actions or
8193
8230
  /// goto jumps. @internal