module documentation

pygments.regexopt ~~~~~~~~~~~~~~~~~ An algorithm that generates optimized regexes for matching long lists of literal strings. :copyright: Copyright 2006-2022 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details.

Function make_charset Undocumented
Function regex_opt Return a compiled regex that matches any string in the given list.
Function regex_opt_inner Return a regex that matches any string in the sorted list of strings.
Constant CS_ESCAPE Undocumented
Constant FIRST_ELEMENT Undocumented
def make_charset(letters): (source)

Undocumented

def regex_opt(strings, prefix='', suffix=''): (source)

Return a compiled regex that matches any string in the given list. The strings to match must be literal strings, not regexes. They will be regex-escaped. *prefix* and *suffix* are pre- and appended to the final regex.

def regex_opt_inner(strings, open_paren): (source)

Return a regex that matches any string in the sorted list of strings.

CS_ESCAPE = (source)

Undocumented

Value
re.compile(r'[\[\^\\-\]]')
FIRST_ELEMENT = (source)

Undocumented

Value
itemgetter(0)