"""
This type stub file was generated by pyright.
"""

import docutils.parsers
import docutils.parsers.rst
from typing import Any, TYPE_CHECKING
from docutils import nodes
from docutils.statemachine import StringList
from docutils.transforms import Transform
from sphinx.application import Sphinx
from sphinx.config import Config
from sphinx.environment import BuildEnvironment

"""A Base class for additional parsers."""
if TYPE_CHECKING:
    ...
class Parser(docutils.parsers.Parser):
    """
    A base class of source parsers.  The additional parsers should inherit this class instead
    of ``docutils.parsers.Parser``.  Compared with ``docutils.parsers.Parser``, this class
    improves accessibility to Sphinx APIs.

    The subclasses can access sphinx core runtime objects (app, config and env).
    """
    config: Config
    env: BuildEnvironment
    def set_application(self, app: Sphinx) -> None:
        """set_application will be called from Sphinx to set app and other instance variables

        :param sphinx.application.Sphinx app: Sphinx application object
        """
        ...
    


class RSTParser(docutils.parsers.rst.Parser, Parser):
    """A reST parser for Sphinx."""
    def get_transforms(self) -> list[type[Transform]]:
        """
        Sphinx's reST parser replaces a transform class for smart-quotes by its own

        refs: sphinx.io.SphinxStandaloneReader
        """
        ...
    
    def parse(self, inputstring: str | StringList, document: nodes.document) -> None:
        """Parse text and generate a document tree."""
        ...
    
    def decorate(self, content: StringList) -> None:
        """Preprocess reST content before parsing."""
        ...
    


def setup(app: Sphinx) -> dict[str, Any]:
    ...

