
    Pi                     ~    d Z ddlmZmZ defdZdedee         fdZeeed         f         Zd	ee         defd
ZdS )zParse a Scheme expression as a nested list

The main function of this module is lispy.parse, other ones should be
considered private. This module is a dependency of the festival
backend.

From http://www.norvig.com/lispy.html

    )ListUnionprogramc                 :    t          t          |                     S )zRead a Scheme expression from a string

    Return a nested list

    Raises an IndexError if the expression is not valid scheme
    (unbalanced parenthesis).

    >>> parse('(+ 2 (* 5 2))')
    ['+', '2', ['*', '5', '2']]

    )_read_from_tokens	_tokenize)r   s    u/home/jaya/work/projects/VOICE-AGENT/VIET/agent-env/lib/python3.11/site-packages/phonemizer/backend/festival/lispy.pyparser
      s     Yw//000    charsreturnc                 z    |                      dd                               dd                                          S )z5Convert a string of characters into a list of tokens.(z ( )z ) )replacesplit)r   s    r	   r   r   *   s2    ==e$$,,S%88>>@@@r   Exprtokensc                 P   t          |           dk    rt          d          |                     d          }|dk    rSg }| d         dk    r.|                    t	          |                      | d         dk    .|                     d           |S |dk    rt          d          |S )z,Read an expression from a sequence of tokensr   zunexpected EOF while readingr   r   zunexpected ))lenSyntaxErrorpopappendr   )r   tokenexprs      r	   r   r   2   s    
6{{a8999JJqMME||Qi3KK)&11222 Qi3

1||.)))Lr   N)	__doc__typingr   r   strr
   r   r   r    r   r	   <module>r       s            13 1 1 1 1AS AT#Y A A A A
 S$v,d3i D      r   