from typing import Callable, NamedTuple, Optional, TypedDict, Any

class Glob(TypedDict):
    err: int
    tab: dict[tuple[Combinator, int], Peco]
    _s: list[Peco]

class Peco(NamedTuple):
    text: str
    pos: int
    ok: bool
    stack: Optional[tuple[Any, Any]]
    glob: Glob

Combinator = Callable[[Peco], Peco]
AltCombinator = Callable[[Peco], Optional[Peco]]

def eat(expr: str) -> Combinator: ...

def seq(*funcs: Combinator) -> Combinator: ...

def alt(*funcs: Combinator) -> AltCombinator: ...

def many(f: Combinator) -> Combinator: ...

def push(f: Combinator) -> Combinator: ...

def get_args(st: tuple[Any, Any], n: int) -> tuple[tuple[None, ...], tuple[Any, Any]]: ...

def to(f: Callable[..., Any]) -> Combinator: ...

def get_depth(old_st: tuple[Any, Any], st: tuple[Any, Any]) -> int: ...

def group(f: Combinator) -> Combinator: ...

def peek(f: Combinator) -> Combinator: ...

def npeek(f: Combinator) -> Combinator: ...

def memo(f: Combinator) -> Combinator: ...

def left(f: Combinator) -> Combinator: ...

def eof(s: Peco) -> Peco: ...

def peco(text: str) -> Peco: ...

def parse(text: str, f: Combinator) -> Peco: ...

def empty(s: Peco) -> Peco: ...

def opt(f: Combinator) -> Combinator: ...

def some(f: Combinator) -> Combinator: ...

def list_of(f: Combinator, d: Combinator) -> Combinator: ...
