MCPcopy
hub / github.com/AlaSQL/alasql / locateNearestErrorRecoveryRule

Function locateNearestErrorRecoveryRule

src/alasqlparser.js:2149–2166  ·  view source on GitHub ↗
(state)

Source from the content-addressed store, hash-verified

2147 // Return the rule stack depth where the nearest error rule can be found.
2148 // Return FALSE when no error recovery rule was found.
2149 function locateNearestErrorRecoveryRule(state) {
2150 var stack_probe = stack.length - 1;
2151 var depth = 0;
2152
2153 // try to recover from error
2154 for(;;) {
2155 // check for error recovery rule in this state
2156 if ((TERROR.toString()) in table[state]) {
2157 return depth;
2158 }
2159 if (state === 0 || stack_probe < 2) {
2160 return false; // No suitable error recovery rule available.
2161 }
2162 stack_probe -= 2; // popStack(1): [symbol, action]
2163 state = stack[stack_probe];
2164 ++depth;
2165 }
2166 }
2167
2168 if (!recovering) {
2169 // first see if there's any chance at hitting an error recovery rule:

Callers 1

alasqlparser.jsFile · 0.85

Calls 1

toStringMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…