o
    ‡ÎÖaAB  ã                   @   sð   d Z ddlZddlmZmZmZmZmZmZ ddl	m
Z
mZmZmZmZmZmZmZmZmZ ddlmZmZmZ ddlmZ ddlmZ ddlmZ g d	¢Zd
ee
jeƒfZ G dd„ deƒZ!G dd„ de!ƒZ"G dd„ de!ƒZ#G dd„ deƒZ$dS )zÍ
    pygments.lexers.csound
    ~~~~~~~~~~~~~~~~~~~~~~

    Lexers for Csound languages.

    :copyright: Copyright 2006-2021 by the Pygments team, see AUTHORS.
    :license: BSD, see LICENSE for details.
é    N)Ú
RegexLexerÚbygroupsÚdefaultÚincludeÚusingÚwords)
ÚCommentÚErrorÚKeywordÚNameÚNumberÚOperatorÚPunctuationÚStringÚTextÚ
Whitespace)ÚOPCODESÚDEPRECATED_OPCODESÚREMOVED_OPCODES)Ú	HtmlLexer)ÚPythonLexer)ÚLuaLexer)ÚCsoundScoreLexerÚCsoundOrchestraLexerÚCsoundDocumentLexerz((?:(?:;|//).*)*)(\n)c                
   @   s<  e Zd Zi ddefdejfdejfdeeeƒfg“ddej	fdej	d	fd
ej	dfdej	dfdej	dfg“de
dƒdedfg“d	e
dƒdedfg“ddefe
dƒdeej	eƒdfdej	dfg“de
dƒdej	fdefdedfg“ddefe
dƒdedfg“dd ej	fd!ej	fd"edfg“de
dƒdej	dfg“d#d$eej	eƒd%fd&ej	fg“d%d'ej	fdefded(fd)ed*fd+ej	d,fdedfg“d(d-ej	fd.efe
d/ƒg“d*d-ej	fd.efe
d0ƒg“d,d1ej	fd+ej	d2fdej	dfg“d3e
dƒe
d#ƒg“d4d5ejfd6eejejƒfd7ejfg“d/dedfd8efe
d#ƒd9efg“d0g i¥Zd:S );ÚCsoundLexerÚ
whitespacez[ \t]+z/[*](?:.|\n)*?[*]/ú(?:;|//).*$z(\\)(\n)úpreprocessor directivesz)#(?:e(?:nd(?:if)?|lse)\b|##)|@@?[ \t]*\d+z#includestrzincludestr directivez#includezinclude directivez#[ \t]*definezdefine directivez#(?:ifn?def|undef)\bzmacro directivez([^ \t]).*?\1ú#popú")r   úquoted stringú\nz([A-Z_a-z]\w*)(\())r   úmacro parameter name listú[A-Z_a-z]\w*)r   úbefore macro bodyr#   z['#]z\)r%   ú#)r   ú
macro bodyr'   z(?:\\(?!#)|[^#\\]|\n)+z\\#z(?<!\\)#ú
macro usesz(\$[A-Z_a-z]\w*\.?)(\()zmacro parameter value listz\$[A-Z_a-z]\w*(?:\.|\b)z(?:[^\'#"{()]|\{(?!\{))+z#macro parameter value quoted stringú\{\{z#macro parameter value braced stringz\(z#macro parameter value parentheticalz\\[#'()]z[#'()]r!   úbraced stringz(?:[^\\()]|\\\))+z#pushúwhitespace and macro usesÚnumbersz2\d+[Ee][+-]?\d+|(\d+\.\d*|\d*\.\d+)([Ee][+-]?\d+)?z(0[Xx])([0-9A-Fa-f]+)ú\d+z[^"$]+z[$]N)Ú__name__Ú
__module__Ú__qualname__r   r   Ú	MultilineÚSingler   r   ÚPreprocr   r   r   r	   r   ÚFloatr
   ÚTypeÚHexÚIntegerÚtokens© r9   r9   ú8/usr/lib/python3/dist-packages/pygments/lexers/csound.pyr      sä    üÿ



ûøþðþìÿ
ûç üà&ýÚ+ýÕ1
þÏ6ÿýÊ;
úÅCý½Hý¸M

ý³Sþ­Xý¨^ü¢e
›r   c                   @   sâ   e Zd ZdZdZddgZdgZdefedƒedƒd	e	fd
e	j
fdee	ejƒfde	dfedƒdefdefdedfdejdfgedƒdejfdedfgedƒdejdfgedƒdejdfgdejdfedƒgdedfdefgdœZdS ) r   zO
    For `Csound <https://csound.com>`_ scores.

    .. versionadded:: 2.1
    zCsound Scorezcsound-scorez
csound-scoz*.scor"   r+   r   z[aBbCdefiqstvxy]Úzz([nNpP][pP])(\d+)z[mn]úmark statementr,   z[!+\-*/^%&|<>#~.]z[()\[\]]r    r!   z\{úloop after left bracer$   r   r-   )r   úloop after repeat count)r   Úloopz\}Úrootú\}\}z[^}]|\}(?!\}))r@   r<   r=   r>   r?   r*   N)r.   r/   r0   Ú__doc__ÚnameÚaliasesÚ	filenamesr   r   r
   ÚConstantr   r   r7   r   r   r   r   r3   r   ÚLabelr8   r9   r9   r9   r:   r   †   sF    
éý
þ
þ
þþ
Ðr   c                   @   sR  e Zd ZdZdZddgZddgZeƒ Zdd„ Z	d	d
„ Z
i ddefdeeejeeƒfedƒedƒdejdfdejdfdejfedƒg“ddejjfedƒdefdefdedfdedfedddd �efed!ddd �ejfd"ed#fd$eejeƒd#fd%eejeƒd&fd'eejeƒd(fd)eejeƒd*fd+ejd,fd-ejd.fd/ejd0fd1ejd2fd3ejjfd4e
fg“dedƒd5ejfd6efded7fg“dedƒd8e	d9fded7fg“d:edƒd;ejfd<efded7fg“dded7fd=efed>ƒed?ƒed@ƒdAefg“ddBed7fdCefed?ƒed@ƒdDefg“d?dEejfg“d@dFejfdGejfg“dHedƒd<ed7fedƒg“d#edƒdIejd7fed7ƒg“d,edƒdedJfed7ƒg“dJdKejfdLejfedƒg“d.edƒdedfdedMfded7fg“dMdBed7fdNe e!ƒfg“d0edƒdedfdedOfded7fg“dOdBed7fdNe e"ƒfg“edƒdedfdedPfded7fgdBed7fdNe e#ƒfgdQœ¥Z$dRS )Sr   zS
    For `Csound <https://csound.com>`_ orchestras.

    .. versionadded:: 2.1
    zCsound OrchestraÚcsoundz
csound-orcz*.orcz*.udoc                 c   s.   � |  d¡}| j |¡ | ¡ tj|fV  d S )Nr   )ÚgroupÚuser_defined_opcodesÚaddÚstartr   ÚFunction)ÚlexerÚmatchÚopcoder9   r9   r:   Úopcode_name_callbackÕ   s   €
z)CsoundOrchestraLexer.opcode_name_callbackc                 c   sö   � t j}| d¡}|tv s|tv s|tv r| ¡ tj|fV  n;|| j	v r.| ¡ tj
|fV  n,t}t d|¡}|rR| d¡t j| d¡fV  | d¡t| d¡fV  n| ¡ t|fV  | d¡ry| d¡t| d¡fV  | d¡|| d¡fV  d S d S )Né   z^(g?[afikSw])(\w+)é   é   )r
   r5   rI   r   r   r   rL   r   ÚBuiltinrJ   rM   ÚreÚsearchr   )rN   rO   Útype_annotation_tokenrC   Ú
name_matchr9   r9   r:   Úname_callbackÚ   s"   €


þz"CsoundOrchestraLexer.name_callbackr@   r"   z^([ \t]*)(\w+)(:)([ \t]+|$)r+   r   z	\binstr\bz"instrument numbers and identifiersz
\bopcode\bzafter opcode keywordz\b(?:end(?:in|op))\bzpartial statementsz-\b(?:0dbfs|A4|k(?:r|smps)|nchnls(?:_i)?|sr)\br,   u@   \+=|-=|\*=|/=|<<|>>|<=|>=|==|!=|&&|\|\||[~Â¬]|[=!+\-*/^%&|<>#?:]z	[(),\[\]]r    r!   r)   r*   )ÚdoÚelseÚelseifÚendifÚenduntilÚfiÚifÚithenÚkthenÚodÚthenÚuntilÚwhilez\b)ÚprefixÚsuffix)ÚreturnÚrireturnz\b[ik]?goto\bú
goto labelz"\b(r(?:einit|igoto)|tigoto)(\(|\b)z\b(c(?:g|in?|k|nk?)goto)(\(|\b))rl   úgoto argumentz\b(timout)(\(|\b))rl   rm   rm   z\b(loop_[gl][et])(\(|\b))rl   rm   rm   rm   z\bprintk?s\bzprints opcodez"\b(?:readscore|scoreline(?:_i)?)\bzCsound score opcodez\bpyl?run[it]?\bzPython opcodez\blua_(?:exec|opdef)\bú
Lua opcodez\bp\d+\bz$\b([A-Z_a-z]\w*)(?:(:)([A-Za-z]))?\bz\d+|[A-Z_a-z]\w*z[+,]r   r$   )r   úopcode type signaturesro   z0|[afijkKoOpPStV\[\]]+ú,z
[^\\"$%)]+r(   zescape sequenceszformat specifiersz[\\$%)]rA   z(?:[^\\%)}]|\}(?!\}))+z[\\%)]z\\(?:[\\abnrt"]|[0-7]{1,3})z'%[#0\- +]*\d*(?:\.\d+)?[AE-GXac-giosux]z%%rm   z\w+zprints quoted stringz\\\\[aAbBnNrRtT]z%[!nNrRtT]|[~^]{1,2}zCsound scorez([^}]+)|\}(?!\})ÚPythonÚLua)rn   rr   N)%r.   r/   r0   rB   rC   rD   rE   ÚsetrJ   rQ   rZ   r   r   r   rG   r   r   r
   ÚDeclarationÚVariableÚGlobalr   r   r   ÚPseudorU   ÚInstancerM   r5   ÚEscapeÚInterpolr   r   r   r   r   r8   r9   r9   r9   r:   r   È   sR   

ôÿ
ýýÿÿÿÿ




àð3üÍ:ýÆ?ùÁIú·Qû¯Xþ¨mþ“rýŽw
ý‰}ýƒ ý �ý 	ü �÷ 
þ �ñ ü �ì 
þ �æ  ü
þ �Ûr   c                   @   sî   e Zd ZdZdZddgZdgZdejfdej	fde
fd	ejd
fdejdfdejdfdejdfdejfgdejdfdeeƒfgdejdfdeeƒfgdejdfdeeƒfgdefdejdfdejdfgdefdedfdedfdedfgd œZd!S )"r   zR
    For `Csound <https://csound.com>`_ documents.

    .. versionadded:: 2.1
    zCsound Documentzcsound-documentz
csound-csdz*.csdz/[*](.|\n)*?[*]/r   z[^/;<]+|/(?!/)z<\s*CsInstruments)Ú	orchestraÚtagz<\s*CsScore)Úscorer|   z<\s*[Hh][Tt][Mm][Ll])ÚHTMLr|   z<\s*[\w:.-]+r|   z<\s*/\s*[\w:.-]+\s*>z<\s*/\s*CsInstruments\s*>r   z%(.|\n)+?(?=<\s*/\s*CsInstruments\s*>)z<\s*/\s*CsScore\s*>z(.|\n)+?(?=<\s*/\s*CsScore\s*>)z<\s*/\s*[Hh][Tt][Mm][Ll]\s*>z((.|\n)+?(?=<\s*/\s*[Hh][Tt][Mm][Ll]\s*>)z\s+z[\w.:-]+\s*=Úattrz/?\s*>z".*?"z'.*?'z[^\s>]+)r@   r{   r}   r~   r|   r   N)r.   r/   r0   rB   rC   rD   rE   r   r1   r2   r   r   ÚTagr   r   r   r   r   Ú	Attributer   r8   r9   r9   r9   r:   r   š  sB    



ö

þ

þ

þ

ýü
àr   )%rB   rV   Úpygments.lexerr   r   r   r   r   r   Úpygments.tokenr   r	   r
   r   r   r   r   r   r   r   Ú pygments.lexers._csound_builtinsr   r   r   Úpygments.lexers.htmlr   Úpygments.lexers.pythonr   Úpygments.lexers.scriptingr   Ú__all__r2   Únewliner   r   r   r   r9   r9   r9   r:   Ú<module>   s    
 0lB S