ķ
öĀ\c           @   sņ   d  Z  d d l Z d d l Z d d l m Z d d l m Z d d l m Z e	 rŠ d d l
 m Z m Z m Z m Z d d l m Z d d l m Z d d	 l m Z n  d
 e j j f d     YZ d e j j j f d     YZ d   Z d S(   sÃ   
    sphinx.parsers
    ~~~~~~~~~~~~~~

    A Base class for additional parsers.

    :copyright: Copyright 2007-2019 by the Sphinx team, see AUTHORS.
    :license: BSD, see LICENSE for details.
i˙˙˙˙N(   t   states(   t
   StringList(   t   SmartQuotes(   t   Anyt   Dictt   Listt   Type(   t   nodes(   t	   Transform(   t   Sphinxt   Parserc           B   s   e  Z d  Z d   Z RS(   sV  
    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 following objects and functions:

    self.app
        The application object (:class:`sphinx.application.Sphinx`)
    self.config
        The config object (:class:`sphinx.config.Config`)
    self.env
        The environment object (:class:`sphinx.environment.BuildEnvironment`)
    self.warn()
        Emit a warning. (Same as :meth:`sphinx.application.Sphinx.warn()`)
    self.info()
        Emit a informational message. (Same as :meth:`sphinx.application.Sphinx.info()`)

    .. deprecated:: 1.6
       ``warn()`` and ``info()`` is deprecated.  Use :mod:`sphinx.util.logging` instead.
    c         C   s=   | |  _  | j |  _ | j |  _ | j |  _ | j |  _ d S(   s¤   set_application will be called from Sphinx to set app and other instance variables

        :param sphinx.application.Sphinx app: Sphinx application object
        N(   t   appt   configt   envt   warnt   info(   t   selfR   (    (    s-   lib/python2.7/site-packages/sphinx/parsers.pyt   set_application1   s
    	(   t   __name__t
   __module__t   __doc__R   (    (    (    s-   lib/python2.7/site-packages/sphinx/parsers.pyR
      s   t	   RSTParserc           B   s    e  Z d  Z d   Z d   Z RS(   s   A reST parser for Sphinx.c         C   s)   t  j j j j |   } | j t  | S(   sy   Sphinx's reST parser replaces a transform class for smart-quotes by own's

        refs: sphinx.io.SphinxStandaloneReader(   t   docutilst   parserst   rstR
   t   get_transformst   removeR   (   R   t
   transforms(    (    s-   lib/python2.7/site-packages/sphinx/parsers.pyR   A   s    c         C   s   t  | t  ru |  j | |  t j d |  j d |  j d | j j  |  _	 |  j	 j
 | | d |  j |  j   n t j j j j |  | |  d S(   sÂ   Parse text and generate a document tree.

        This accepts StringList as an inputstring parameter.
        It enables to handle mixed contents (cf. :confval:`rst_prolog`) correctly.
        t   state_classest   initial_statet   debugt   inlinerN(   t
   isinstanceR   t   setup_parseR    t   RSTStateMachineR   R   t   reportert
   debug_flagt   statemachinet   runR   t   finish_parseR   R   R   R
   t   parse(   R   t   inputstringt   document(    (    s-   lib/python2.7/site-packages/sphinx/parsers.pyR(   J   s    			(   R   R   R   R   R(   (    (    (    s-   lib/python2.7/site-packages/sphinx/parsers.pyR   >   s   		c         C   s&   |  j  t  i d d 6t d 6t d 6S(   Nt   builtint   versiont   parallel_read_safet   parallel_write_safe(   t   add_source_parserR   t   True(   R   (    (    s-   lib/python2.7/site-packages/sphinx/parsers.pyt   setup_   s
    (   R   t   docutils.parsersR   t   docutils.parsers.rstR    t   docutils.statemachineR   t   docutils.transforms.universalR   t   Falset   typingR   R   R   R   R   t   docutils.transformsR   t   sphinx.applicationR	   R   R
   R   R   R1   (    (    (    s-   lib/python2.7/site-packages/sphinx/parsers.pyt   <module>
   s   "$!