fix naming on this, idk why there were x's on them
This commit is contained in:
parent
5ee02241a8
commit
2b9de4be81
|
@ -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();
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue