tarsec 0.4.5 → 0.4.6

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.
@@ -7,6 +7,8 @@ import { CaptureParser, GeneralParser, InferManyReturnType, MergedCaptures, Merg
7
7
  * { captures: <array of captures> }
8
8
  * ```
9
9
  *
10
+ * If you're parsing characters only, prefer `takeWhile` for performance reasons.
11
+ *
10
12
  * @param parser - parser to run
11
13
  * @returns - parser that runs the given parser zero to many times,
12
14
  * and returns the result as an array
@@ -14,6 +16,7 @@ import { CaptureParser, GeneralParser, InferManyReturnType, MergedCaptures, Merg
14
16
  export declare function many<const T extends GeneralParser<any, any>>(parser: T): InferManyReturnType<T>;
15
17
  /**
16
18
  * Same as `many`, but fails if the parser doesn't match at least once.
19
+ * If you're parsing characters only, prefer `takeWhile1` for performance reasons.
17
20
  *
18
21
  * @param parser - parser to run
19
22
  * @returns a parser that runs the given parser one to many times,
@@ -11,6 +11,8 @@ import { escape } from "./utils.js";
11
11
  * { captures: <array of captures> }
12
12
  * ```
13
13
  *
14
+ * If you're parsing characters only, prefer `takeWhile` for performance reasons.
15
+ *
14
16
  * @param parser - parser to run
15
17
  * @returns - parser that runs the given parser zero to many times,
16
18
  * and returns the result as an array
@@ -50,6 +52,7 @@ export function many(parser) {
50
52
  }
51
53
  /**
52
54
  * Same as `many`, but fails if the parser doesn't match at least once.
55
+ * If you're parsing characters only, prefer `takeWhile1` for performance reasons.
53
56
  *
54
57
  * @param parser - parser to run
55
58
  * @returns a parser that runs the given parser one to many times,
package/dist/parsers.d.ts CHANGED
@@ -48,6 +48,8 @@ export declare function noneOf(chars: string): Parser<string>;
48
48
  */
49
49
  export type CharPredicate = (code: number) => boolean;
50
50
  /**
51
+ * A faster version of many/ manyWithJoin for character-class scanning.
52
+ *
51
53
  * Consume the longest prefix of `input` whose characters all satisfy
52
54
  * the predicate (or are contained in the given char-class string). Always
53
55
  * succeeds; returns "" when nothing matches.
package/dist/parsers.js CHANGED
@@ -126,6 +126,8 @@ function compileCharPredicate(charsOrPred) {
126
126
  return (code) => code < 128 ? ascii[code] === 1 : set.has(code);
127
127
  }
128
128
  /**
129
+ * A faster version of many/ manyWithJoin for character-class scanning.
130
+ *
129
131
  * Consume the longest prefix of `input` whose characters all satisfy
130
132
  * the predicate (or are contained in the given char-class string). Always
131
133
  * succeeds; returns "" when nothing matches.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tarsec",
3
- "version": "0.4.5",
3
+ "version": "0.4.6",
4
4
  "description": "A parser combinator library for TypeScript, inspired by Parsec.",
5
5
  "homepage": "https://github.com/egonSchiele/tarsec",
6
6
  "scripts": {