3

V'ícbBã@sòdZddlZddlmZmZmZmZmZmZddl	m
Z
mZmZm
Z
mZmZmZmZmZmZddlmZmZmZddlmZddlmZddlmZd	d
dgZdee
jeƒfZ Gd
d„deƒZ!Gdd	„d	e!ƒZ"Gdd
„d
e!ƒZ#Gdd„deƒZ$dS)zÍ
    pygments.lexers.csound
    ~~~~~~~~~~~~~~~~~~~~~~

    Lexers for Csound languages.

    :copyright: Copyright 2006-2022 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øeZdZdZdefdejfdejfdee	eƒfgdej
fdej
dfd	ej
d
fdej
dfd
ej
dfgedƒdedfgedƒded6fgdefedƒdeej
e
ƒd7fdej
d8fgedƒdej
fde
fde
d9fgdefedƒde
d:fgdej
fdej
fde
dfgedƒdej
dfgd eej
e
ƒd!fd"ej
fgd#ej
fde
fded$fd%ed&fd'ej
d(fde
dfgd)ej
fd*efedƒgd)ej
fd*efed+ƒgd,ej
fd'ej
d-fdej
dfgedƒed.ƒgd/ejfd0eejejƒfd1ejfgdedfd2efed.ƒd3efggd4œZd5S);ÚCsoundLexerzhttps://csound.com/z[ \t]+z/[*](?:.|\n)*?[*]/z(?:;|//).*$z(\\)(\n)z)#(?:e(?:nd(?:if)?|lse)\b|##)|@@?[ \t]*\d+z#includestrzincludestr directivez#includezinclude directivez
#[ \t]*definezdefine directivez#(?:ifn?def|undef)\bzmacro directiveÚ
whitespacez
([^ \t]).*?\1ú#popú"ú
quoted stringz\nz([A-Z_a-z]\w*)(\()úmacro parameter name listz[A-Z_a-z]\w*úbefore macro bodyz['#]z\)ú#ú
macro bodyz(?:\\(?!#)|[^#\\]|\n)+z\\#z(?<!\\)#z(\$[A-Z_a-z]\w*\.?)(\()zmacro parameter value listz\$[A-Z_a-z]\w*(?:\.|\b)z(?:[^\'#"{()]|\{(?!\{))+z#macro parameter value quoted stringz\{\{z#macro parameter value braced stringz\(z#macro parameter value parentheticalz\\[#'()]z[#'()]z
braced stringz(?:[^\\()]|\\\))+z#pushz
macro usesz2\d+[Ee][+-]?\d+|(\d+\.\d*|\d*\.\d+)([Ee][+-]?\d+)?z(0[Xx])([0-9A-Fa-f]+)z\d+z[^"$]+z[$])rzpreprocessor directiveszinclude directivezincludestr directivezdefine directivezmacro parameter name listzbefore macro bodyz
macro bodyzmacro directivez
macro useszmacro parameter value listz#macro parameter value quoted stringz#macro parameter value braced stringz#macro parameter value parentheticalzwhitespace and macro usesÚnumbersz
quoted stringz
braced stringN)rr)rr )rr!)rr!)rr#)Ú__name__Ú
__module__Ú__qualname__ÚurlrrÚ	MultilineÚSinglerrÚPreprocrrrr	rZFloatr
ÚTypeZHexÚIntegerÚtokens©r/r/ú:/tmp/pip-build-gk9425m9/Pygments/pygments/lexers/csound.pyrsv












rc@sâeZdZdZdZddgZdgZdefedƒedƒd	e	fd
e	j
fdee	ej
ƒfde	d
fedƒdefdefdedfdejdfgedƒdejfdedfgedƒdej
d fgedƒdejd!fgdejdfedƒgdedfdefgdœZdS)"rzO
    For `Csound <https://csound.com>`_ scores.

    .. versionadded:: 2.1
    zCsound Scorezcsound-scorez
csound-scoz*.scoz\nzwhitespace and macro useszpreprocessor directivesz[aBbCdefiqstvxy]Úzz([nNpP][pP])(\d+)z[mn]zmark statementr$z[!+\-*/^%&|<>#~.]z[()\[\]]rz
quoted stringz\{zloop after left bracez[A-Z_a-z]\w*ú#popz\d+úloop after repeat countÚloopz\}Úrootz\}\}z
[^}]|\}(?!\}))r5zmark statementzloop after left bracezloop after repeat countr4z
braced stringN)r2r3)r2r4)r%r&r'Ú__doc__ÚnameÚaliasesÚ	filenamesrrr
ÚConstantrrr-r
rrrr+rÚLabelr.r/r/r/r0rˆs6

c@s
eZdZdZdZddgZddgZeƒZdd„Z	d	d
„Z
defdeee
jeeƒfed
ƒedƒdejdfdejdfdejfedƒgde
jjfedƒdefdefdedfdedfed[d*d*d+efed\d*d*d+ejfd.ed/fd0eejeƒd/fd1eejeƒd]fd3eejeƒd^fd4eejeƒd_fd5e
jd6fd7e
jd8fd9e
jd:fd;e
jd<fd=e
jjfd>e
fged
ƒd?e
jfd@efdedAfged
ƒdBe	d`fdedAfged
ƒdDejfdEefdedAfgdedAfdFefedGƒedHƒedIƒdJefgdKedAfdLefedHƒedIƒdMefgdNejfgdOejfdPejfged
ƒdEedAfedƒged
ƒdQe
jdAfedAƒged
ƒdedRfedAƒgdSejfdTejfedƒged
ƒdedfdedUfdedAfgdKedAfdVe e!ƒfged
ƒdedfdedWfdedAfgdKedAfdVe e"ƒfged
ƒdedfdedXfdedAfgdKedAfdVe e#ƒfgdYœZ$dZS)arzS
    For `Csound <https://csound.com>`_ orchestras.

    .. versionadded:: 2.1
    zCsound OrchestraZcsoundz
csound-orcz*.orcz*.udoccs,|jdƒ}|jj|ƒ|jƒtj|fVdS)Nr)ÚgroupÚuser_defined_opcodesÚaddÚstartrÚFunction)ÚlexerÚmatchÚopcoder/r/r0Úopcode_name_callback×s
z)CsoundOrchestraLexer.opcode_name_callbackccsðtj}|jdƒ}|tks(|tks(|tkr<|jƒtj|fVnv||j	krZ|jƒtj
|fVnXt}tjd|ƒ}|r¢|jdƒtj|jdƒfV|jdƒt|jdƒfVn|jƒt|fV|jdƒrì|jdƒt
|jdƒfV|jdƒ||jdƒfVdS)Néz^(g?[afikSw])(\w+)éé)r
r,r<rrrr?rÚBuiltinr=r@ÚreÚsearchr)rArBZtype_annotation_tokenr7Z
name_matchr/r/r0Ú
name_callbackÜs


z"CsoundOrchestraLexer.name_callbackz\nz^([ \t]*)(\w+)(:)([ \t]+|$)zwhitespace and macro useszpreprocessor directivesz	\binstr\bz"instrument numbers and identifiersz
\bopcode\bzafter opcode keywordz\b(?:end(?:in|op))\bzpartial statementsz-\b(?:0dbfs|A4|k(?:r|smps)|nchnls(?:_i)?|sr)\br$u@\+=|-=|\*=|/=|<<|>>|<=|>=|==|!=|&&|\|\||[~¬]|[=!+\-*/^%&|<>#?:]z	[(),\[\]]rz
quoted stringz\{\{z
braced stringÚ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)ú
goto argumentz\b(timout)(\(|\b)z\b(loop_[gl][et])(\(|\b)z\bprintk?s\bz
prints opcodez"\b(?:readscore|scoreline(?:_i)?)\bzCsound score opcodez\bpyl?run[it]?\bz
Python opcodez\blua_(?:exec|opdef)\bz
Lua opcodez\bp\d+\bz$\b([A-Z_a-z]\w*)(?:(:)([A-Za-z]))?\bz\d+|[A-Z_a-z]\w*z[+,]ú#popz[A-Z_a-z]\w*úopcode type signaturesz0|[afijkKoOpPStV\[\]]+ú,z
[^\\"$%)]+z
macro useszescape sequenceszformat specifiersz[\\$%)]z\}\}z(?:[^\\%)}]|\}(?!\}))+z[\\%)]z\\(?:[\\abnrt"]|[0-7]{1,3})z'%[#0\- +]*\d*(?:\.\d+)?[AE-GXac-giosux]z%%z\w+zprints quoted stringz\\\\[aAbBnNrRtT]z%[!nNrRtT]|[~^]{1,2}zCsound scorez([^}]+)|\}(?!\})ÚPythonÚLua)r5zpartial statementsz"instrument numbers and identifierszafter opcode keywordzopcode type signaturesz
quoted stringz
braced stringzescape sequenceszformat specifiersz
goto argumentz
goto labelz
prints opcodezprints quoted stringzCsound score opcodezCsound scorez
Python opcoderbz
Lua opcodercN)
rLrMrNrOrPrQrRrSrTrUrVrWrX)r[r\)r]r^)r]r^r^)r]r^r^r^)r_r`)%r%r&r'r6r7r8r9Úsetr=rDrKrrrr;rrr
ZDeclarationÚVariableÚGlobalr
rrZPseudorHZInstancer@r,ZEscapeZInterpolrrrrrr.r/r/r/r0rÊsÀ
















c@sîeZdZdZdZddgZdgZdejfdej	fde
fd	ejd"fdejd#fdejd$fdejdfdejfgdejdfde
eƒfgdejdfde
eƒfgdejdfde
eƒfgdefdejdfdejdfgdefdedfdedfdedfgd œZd!S)%rzR
    For `Csound <https://csound.com>`_ documents.

    .. versionadded:: 2.1
    zCsound Documentzcsound-documentz
csound-csdz*.csdz/[*](.|\n)*?[*]/z(?:;|//).*$z[^/;<]+|/(?!/)z<\s*CsInstrumentsÚ	orchestraÚtagz<\s*CsScoreÚscorez<\s*[Hh][Tt][Mm][Ll]ÚHTMLz<\s*[\w:.-]+z<\s*/\s*[\w:.-]+\s*>z<\s*/\s*CsInstruments\s*>z#popz%(.|\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>]+)r5rgrirjrhrkN)rgrh)rirh)rjrh)r%r&r'r6r7r8r9rr)r*rrZTagrrrrrÚ	Attributerr.r/r/r/r0rœs2








)%r6rIZpygments.lexerrrrrrrZpygments.tokenrr	r
rrr
rrrrZ pygments.lexers._csound_builtinsrrrZpygments.lexers.htmlrZpygments.lexers.pythonrZpygments.lexers.scriptingrÚ__all__r*Únewlinerrrrr/r/r/r0Ú<module>	s 0
nBS