Linter for (Pygments) regular expressions
Project description
Regexlint will examine all regular expressions in an importable Pygments lexer, and report things that are probably not doing what you think they’re doing. For example, patterns like this (which will only match the first):
(else|elseif)
It can also warn about a few syntax problems, for example this has two problems – the \s+ outside the groups, and not enough actions in bygroups (this one needs two in the args to bygroups):
(r'(foo)\s+(bar)', bygroups(Blah)),
Usage
make demo or regexlint pygments.lexers.web:HtmlLexer or python2 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
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for regexlint-1.6-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cf3013b659d407513d43abc7a23304665b825d779b74b25b8cceda2252fd4ed5 |
|
MD5 | 684cf3d18115da189195b98cb76bc91f |
|
BLAKE2b-256 | 777d6e905b246994453ab3f57e71ed1a8b5ef79cc00e80ca0604e465183cb552 |