r2u2_cli 4.1.0

R2U2 CLI: A stream-based runtime monitor command-line interface
�

���h�
�	��SSKrSSKJr SSKrSSKJrJr SrS\RS\	S\
\\\R44Sjr
S	\RS\\R4S
jrS\RSS4SjrS\RSS4S
jrg)�N)�Optional)�types�log�PRSO�
trace_path�map_file_provided�returnc	��[SU35 [US5nUR5nSSS5 WR5n[	U5S:agSn0nUSSS:Xa�USSSnU(a[
R"[S5 URS	5Vs/sHo�R5PM snHPn	X�;a?[
R"[S
U	S3[
R"URS55 XVU	'US-
nMR [	U5S-
n
X�4$[	U5S4$!,(df   GN
=fs snf)zrGiven `trace_path`, return the inferred length of the trace and, if `return_mapping` is enabled, a signal mapping.zTrace: �rN�)�����Nr�#zHMap file given and header included in trace file; header will be ignored�,�Signal ID 'z5' found multiple times in csv, using right-most value)�print�open�read�
splitlines�lenr�warning�MODULE_CODE�split�strip�FileLocation�name)rr�f�content�lines�cnt�signal_mapping�header�s�id�trace_lengths           �o/Users/aaurandt/Desktop/IowaState/R2U2Research/Dissertation/Comparison/r2u2-modify/compiler/c2po/parse_utils.py�parse_trace_filer&	s5��
�G�J�<�
 �!�	
�j�#�	�!��v�v�x��
��)�)�+�E�
�5�z�A�~���C�*,�N��Q�x��{�c���q��!�"�����K�K��Z�
�
'-�l�l�3�&7�8�&7��7�7�9�&7�8�B��#�����!�"��%Z�[��$�$�Z�_�_�a�8��
"%�2���1�H�C�9��5�z�A�~���-�-�
��J����I
�	��*9s�D/�!E�/
D>�map_pathc�~�[US5nUR5nSSS5 0nWR5nUH�n[R"SU5(a�URS5nUSn[
US5nXs;aQ[R"[SUS3[R"URURU5S-55 X�U'M�[R"[S	US
3[R"URURU555  g U$!,(df   GN=f)z*Return the signal mapping from `map_path`.rNz[a-zA-Z_][a-zA-Z0-9_\[\]]*:\d+�:rrrz6' found multiple times in map file, using latest valuez#Invalid format for map line (found z,)
	 Should be of the form SYMBOL ':' NUMERAL)rrr�re�matchr�intrrrrr�index�error)	r'rr�mappingr�line�strsr#�sids	         r%�parse_map_filer35s��	
�h��	���v�v�x��
�$&�G���� �E���
�8�8�5�t�<�<��:�:�c�?�D��a��B��d�1�g�,�C��}�����!�"��%[�\��$�$�X�]�]�E�K�K��4E��4I�J���B�K��I�I��5�d�V�<@�@�� � �������D�0A�B�	
��+�.�N�;
�	�s�D-�-
D<�bounds_pathc��g�N��r4s r%�parse_bounds_cr9W����c��gr6r7r8s r%�parse_bounds_rustr=[r:r;)�pathlib�typingrr*�c2porrr�Path�bool�tupler,�
SignalMappingr&r3r9r=r7r;r%�<module>rEs�����	����)����)�15�)�
�3���,�,�-�-�.�)�X�W�\�\��h�u�7J�7J�.K��D	����	��	�	�7�<�<�	�D�	r;