o
    @j                     @   s>   d dl mZmZmZ d dlmZ ddlmZ G dd dZ	dS )    )AnyDictList)ast   )resolverc                   @   s~   e Zd ZdedefddZdedefddZded	edefd
dZdeded	edefddZdede	e d	edefddZ
dS )Compileritemreturnc                    s:   t |tjr |S t |ttfr fdd|D S |S )Nc                    s   g | ]} |qS  r   ).0elemselfr   e/var/www/www-root/data/www/ai-bot.pdev.uz/venv/lib/python3.10/site-packages/fluent/runtime/prepare.py
<listcomp>   s    z%Compiler.__call__.<locals>.<listcomp>)
isinstanceFTLBaseNodecompiletuplelist)r   r	   r   r   r   __call__   s
   
zCompiler.__call__nodec                 C   sd   t |j}tt|s|S t| }| D ]
\}}| |||< qt| d| | j}||fi |S )Ncompile_)	type__name__hasattrr   varscopyitemsgetattrcompile_generic)r   r   nodenamekwargspropname	propvaluehandlerr   r   r   r      s   

zCompiler.compiler#   r$   c                 K   s   t t|di |S )Nr   )r!   r   )r   r#   r$   r   r   r   r"      s   zCompiler.compile_generic_
expressionc                 K   s$   t |tjr|S tjdd|i|S )Nr)   r   )r   r   Literal	Placeable)r   r(   r)   r$   r   r   r   compile_Placeable   s   zCompiler.compile_Placeableelementsc                 K   s   t |dkrt|d tjrt|d jS tdd |D r)tjdd|i|S t |dkr3|d S td	dd |D S )	Nr   r   c                 s   s    | ]
}t |tj V  qd S N)r   r   r*   r   childr   r   r   	<genexpr>$   s
    
z+Compiler.compile_Pattern.<locals>.<genexpr>r-    c                 s   s    | ]}|d V  qd S r.   r   r/   r   r   r   r1   ,   s    r   )
lenr   r   r+   NeverIsolatingPlaceabler)   anyPatternTextElementjoin)r   r(   r-   r$   r   r   r   compile_Pattern    s   zCompiler.compile_PatternN)r   
__module____qualname__r   r   r   strr"   r,   r   r9   r   r   r   r   r      s    
"r   N)
typingr   r   r   fluent.syntaxr   r   r2   r   r   r   r   r   r   <module>   s    