Skip to main content

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

regexlint-1.4.tar.gz (18.7 kB view details)

Uploaded Source

File details

Details for the file regexlint-1.4.tar.gz.

File metadata

  • Download URL: regexlint-1.4.tar.gz
  • Upload date:
  • Size: 18.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for regexlint-1.4.tar.gz
Algorithm Hash digest
SHA256 489bde7bb91d18453df1d24150d8f145bc4e8538f4e68fdd420748366047ba81
MD5 bfbb7759b15eac9d795a2fc150731666
BLAKE2b-256 aeed890b53dada4c182fa3c386e6906ac8dd93171281e6680b0cf31f97fc8709

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page