def getlower(char_ord, flags): if flags & SRE_FLAG_LOCALE: if char_ord < 256: # cheating! Well, CPython does too. char_ord = tolower(char_ord) return char_ord elif flags & SRE_FLAG_UNICODE: assert unicodedb is not None char_ord = unicodedb.tolower(char_ord) else: if int_between(ord('A'), char_ord, ord('Z') + 1): # ASCII lower char_ord += ord('a') - ord('A') return char_ord
def fn(a, b, c): return int_between(a, b, c)
def is_space(code): return (code == 32) | int_between(9, code, 14)
def is_digit(code): return int_between(48, code, 58)
def set_range(pat, index, char_code): # <RANGE> <lower> <upper> match = int_between(pat[index+1], char_code, pat[index+2] + 1) return match, index + 3
def set_range(pat, index, char_code): # <RANGE> <lower> <upper> match = int_between(pat[index + 1], char_code, pat[index + 2] + 1) return match, index + 3