trilean-regex 1.0.0 → 1.0.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.
package/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # trilean-regex
2
2
 
3
+ [![GitHub](https://img.shields.io/badge/GitHub-181717?logo=github&logoColor=white)](https://github.com/ExaDev/trilean) [![npm](https://img.shields.io/badge/npm-CB3837?logo=npm&logoColor=white)](https://www.npmjs.com/package/trilean-regex) [![Release](https://img.shields.io/github/v/release/ExaDev/trilean?filter=trilean-regex@*&label=release)](https://github.com/ExaDev/trilean/releases?q=trilean-regex%40) [![CI](https://img.shields.io/github/actions/workflow/status/ExaDev/trilean/ci.yml?branch=main)](https://github.com/ExaDev/trilean/actions)
4
+
3
5
  A portable regular-expression grammar -- a true regular language, with its own parser and a Thompson-construction reference matcher -- so a pattern means the same thing wherever it runs: in process here, and pushed down to a database's own engine by [`trilean-sql`](../trilean-sql).
4
6
 
5
7
  ## Why a new grammar
package/dist/matcher.cjs CHANGED
@@ -68,8 +68,7 @@ function matchesNfa(nfa, input) {
68
68
  * Parses `pattern` (this package's grammar; see README.md) and compiles it to a reference matcher.
69
69
  *
70
70
  * Prefer this over `testPattern` when the same pattern will be tested against more than one input: it parses and compiles exactly once, and the returned `CompiledPattern.test` is then only the O(length x states) simulation.
71
- *
72
- * @throws {RegexParseError} if `pattern` is not a valid pattern in this grammar.
71
+ * @throws `RegexParseError` if `pattern` is not a valid pattern in this grammar.
73
72
  */
74
73
  function compilePattern(pattern) {
75
74
  const nfa = require_nfa.compileToNfa(require_parser.parseRegex(pattern));
@@ -77,8 +76,7 @@ function compilePattern(pattern) {
77
76
  }
78
77
  /**
79
78
  * Parses `pattern` and tests it against `input` in one call. Equivalent to `compilePattern(pattern).test(input)`, and exactly as cheap for a single test -- prefer `compilePattern` instead when the same pattern will be reused, so the parse and compile steps happen once rather than once per input.
80
- *
81
- * @throws {RegexParseError} if `pattern` is not a valid pattern in this grammar.
79
+ * @throws `RegexParseError` if `pattern` is not a valid pattern in this grammar.
82
80
  */
83
81
  function testPattern(pattern, input) {
84
82
  return compilePattern(pattern).test(input);
@@ -17,14 +17,12 @@ interface CompiledPattern {
17
17
  * Parses `pattern` (this package's grammar; see README.md) and compiles it to a reference matcher.
18
18
  *
19
19
  * Prefer this over `testPattern` when the same pattern will be tested against more than one input: it parses and compiles exactly once, and the returned `CompiledPattern.test` is then only the O(length x states) simulation.
20
- *
21
- * @throws {RegexParseError} if `pattern` is not a valid pattern in this grammar.
20
+ * @throws `RegexParseError` if `pattern` is not a valid pattern in this grammar.
22
21
  */
23
22
  declare function compilePattern(pattern: string): CompiledPattern;
24
23
  /**
25
24
  * Parses `pattern` and tests it against `input` in one call. Equivalent to `compilePattern(pattern).test(input)`, and exactly as cheap for a single test -- prefer `compilePattern` instead when the same pattern will be reused, so the parse and compile steps happen once rather than once per input.
26
- *
27
- * @throws {RegexParseError} if `pattern` is not a valid pattern in this grammar.
25
+ * @throws `RegexParseError` if `pattern` is not a valid pattern in this grammar.
28
26
  */
29
27
  declare function testPattern(pattern: string, input: string): boolean;
30
28
  //#endregion
package/dist/matcher.d.ts CHANGED
@@ -17,14 +17,12 @@ interface CompiledPattern {
17
17
  * Parses `pattern` (this package's grammar; see README.md) and compiles it to a reference matcher.
18
18
  *
19
19
  * Prefer this over `testPattern` when the same pattern will be tested against more than one input: it parses and compiles exactly once, and the returned `CompiledPattern.test` is then only the O(length x states) simulation.
20
- *
21
- * @throws {RegexParseError} if `pattern` is not a valid pattern in this grammar.
20
+ * @throws `RegexParseError` if `pattern` is not a valid pattern in this grammar.
22
21
  */
23
22
  declare function compilePattern(pattern: string): CompiledPattern;
24
23
  /**
25
24
  * Parses `pattern` and tests it against `input` in one call. Equivalent to `compilePattern(pattern).test(input)`, and exactly as cheap for a single test -- prefer `compilePattern` instead when the same pattern will be reused, so the parse and compile steps happen once rather than once per input.
26
- *
27
- * @throws {RegexParseError} if `pattern` is not a valid pattern in this grammar.
25
+ * @throws `RegexParseError` if `pattern` is not a valid pattern in this grammar.
28
26
  */
29
27
  declare function testPattern(pattern: string, input: string): boolean;
30
28
  //#endregion
package/dist/matcher.js CHANGED
@@ -67,8 +67,7 @@ function matchesNfa(nfa, input) {
67
67
  * Parses `pattern` (this package's grammar; see README.md) and compiles it to a reference matcher.
68
68
  *
69
69
  * Prefer this over `testPattern` when the same pattern will be tested against more than one input: it parses and compiles exactly once, and the returned `CompiledPattern.test` is then only the O(length x states) simulation.
70
- *
71
- * @throws {RegexParseError} if `pattern` is not a valid pattern in this grammar.
70
+ * @throws `RegexParseError` if `pattern` is not a valid pattern in this grammar.
72
71
  */
73
72
  function compilePattern(pattern) {
74
73
  const nfa = compileToNfa(parseRegex(pattern));
@@ -76,8 +75,7 @@ function compilePattern(pattern) {
76
75
  }
77
76
  /**
78
77
  * Parses `pattern` and tests it against `input` in one call. Equivalent to `compilePattern(pattern).test(input)`, and exactly as cheap for a single test -- prefer `compilePattern` instead when the same pattern will be reused, so the parse and compile steps happen once rather than once per input.
79
- *
80
- * @throws {RegexParseError} if `pattern` is not a valid pattern in this grammar.
78
+ * @throws `RegexParseError` if `pattern` is not a valid pattern in this grammar.
81
79
  */
82
80
  function testPattern(pattern, input) {
83
81
  return compilePattern(pattern).test(input);
package/dist/parser.cjs CHANGED
@@ -316,8 +316,7 @@ var Parser = class {
316
316
  * Parses a pattern in this package's grammar (see README.md) into a `RegexNode` AST.
317
317
  *
318
318
  * Never returns a partial result: a pattern either parses completely, with nothing left over, or this throws `RegexParseError` naming exactly where parsing could not proceed.
319
- *
320
- * @throws {RegexParseError} if `pattern` is not a complete, valid pattern in this grammar.
319
+ * @throws `RegexParseError` if `pattern` is not a complete, valid pattern in this grammar.
321
320
  */
322
321
  function parseRegex(pattern) {
323
322
  const parser = new Parser(pattern);
package/dist/parser.d.cts CHANGED
@@ -4,8 +4,7 @@ import { d as RegexNode } from "./ast-D8HLFxxv.cjs";
4
4
  * Parses a pattern in this package's grammar (see README.md) into a `RegexNode` AST.
5
5
  *
6
6
  * Never returns a partial result: a pattern either parses completely, with nothing left over, or this throws `RegexParseError` naming exactly where parsing could not proceed.
7
- *
8
- * @throws {RegexParseError} if `pattern` is not a complete, valid pattern in this grammar.
7
+ * @throws `RegexParseError` if `pattern` is not a complete, valid pattern in this grammar.
9
8
  */
10
9
  declare function parseRegex(pattern: string): RegexNode;
11
10
  //#endregion
package/dist/parser.d.ts CHANGED
@@ -4,8 +4,7 @@ import { d as RegexNode } from "./ast-D8HLFxxv.js";
4
4
  * Parses a pattern in this package's grammar (see README.md) into a `RegexNode` AST.
5
5
  *
6
6
  * Never returns a partial result: a pattern either parses completely, with nothing left over, or this throws `RegexParseError` naming exactly where parsing could not proceed.
7
- *
8
- * @throws {RegexParseError} if `pattern` is not a complete, valid pattern in this grammar.
7
+ * @throws `RegexParseError` if `pattern` is not a complete, valid pattern in this grammar.
9
8
  */
10
9
  declare function parseRegex(pattern: string): RegexNode;
11
10
  //#endregion
package/dist/parser.js CHANGED
@@ -315,8 +315,7 @@ var Parser = class {
315
315
  * Parses a pattern in this package's grammar (see README.md) into a `RegexNode` AST.
316
316
  *
317
317
  * Never returns a partial result: a pattern either parses completely, with nothing left over, or this throws `RegexParseError` naming exactly where parsing could not proceed.
318
- *
319
- * @throws {RegexParseError} if `pattern` is not a complete, valid pattern in this grammar.
318
+ * @throws `RegexParseError` if `pattern` is not a complete, valid pattern in this grammar.
320
319
  */
321
320
  function parseRegex(pattern) {
322
321
  const parser = new Parser(pattern);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "trilean-regex",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "A portable regular-expression grammar -- a true regular language, with a Thompson-construction reference matcher -- so a pattern means the same thing in process and wherever trilean-sql can push it down to a database's own engine.",
5
5
  "type": "module",
6
6
  "repository": {
@@ -74,7 +74,7 @@
74
74
  ],
75
75
  "devDependencies": {
76
76
  "@arethetypeswrong/cli": "^0.18.5",
77
- "@exadev/eslint-config": "^2.10.2",
77
+ "@exadev/eslint-config": "2.12.1",
78
78
  "@types/node": "^26.4.0",
79
79
  "@vitest/coverage-v8": "^4.1.11",
80
80
  "eslint": "^10.9.1",