
    x
h                     \    d dl Z ddlmZ ddlmZ ddlmZ  e j                  d      ZddZ	y)	    N   )InvalidSpec)ParserFactory)IRGeneratorzstone.frontend.frontendc                    t        |      }g }| D ]  \  }}t        j                  d|       |j                         }|r|j	                  |       |j                  ||      }	|j                         r$|j                         d   \  }
}}t        |
||      t        |	      dk(  rt        j                  d|       |j                  |	        t        ||||      j                         S )af  
    Converts a collection of Stone specifications into the intermediate
    representation used by Stone backends.

    The process is: Lexer -> Parser -> Semantic Analyzer -> IR Generator.

    The code is structured as:
        1. Parser (Lexer embedded within)
        2. IR Generator (Semantic Analyzer embedded within)

    :type specs: List[Tuple[path: str, text: str]]
    :param specs: `path` is never accessed and is only used to report the
        location of a bad spec to the user. `spec` is the text contents of
        a spec (.stone) file.

    :raises: InvalidSpec

    :returns: stone.ir.Api
    )debugzParsing spec %sr   zEmpty spec: %s)r   route_whitelist_filter)r   loggerinfo
get_parsertest_lexingparsegot_errors_parsing
get_errorsr   lenappendr   generate_IR)specsversionr   r	   parser_factorypartial_astspathtextparserpartial_astmsglinenos               \/var/www/html/lionshead-backend/venv/lib/python3.12/site-packages/stone/frontend/frontend.pyspecs_to_irr      s    * #/NL
d%t,**,t$ll4.$$& & 1 1 3A 6Cc6400"KK($/, " |WE.DFFQkmT    )z0.1b1FN)
logging	exceptionr   r   r   ir_generatorr   	getLoggerr
   r    r    r   <module>r&      s.     " &			4	5*Tr    