Skip to content

Commit

Permalink
chore: Add types
Browse files Browse the repository at this point in the history
  • Loading branch information
isidroamv committed Dec 12, 2023
1 parent c8f4847 commit ccf90a9
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions packages/compiler/src/regex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -438,11 +438,10 @@ function nfaToDfa(nfa: NfaNode) {
};
}
function getClosedMove(closure: DfaNode, symbol: string | [string]): DfaNode {
var i, j, node;
const nexts: NfaNode[] = [];
for (i = 0; i < closure.items.length; i += 1) {
node = closure.items[i];
for (j = 0; j < node.edges.length; j += 1) {
for (let i = 0; i < closure.items.length; i += 1) {
const node = closure.items[i];
for (let j = 0; j < node.edges.length; j += 1) {
if (symbol === node.edges[j][0]) {
if (nexts.indexOf(node.edges[j][1]) < 0) {
nexts.push(node.edges[j][1]);
Expand Down Expand Up @@ -701,14 +700,12 @@ function minDfa(dfa: DfaNode) {
}

function toNature(col: string): number {
var i,
j,
base = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
result = 0;
const base = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
let result = 0;
if ('1' <= col[0] && col[0] <= '9') {
result = parseInt(col, 10);
} else {
for (i = 0, j = col.length - 1; i < col.length; i += 1, j -= 1) {
for (let i = 0, j = col.length - 1; i < col.length; i += 1, j -= 1) {
result += Math.pow(base.length, j) * (base.indexOf(col[i]) + 1);
}
}
Expand Down

0 comments on commit ccf90a9

Please sign in to comment.