From 2b9de4be81ac87e19b2634afd9e4c914a3d3f84c Mon Sep 17 00:00:00 2001 From: Ean Milligan Date: Tue, 1 Jul 2025 02:15:46 -0400 Subject: [PATCH] fix naming on this, idk why there were x's on them --- src/artigen/cmdTokenizer.ts | 6 +++--- src/artigen/math/mathSolver.ts | 4 ++-- src/artigen/utils/parenBalance.ts | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/artigen/cmdTokenizer.ts b/src/artigen/cmdTokenizer.ts index a024d66..9903eee 100644 --- a/src/artigen/cmdTokenizer.ts +++ b/src/artigen/cmdTokenizer.ts @@ -13,7 +13,7 @@ import { tokenizeMath } from 'artigen/math/mathTokenizer.ts'; import { reduceCountDetails } from 'artigen/utils/counter.ts'; import { closeInternal, internalWrapRegex, openInternal } from 'artigen/utils/escape.ts'; import { loggingEnabled } from 'artigen/utils/logFlag.ts'; -import { getMatchingInternalIdx, getMatchingPostfixIdx } from 'artigen/utils/parenBalance.ts'; +import { getMatchingInternalId, getMatchingPostfixId } from 'artigen/utils/parenBalance.ts'; import { basicReducer } from 'artigen/utils/reducers.ts'; // tokenizeCmd expects a string[] of items that are either config.prefix/config.postfix or some text that contains math and/or dice rolls @@ -34,7 +34,7 @@ export const tokenizeCmd = ( loopCountCheck(); const openIdx = cmd.indexOf(config.prefix); - const closeIdx = getMatchingPostfixIdx(cmd, openIdx); + const closeIdx = getMatchingPostfixId(cmd, openIdx); const currentCmd = cmd.slice(openIdx + 1, closeIdx); @@ -150,7 +150,7 @@ export const tokenizeCmd = ( loopCountCheck(); const openIdx = initConf.indexOf(openInternal); - const closeIdx = getMatchingInternalIdx(initConf, openIdx); + const closeIdx = getMatchingInternalId(initConf, openIdx); // Take first returnData out of array const dataToMerge = returnData.shift(); diff --git a/src/artigen/math/mathSolver.ts b/src/artigen/math/mathSolver.ts index ec6009a..acd4146 100644 --- a/src/artigen/math/mathSolver.ts +++ b/src/artigen/math/mathSolver.ts @@ -11,7 +11,7 @@ import { loopCountCheck } from 'artigen/managers/loopManager.ts'; import { legalMath, legalMathOperators } from 'artigen/utils/legalMath.ts'; import { loggingEnabled } from 'artigen/utils/logFlag.ts'; -import { getMatchingParenIdx } from 'artigen/utils/parenBalance.ts'; +import { getMatchingParenId } from 'artigen/utils/parenBalance.ts'; // mathSolver(conf, wrapDetails) returns one condensed SolvedStep // mathSolver is a function that recursively solves the full roll and math @@ -39,7 +39,7 @@ export const mathSolver = (conf: MathConf[], wrapDetails = false): SolvedStep => loggingEnabled && log(LT.LOG, `Evaluating roll ${JSON.stringify(conf)} | Looking for (`); // Get first open parenthesis let openParenIdx = conf.indexOf('('); - const closeParenIdx = getMatchingParenIdx(conf, openParenIdx); + const closeParenIdx = getMatchingParenId(conf, openParenIdx); // Call the solver on the items between openParenIdx and closeParenIdx (excluding the parens) const parenSolve = mathSolver(conf.slice(openParenIdx + 1, closeParenIdx), true); diff --git a/src/artigen/utils/parenBalance.ts b/src/artigen/utils/parenBalance.ts index 317f3db..2b4fc1a 100644 --- a/src/artigen/utils/parenBalance.ts +++ b/src/artigen/utils/parenBalance.ts @@ -57,6 +57,6 @@ export const assertParenBalance = (conf: MathConf[]) => checkBalance(conf, '(', export const assertPrePostBalance = (conf: MathConf[]) => checkBalance(conf, config.prefix, config.postfix, 'PrefixPostfix', false, 0); // getMatchingXIdx gets the matching X, also partially verifies the conf has balanced X -export const getMatchingInternalIdx = (conf: MathConf[], openIdx: number): number => checkBalance(conf, openInternal, closeInternal, 'Internal', true, openIdx); -export const getMatchingParenIdx = (conf: MathConf[], openIdx: number): number => checkBalance(conf, '(', ')', 'Paren', true, openIdx); -export const getMatchingPostfixIdx = (conf: MathConf[], openIdx: number): number => checkBalance(conf, config.prefix, config.postfix, 'PrefixPostfix', true, openIdx); +export const getMatchingInternalId = (conf: MathConf[], openIdx: number): number => checkBalance(conf, openInternal, closeInternal, 'Internal', true, openIdx); +export const getMatchingParenId = (conf: MathConf[], openIdx: number): number => checkBalance(conf, '(', ')', 'Paren', true, openIdx); +export const getMatchingPostfixId = (conf: MathConf[], openIdx: number): number => checkBalance(conf, config.prefix, config.postfix, 'PrefixPostfix', true, openIdx);