o aAB@sdZddlZddlmZmZmZmZmZmZddl m Z m Z m Z m Z mZmZmZmZmZmZddlmZmZmZddlmZddlmZddlmZgd Zd ee jefZ Gd d d eZ!Gd dde!Z"Gddde!Z#GdddeZ$dS)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) RegexLexerbygroupsdefaultincludeusingwords) CommentErrorKeywordNameNumberOperator PunctuationStringText Whitespace)OPCODESDEPRECATED_OPCODESREMOVED_OPCODES) HtmlLexer) PythonLexer)LuaLexer)CsoundScoreLexerCsoundOrchestraLexerCsoundDocumentLexerz((?:(?:;|//).*)*)(\n)c @s<eZdZiddefdejfdejfdeeefgddej fdej d fd ej d fd ej d fdej dfgd e dde dfgd e dde dfgd defe ddeej e dfdej dfgde ddej fde fde dfgddefe dde dfgdd ej fd!ej fd"e dfgde ddej dfgd#d$eej e d%fd&ej fgd%d'ej fde fde d(fd)e d*fd+ej d,fde dfgd(d-ej fd.e fe d/gd*d-ej fd.e fe d0gd,d1ej fd+ej d2fdej dfgd3e de d#gd4d5ejfd6eejejfd7ejfgd/de dfd8e fe d#d9e fgd0giZd:S); CsoundLexer whitespacez[ \t]+z/[*](?:.|\n)*?[*]/ (?:;|//).*$z(\\)(\n)preprocessor directivesz)#(?:e(?:nd(?:if)?|lse)\b|##)|@@?[ \t]*\d+z #includestrzincludestr directivez#includezinclude directivez #[ \t]*definezdefine directivez#(?:ifn?def|undef)\bzmacro directivez ([^ \t]).*?\1#pop")r quoted string\nz([A-Z_a-z]\w*)(\())rmacro parameter name list [A-Z_a-z]\w*)rbefore macro bodyr#z['#]z\)r%#)r macro bodyr'z(?:\\(?!#)|[^#\\]|\n)+z\\#z(?`_ scores. .. versionadded:: 2.1 z Csound Scorez csound-scorez csound-scoz*.scor"r+rz[aBbCdefiqstvxy]zz([nNpP][pP])(\d+)z[mn]mark statementr,z[!+\-*/^%&|<>#~.]z[()\[\]]r r!z\{loop after left bracer$rr-)rloop after repeat count)rloopz\}root\}\}z [^}]|\}(?!\}))r@r<r=r>r?r*N)r.r/r0__doc__namealiases filenamesrrr Constantrr r7r rrrr3r Labelr8r9r9r9r:rsF     rc@sReZdZdZdZddgZddgZeZddZ d d Z id d e fd e e e jee fededdejdfdejdfdejfedgdde jjfeddefdefdedfdedfedddd efed!ddd ejfd"ed#fd$e ejed#fd%e ejed&fd'e ejed(fd)e ejed*fd+e jd,fd-e jd.fd/e jd0fd1e jd2fd3e jjfd4e fgdedd5e jfd6efd e d7fgdedd8e d9fd e d7fgd:edd;ejfded?ed@dAefgddBed7fdCefed?ed@dDefgd?dEejfgd@dFejfdGejfgdHedd`_ orchestras. .. versionadded:: 2.1 zCsound Orchestracsoundz csound-orcz*.orcz*.udoccs.|d}|j||tj|fVdS)Nr)groupuser_defined_opcodesaddstartr Function)lexermatchopcoder9r9r:opcode_name_callbacks  z)CsoundOrchestraLexer.opcode_name_callbackccstj}|d}|tvs|tvs|tvr|tj|fVn;||j vr.|tj |fVn,t}t d|}|rR|dtj|dfV|dt|dfVn|t|fV|dry|dt |dfV|d||dfVdSdS)Nz^(g?[afikSw])(\w+))r r5rIrrrrLr BuiltinrJrMresearchr)rNrOtype_annotation_tokenrC name_matchr9r9r: name_callbacks"    z"CsoundOrchestraLexer.name_callbackr@r"z^([ \t]*)(\w+)(:)([ \t]+|$)r+rz \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 [(),\[\]]r r!r)r*) doelseelseifendifenduntilfiifithenkthenodthenuntilwhilez\b)prefixsuffix)returnrireturnz \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))rlrmrmz\b(loop_[gl][et])(\(|\b))rlrmrmrmz \bprintk?s\bz prints opcodez"\b(?:readscore|scoreline(?:_i)?)\bzCsound 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[+,]rr$)ropcode type signaturesroz0|[afijkKoOpPStV\[\]]+,z [^\\"$%)]+r(zescape sequenceszformat specifiersz[\\$%)]rAz(?:[^\\%)}]|\}(?!\}))+z[\\%)]z\\(?:[\\abnrt"]|[0-7]{1,3})z'%[#0\- +]*\d*(?:\.\d+)?[AE-GXac-giosux]z%%rmz\w+zprints quoted stringz\\\\[aAbBnNrRtT]z%[!nNrRtT]|[~^]{1,2}z Csound scorez([^}]+)|\}(?!\})PythonLua)rnrrN)%r.r/r0rBrCrDrEsetrJrQrZrrr rGrrr DeclarationVariableGlobalr rrPseudorUInstancerMr5EscapeInterpolrrrrrr8r9r9r9r:rsR            3:?IQXmrw }      rc @seZdZdZdZddgZdgZdejfdej fde fd e j d fd e j d fd e j dfde j dfde j fgde j dfde efgde j dfde efgde j dfde efgdefde jdfde j dfgdefdedfdedfdedfgd Zd!S)"rzR For `Csound `_ documents. .. versionadded:: 2.1 zCsound Documentzcsound-documentz csound-csdz*.csdz/[*](.|\n)*?[*]/rz[^/;<]+|/(?!/)z<\s*CsInstruments) orchestratagz <\s*CsScore)scorer|z<\s*[Hh][Tt][Mm][Ll])HTMLr|z <\s*[\w:.-]+r|z<\s*/\s*[\w:.-]+\s*>z<\s*/\s*CsInstruments\s*>rz%(.|\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|rN)r.r/r0rBrCrDrErr1r2rr Tagrrrrr Attributerr8r9r9r9r:rsB              r)%rBrVpygments.lexerrrrrrrpygments.tokenrr r r r r rrrr pygments.lexers._csound_builtinsrrrpygments.lexers.htmlrpygments.lexers.pythonrpygments.lexers.scriptingr__all__r2newlinerrrrr9r9r9r:s 0   lBS