Skip to content

Commit 745286f

Browse files
committed
rename
1 parent aa40cff commit 745286f

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/parser/parser_lib.ts

+7-7
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,27 @@ import { ArrayResult, ArrayResultError } from "../array_result.ts";
55

66
type ParserResult<T> = ArrayResult<Readonly<{ value: T; length: number }>>;
77
type InnerParser<T> = (input: number) => ParserResult<T>;
8-
type Memo<T> = Map<number, MemoizationCacheResult<ParserResult<T>>>;
8+
type Cache<T> = Map<number, MemoizationCacheResult<ParserResult<T>>>;
99

1010
let currentSource = "";
11-
const allMemo: Set<WeakRef<Memo<unknown>>> = new Set();
11+
const allCache: Set<WeakRef<Cache<unknown>>> = new Set();
1212

1313
export class Parser<T> {
1414
readonly rawParser: InnerParser<T>;
1515
constructor(parser: InnerParser<T>) {
16-
const cache: Memo<T> = new Map();
17-
allMemo.add(new WeakRef(cache));
18-
this.rawParser = memoize<InnerParser<T>, number, Memo<T>>(
16+
const cache: Cache<T> = new Map();
17+
allCache.add(new WeakRef(cache));
18+
this.rawParser = memoize<InnerParser<T>, number, Cache<T>>(
1919
parser,
2020
{ cache },
2121
);
2222
}
2323
parse(source: string): ArrayResult<T> {
2424
currentSource = source;
25-
for (const memo of allMemo) {
25+
for (const memo of allCache) {
2626
const ref = memo.deref();
2727
if (ref == null) {
28-
allMemo.delete(memo);
28+
allCache.delete(memo);
2929
} else {
3030
ref.clear();
3131
}

0 commit comments

Comments
 (0)