diff --git a/src/Evaluator.ts b/src/Evaluator.ts index efb3d69..59482a2 100644 --- a/src/Evaluator.ts +++ b/src/Evaluator.ts @@ -1,8 +1,13 @@ import type { Editor } from './main'; import type { File } from './AppSettings'; -function codeInterceptor(code: string) { - return code.replace(/->/g, "&&") +function codeInterceptor(code: string): string { + return code + .replace(/->/g, "&&") + .replace(/t\[(\d+),(\d+)\]/g, 'mod($1,$2)') + .replace(/b\[(\d+),(\d+)\]/g, '[$1,$2].includes(beat)') + .replace(/eb\[(\d+),(\d+)\]/g, '[$1,$2].includes(ebeat)') + .replace(/m\[(\d+),(\d+)\]/g, '[$1,$2].includes(bar)'); } const delay = (ms: number) => new Promise((_, reject) => setTimeout(() => reject(new Error('Operation took too long')), ms));