--- /dev/null
+# Source: https://hg.python.org/cpython/file/2.7/Lib/sre_parse.py\r
+\r
+from typing import Any, Dict, Iterable, List, Match, Optional, Pattern as _Pattern, Set, Tuple, Union\r
+\r
+SPECIAL_CHARS = ... # type: str\r
+REPEAT_CHARS = ... # type: str\r
+DIGITS = ... # type: Set\r
+OCTDIGITS = ... # type: Set\r
+HEXDIGITS = ... # type: Set\r
+WHITESPACE = ... # type: Set\r
+ESCAPES = ... # type: Dict[str, Tuple[str, int]]\r
+CATEGORIES = ... # type: Dict[str, Union[Tuple[str, str], Tuple[str, List[Tuple[str, str]]]]]\r
+FLAGS = ... # type: Dict[str, int]\r
+\r
+class Pattern:\r
+ flags = ... # type: int\r
+ open = ... # type: List[int]\r
+ groups = ... # type: int\r
+ groupdict = ... # type: Dict[str, int]\r
+ lookbehind = ... # type: int\r
+ def __init__(self) -> None: ...\r
+ def opengroup(self, name: str = ...) -> int: ...\r
+ def closegroup(self, gid: int) -> None: ...\r
+ def checkgroup(self, gid: int) -> bool: ...\r
+\r
+\r
+_OpSubpatternType = Tuple[Optional[int], int, int, SubPattern]\r
+_OpGroupRefExistsType = Tuple[int, SubPattern, SubPattern]\r
+_OpInType = List[Tuple[str, int]]\r
+_OpBranchType = Tuple[None, List[SubPattern]]\r
+_AvType = Union[_OpInType, _OpBranchType, Iterable[SubPattern], _OpGroupRefExistsType, _OpSubpatternType]\r
+_CodeType = Union[str, _AvType]\r
+\r
+class SubPattern:\r
+ pattern = ... # type: str\r
+ data = ... # type: List[_CodeType]\r
+ width = ... # type: Optional[int]\r
+ def __init__(self, pattern, data: List[_CodeType] = ...) -> None: ...\r
+ def dump(self, level: int = ...) -> None: ...\r
+ def __len__(self) -> int: ...\r
+ def __delitem__(self, index: Union[int, slice]) -> None: ...\r
+ def __getitem__(self, index: Union[int, slice]) -> Union[SubPattern, _CodeType]: ...\r
+ def __setitem__(self, index: Union[int, slice], code: _CodeType): ...\r
+ def insert(self, index, code: _CodeType) -> None: ...\r
+ def append(self, code: _CodeType) -> None: ...\r
+ def getwidth(self) -> int: ...\r
+\r
+class Tokenizer:\r
+ string = ... # type: str\r
+ index = ... # type: int\r
+ def __init__(self, string: str) -> None: ...\r
+ def match(self, char: str, skip: int = ...) -> int: ...\r
+ def get(self) -> Optional[str]: ...\r
+ def tell(self) -> Tuple[int, Optional[str]]: ...\r
+ def seek(self, index: int) -> None: ...\r
+\r
+def isident(char: str) -> bool: ...\r
+def isdigit(char: str) -> bool: ...\r
+def isname(name: str) -> bool: ...\r
+def parse(str: str, flags: int = ..., pattern: Pattern = ...) -> SubPattern: ...\r
+_Template = Tuple[List[Tuple[int, int]], List[Optional[int]]]\r
+def parse_template(source: str, pattern: _Pattern) -> _Template: ...\r
+def expand_template(template: _Template, match: Match) -> str: ...\r