Debian Codegraph @

interegular.egg-info/PKG-INFO

raw
1 Metadata-Version: 2.1
2 Name: interegular
3 Version: 0.3.3
4 Summary: a regex intersection checker
5 Home-page: https://github.com/MegaIng/regex_intersections
6 Download-URL: https://github.com/MegaIng/interegular/tarball/master
7 Author: MegaIng
8 Author-email: MegaIng <[email protected]>
9 License: MIT
10 Classifier: Operating System :: OS Independent
11 Classifier: License :: OSI Approved :: MIT License
12 Classifier: Programming Language :: Python :: 3 :: Only
13 Classifier: Programming Language :: Python :: 3.8
14 Classifier: Programming Language :: Python :: 3.9
15 Classifier: Programming Language :: Python :: 3.10
16 Classifier: Programming Language :: Python :: 3.11
17 Classifier: Programming Language :: Python :: 3.12
18 Requires-Python: >=3.7
19 Description-Content-Type: text/markdown
20 License-File: LICENSE.txt
21
22 # Interegular
23 ***regex intersection checker***
24
25 A library to check a subset of python regexes for intersections.
26 Based on [grennery](https://github.com/qntm/greenery) by [@qntm](https://github.com/qntm). Adapted for [lark-parser](https://github.com/lark-parser/lark).
27
28 The primary difference with `grennery` library is that `interegular` is focused on speed and compatibility with python re syntax, whereas grennery has a way to reconstruct a regex from a FSM, which `interegular` lacks.
29
30
31 ## Interface
32
33 | Function | Usage |
34 | -------- | ----- |
35 | `compare_regexes(*regexes: str)` | Takes a series of regexes as strings and returns a Generator of all intersections as `(str, str)`|
36 | `parse_pattern(regex: str)` | Parses a regex as string to a `Pattern` object|
37 | `interegular.compare_patterns(*patterns: Pattern)` | Takes a series of regexes as patterns and returns a Generator of all intersections as `(Pattern, Pattern)`|
38 | `Pattern` | A class representing a parsed regex (intermediate representation)|
39 | `REFlags` | A enum representing the flags a regex can have |
40 | `FSM` | A class representing a fully parsed regex. (Has many useful members) |
41 | `Pattern.with_flags(added: REFlags, removed: REFlags)` | A function to change the flags that are applied to a regex|
42 | `Pattern.to_fsm() -> FSM` | A function to create a `FSM` object from the Pattern |
43 | `Comparator` | A Class to compare a group of Patterns |
44
45 ## What is supported?
46
47 Most normal python-regex syntax is support. But because of the backend that is used (final-state-machines), some things can not be implemented. This includes:
48
49 - Backwards references (`\1`, `(?P=open)`)
50 - Conditional Matching (`(?(1)a|b)`)
51 - Some cases of lookaheads/lookbacks (You gotta try out which work and which don't)
52 - A word of warning: This is currently not correctly handled, and some things might parse, but not work correctly. I am currently working on this.
53
54
55 Some things are simply not implemented and will implemented in the future:
56 - Some flags (Progress: `ims` from `aiLmsux`)
57 - Some cases of lookaheads/lookbacks (You gotta try out which work and which don't)
58
59
60 ## TODO
61
62 - Docs
63 - More tests
64 - Checks that the syntax is correctly handled.