 int
    value: Text
    fixers_applied: List[Any]
    def __init__(
        self,
        type: int,
        value: Text,
        context: Optional[_Context] = ...,
        prefix: Optional[Text] = ...,
        fixers_applied: List[Any] = ...,
    ) -> None: ...

def convert(gr: Grammar, raw_node: _RawNode) -> _NL: ...

class BasePattern:
    type: int
    content: Optional[Text]
    name: Optional[Text]
    def optimize(self) -> BasePattern: ...  # sic, subclasses are free to optimize themselves into different patterns
    def match(self, node: _NL, results: Optional[_Results] = ...) -> bool: ...
    def match_seq(self, nodes: List[_NL], results: Optional[_Results] = ...) -> bool: ...
    def generate_matches(self, nodes: List[_NL]) -> Iterator[Tuple[int, _Results]]: ...

class LeafPattern(BasePattern):
    def __init__(self, type: Optional[int] = ..., content: Optional[Text] = ..., name: Optional[Text] = ...) -> None: ...

class NodePattern(BasePattern):
    wildcards: bool
    def __init__(self, type: Optional[int] = ..., content: Optional[Text] = ..., name: Optional[Text] = ...) -> None: ...

class WildcardPattern(BasePattern):
    min: int
    max: int
    def __init__(self, content: Optional[Text] = ..., min: int = ..., max: int = ..., name: Optional[Text] = ...) -> None: ...

class NegatedPattern(BasePattern):
    def __init__(self, content: Optional[Text] = ...) -> None: ...

def generate_matches(patterns: List[BasePattern], nodes: List[_NL]) -> Iterator[Tuple[int, _Results]]: ...
PK