diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/paca.mjs | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/paca.mjs b/src/paca.mjs index 21a28e8..f1e3e50 100644 --- a/src/paca.mjs +++ b/src/paca.mjs @@ -795,7 +795,7 @@ const allDirects = (stateID, nodes) => ).flat(), )].toSorted(); -const interpretMetacharacter = ({ op, to, matches, ranges }, char) => { +const interpretMetacharacter = ({ op, to, matches, ranges }, char, index, nodes) => { if (!op) { return null; } @@ -815,14 +815,15 @@ const interpretMetacharacter = ({ op, to, matches, ranges }, char) => { return op === "excludes" && to; }; -const performTransition = (nodes, char) => id => +const performTransition = (nodes, char, index) => id => nodes[id].transitions[char] || - interpretMetacharacter(nodes[id].meta || {}, char); + interpretMetacharacter(nodes[id].meta || {}, char, index, nodes); -const searchNFAStep = nodes => (directStates, char) => +const searchNFAStep = nodes => (directStates, char, index) => [...new Set( directStates - .map(performTransition(nodes, char)) + .map(performTransition(nodes, char, index)) + .flat() .filter(x => !!x) .map(id => allDirects(id, nodes)) .flat() |
