�
|�er� � � � d Z ddlZddlmZmZmZmZmZmZm Z m
Z
mZmZ ddl
mZmZmZmZmZmZmZmZmZmZ ddlmZ g d�Z G d� de� Z G d � d
e� Z G d� de� Z G d
� de� Z G d� de� Z G d� de� Z G d� de� Z! G d� de� Z" G d� de� Z# G d� de� Z$ G d� de� Z% G d� de� Z&y)z�
pygments.lexers.shell
~~~~~~~~~~~~~~~~~~~~~
Lexers for various shells.
:copyright: Copyright 2006-2023 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
� N)
�Lexer�
RegexLexer�
do_insertions�bygroups�include�default�this�using�words�line_re)
�Punctuation�
Whitespace�Text�Comment�Operator�Keyword�Name�String�Number�Generic��shebang_matches)� BashLexer�BashSessionLexer� TcshLexer�
BatchLexer�SlurmBashLexer�MSDOSSessionLexer�PowerShellLexer�PowerShellSessionLexer�TcshSessionLexer�FishShellLexer�
ExeclineLexerc �p � e Zd ZdZdZg d�Zg d�Zg d�Z ed� de j df ed � ed
� gdedfd
edfde j dfde
j fde
j fdefgd eee� fde
j$ fdej( fdej* fde j, fd ee
j ee� fdefdefde fdefg
de j0 fde j0 d fd!e j* fd"e j* fd#efd$efd%efd&efd'efd(efd)efgde j0 d*fd+e j0 f ed
� gd,e j d*fd-efd.e
j fd/efd0ef ed1� gd2ed*f ed1� gd3ed*fd4efd5efd6efd7efd8efd9e
j f ed1� gde j d*f ed1� gd:� Zd;� Zy<)=r zI
Lexer for (ba|k|z|)sh shell scripts.
.. versionadded:: 0.6
�Bash)�bash�sh�ksh�zsh�shell)z*.shz*.kshz*.bashz*.ebuildz*.eclassz*.exheres-0z*.exlibz*.zshz.bashrc�bashrcz.bash_*zbash_*�zshrcz.zshrcz.kshrc�kshrc�PKGBUILD)zapplication/x-shzapplication/x-shellscriptztext/x-shellscript�basic�`� backticks�data�interp�\$\(\(�math�\$\(�paren�\$\{#?�curlyz\$[a-zA-Z_]\w*z\$(?:\d+|[#$?!_*@-])�\$zj\b(if|fi|else|while|in|do|done|for|then|return|function|case|select|break|continue|until|esac|elif)(\s*)\baG \b(alias|bg|bind|builtin|caller|cd|command|compgen|complete|declare|dirs|disown|echo|enable|eval|exec|exit|export|false|fc|fg|getopts|hash|help|history|jobs|kill|let|local|logout|popd|printf|pushd|pwd|read|readonly|set|shift|shopt|source|suspend|test|time|times|trap|true|type|typeset|ulimit|umask|unalias|unset|wait)(?=[\s)`])�\A#!.+\n�#.*\n�\\[\w\W]z(\b\w+)(\s*)(\+?=)z[\[\]{}()=]z<<<�<<-?\s*(\'?)\\?(\w+)[\w\W]+?\2z&&|\|\|z(?s)\$?"(\\.|[^"\\$])*"�"�string�#(?s)\$'(\\\\|\\[0-7]+|\\.|[^'\\])*'� (?s)'.*?'�;�&z\|�\s+z\d+\b�[^=\s\[\]{}()$"\'`\\<&|;]+�<�#pop� (?s)(\\\\|\\[0-7]+|\\.|[^"\\$])+�\}�:-�\w+z
[^}:"\'`$\\]+�:�root�\)�\)\)z\*\*|\|\||<<|>>|[-+*/%^|&<>]z\d+#[\da-zA-Z]+� \d+#(?! )z0[xX][\da-fA-F]+�\d+z[a-zA-Z_]\w*) rN r3 r/ r2 r@ r9 r7 r5 r1 c �B � t | d� ry| j d� ryy )Nz (ba|z|)sh� z$ g�������?)r �
startswith��texts �7/usr/lib/python3/dist-packages/pygments/lexers/shell.py�analyse_textzBashLexer.analyse_textz s# � ��4��.���?�?�4� �� !� N)�__name__�
__module__�__qualname__�__doc__�name�aliases� filenames� mimetypesr r �Backtickr �Interpolr �Variabler r r �Builtinr �Hashbang�Single�Escaper �Doubler
r �tokensrY � rZ rX r r s� � �� �D�3�G��I�
X�I�
�G��
�6�?�?�K�0��F�O��H��
� ���(�
�g�w�'�
�����1�
��
�
�.�
$�d�m�m�4�
�D�M�
�>�
�g�z�
*�
,�;� �\�\�
� �'�*�*�+�
�w�~�~�&�
�&�-�-�(�
"�H�T�]�]�J��$Q�R�
�X�&�
�X��
.��7�
��"�%
�* (����7�
�6�=�=�(�+�
3�V�]�]�C�
�6�=�=�)�
�;��
�;��
�K� �
�Z� �
�v��
*�D�1�
�4�L�
� �6�=�=�&�)�
0�&�-�-�@��H��
� �F�O�O�V�,�
�G��
�T�]�]�#�
�{�+�
�;���F�O�
� �G�V�$��F�O�
�
�g�v�&�
,�h�7�
��(�
�6�"�
�&�)�
�V��
�d�m�m�,��F�O�
� �6�?�?�F�+��F�O�
�WO�F�brZ r c �2 � e Zd ZdZdZddgZdgZg ZdhZd� Z y) r zI
Lexer for (ba|k|z|)sh Slurm scripts.
.. versionadded:: 2.4
�Slurm�slurm�sbatchz*.sl�srunc # � K � t j | |� D ]e \ }}}|t u r$|| j v r|t j
|f�� �3|t j u rd|v r|t j |f�� �_|||f�� �g y �w)N�SBATCH)
r �get_tokens_unprocessedr �EXTRA_KEYWORDSr rf r rh r �Pseudo)�selfrW �index�token�values rX rt z%SlurmBashLexer.get_tokens_unprocessed� s � �� �#,�#C�#C�D�$�#O� *��E�5�%���}��$�*=�*=�!=��T�\�\�5�0�0��'�.�.�(�X��->��W�^�^�U�2�2��U�E�)�)�
*�s �B BN)
r[ r\ r] r^ r_ r` ra rb ru rt rl rZ rX r r � s0 � �� �D���!�G���I��I��X�N�*rZ r c �> |