Skip to content

pygments/regexlint

This branch is 11 commits behind thatch/regexlint:master.

Folders and files

NameName
Last commit message
Last commit date
Sep 7, 2020
Sep 7, 2020
Apr 14, 2014
Jun 10, 2014
Apr 14, 2014
Sep 6, 2020
Apr 14, 2014
Sep 6, 2020
Sep 6, 2020
Dec 6, 2018
Sep 6, 2020

Repository files navigation

Regexlint

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

About

Regular expression linter

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 98.8%
  • Makefile 1.2%