tarsec 0.4.1 → 0.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -509,9 +509,9 @@ export declare function buildExpressionParser<T>(atom: Parser<T>, operatorTable:
509
509
  * `memo` assumes its wrapped parser is a pure function of its input. Don't
510
510
  * memoize parsers that consult mutable external state.
511
511
  *
512
- * @param parser - parser to memoize
513
512
  * @param name - optional debug name (shown in `parserDebug` counts/times as `memo(name)`)
513
+ * @param parser - parser to memoize
514
514
  * @returns - memoized parser
515
515
  */
516
- export declare function memo<T>(parser: Parser<T>, name?: string): Parser<T>;
517
- export declare function memo<T, C extends PlainObject>(parser: CaptureParser<T, C>, name?: string): CaptureParser<T, C>;
516
+ export declare function memo<T>(name: string, parser: Parser<T>): Parser<T>;
517
+ export declare function memo<T, C extends PlainObject>(name: string, parser: CaptureParser<T, C>): CaptureParser<T, C>;
@@ -933,7 +933,7 @@ function tryOps(ops, input) {
933
933
  return null;
934
934
  }
935
935
  const DEFAULT_MEMO_LIMIT = 10000;
936
- export function memo(parser, name) {
936
+ export function memo(name, parser) {
937
937
  const cache = new Map();
938
938
  return trace(name ? `memo(${name})` : "memo", (input) => {
939
939
  const hit = cache.get(input);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tarsec",
3
- "version": "0.4.1",
3
+ "version": "0.4.2",
4
4
  "description": "A parser combinator library for TypeScript, inspired by Parsec.",
5
5
  "homepage": "https://github.com/egonSchiele/tarsec",
6
6
  "scripts": {