Regexlint is intended to be run as a linter against an importable Pygments lexer, and flag problems that will prevent the lexer from performing well (since we don’t have branch coverage for lexers :)
As a simple example, alternations are first match, so it will flag this as never matching “elseif”:
(else|elseif)
It also understands some Pygments internals, for example bygroups(...)` needs to have the same number of args as the regex has capture groups. Too many will result in duplicate text; too few will result in missing text. There should also not be any gaps between the capture groups, so this example flags two problems:
(r'(foo)\s+(bar)', bygroups(Blah)),
Usage
make demo
or
regexlint pygments.lexers.web:HtmlLexer
or
python3 regexlint/cmdline.py pygments.lexers.web
Todo
Figure out which phase should remove unnecessary backslashes
Write the alternation expander, so that ([ax]|a[bc]) fails the alternation order checks
Make more general than just for Pygments
License
This project is licensed under the Apache Public License, see COPYING
Release files for regexlint 2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| regexlint-2.0.tar.gz | 33.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| regexlint-2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 63.6 kB
Release files / regexlint-2.0.tar.gz
| Download URL | regexlint-2.0.tar.gz |
|---|---|
| Size | 33.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c17b6c8d7feb552a8c61fab071048d65a3da46b54f9787c2aa9f373d22fd629a
|
|
BLAKE2b-256 checksum How to use checksums |
e500a2a82f046c4349248befe84990eb99edc74a5677e063c2f1d066772193c2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.8.5
|
Release files / regexlint-2.0-py3-none-any.whl
| Download URL | regexlint-2.0-py3-none-any.whl |
|---|---|
| Size | 30.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c81144c09b8ec8319bd992c8407a0bb78b8b5374fa5ad57f240f8d810d82c5c6
|
|
BLAKE2b-256 checksum How to use checksums |
b0b928d22928be0ab771bb61094d71067d5aa069c82a8e0f8d6ea90011150fbd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.8.5
|