
    11i                     j    S r SSKJrJr  S\4S jrS\S\\   4S jr\\\S   4   rS	\\   S\4S
 jrg)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                 *    [        [        U 5      5      $ )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    [/home/james-whalen/.local/lib/python3.13/site-packages/phonemizer/backend/festival/lispy.pyparser
      s     Yw/00    charsreturnc                 b    U R                  SS5      R                  SS5      R                  5       $ )z5Convert a string of characters into a list of tokens.(z ( )z ) )replacesplit)r   s    r	   r   r   *   s)    ==e$,,S%8>>@@r   Exprtokensc                    [        U 5      S:X  a  [        S5      eU R                  S5      nUS:X  aC  / nU S   S:w  a%  UR                  [	        U 5      5        U S   S:w  a  M%  U R                  S5        U$ US:X  a  [        S5      eU$ )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JJqME|Qi3KK)&12 Qi3

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