i7i&dZddlZddlmZmZmZmZmZddlm Z m Z m Z m Z m Z mZmZmZmZmZgdZGddeZGdd eZGd d eZGd d eZGddeZy)z pygments.lexers.algebra ~~~~~~~~~~~~~~~~~~~~~~~ Lexers for computer algebra systems. :copyright: Copyright 2006-2025 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. N)Lexer RegexLexerbygroups do_insertionswords) TextCommentOperatorKeywordNameStringNumber PunctuationGeneric Whitespace)GAPLexerGAPConsoleLexerMathematicaLexer MuPADLexerBCLexerceZdZdZdZdZdgZgdZdZdde jfd e fd e fd e fd ejfd ej fdefdej$fdej&fdefdefdefg iZdZy)rz For GAP source code. GAPhttps://www.gap-system.orggap)z*.gz*.gdz*.giz*.gap2.0rootz#.*$"(?:[^"\\]|\\.)*"\(|\)|\[|\]|\{|\}aV(?x)\b(?: if|then|elif|else|fi| for|while|do|od| repeat|until| break|continue| function|local|return|end| rec| quit|QUIT| IsBound|Unbind| TryNextMethod| Info|Assert )\bzD(?x)\b(?: true|false|fail|infinity )\bzx(?x)\b(?: (Declare|Install)([A-Z][A-Za-z]+)| BindGlobal|BIND_GLOBAL )\bz\.|,|:=|;|=|\+|-|\*|/|\^|>|?C  SLE 99 HIM  SLE5#N)__name__ __module__ __qualname____doc__nameurlaliases filenames version_addedr Singler rr r ConstantBuiltinr WordVariablerrtokensr*r+r)rrs D &CgG0IM  gnn % !6 * !; /  ]] \\   -h 7]] $%)]] 40 8 $f - 4LG$ &FPr+rc:eZdZdZdZddgZdgZdZdZdZ d Z d Z y ) rzD For GAP console sessions. Modeled after JuliaConsoleLexer. z GAP sessionz gap-consolezgap-replz*.tstrz2.14zgap-repl/euclidean.tstc #Ktd i|j}d}d}g}d}d}|jdD])}|jds|jdr>|j t |dt j|ddfgf||ddz }d}d}n|sK|jd r:|j t |dt j|dd fgf||d dz }nk|r't||j|Ed{d}g}|jd s|r|t j|fd}n|t j|fd}|t |z },|r$t||j|Ed{yy77w) NrFT)keependszgap> zbrk> z> zError, r;) roptions splitlines startswithappendlenrPromptrget_tokens_unprocessedErrorOutput) selfr'gaplexerstartcurcode insertionsoutputerrorlines r)rHz&GAPConsoleLexer.get_tokens_unprocessedfs+dll+ OOTO2 Dw'4??7+C!!3w<1gnnd2Ah2O1P"QR48# 5!!3w<1gnnd2Ah2O1P"QR48#,"H$C$CG$L NNN G!#J??9-44 E55 SY E+ . $H;;GDF F F N Fs%DF FA;F F F  F c2tjd|ryy)Nz^gap> g?r#)r$r%)r's r)r*zGAPConsoleLexer.analyse_texts 99Y %r+N) r,r-r.r/r0r2r3r1r4_examplerHr*r;r+r)rr[s: Dj)G I &CM'H!FHr+rc6eZdZdZdZdZgdZgdZgdZdZ dZ d Z d Z d d e fd ejfdej fdej fdefdej$fdej$fdej&fee efee efdefdej2fg iZy)rz, Lexer for Mathematica source code. Mathematicaz#http://www.wolfram.com/mathematica/) mathematicammanb)z*.nbz*.cdfz*.nbpz*.ma)zapplication/mathematicaz#application/vnd.wolfram.mathematicaz+application/vnd.wolfram.mathematica.packagezapplication/vnd.wolfram.cdfr) z;;=z=.z!===z:=z->z:>z/.+-*/^z&&z||!z<>|z/;?@z//z/@z@@z@@@z~~z===&<>z<=z>=),;()[]{}cPdjdjd|DS)Nz({})rac3FK|]}tj|yw)N)r$escape).0entrys r) z1MathematicaLexer._multi_escape..s%L5bii&6%Ls!)formatjoin)entriess r) _multi_escapezMathematicaLexer._multi_escapes }}SXX%LG%LLMMr+rz(?s)\(\*.*?\*\)z([a-zA-Z]+[A-Za-z0-9]*`)z([A-Za-z0-9]*_+[A-Za-z0-9]*)z#\d*z([a-zA-Z]+[a-zA-Z0-9]*)z -?\d+\.\d*z -?\d*\.\d+z-?\d+z".*?"\s+N)r,r-r.r/r0r1r2r3 mimetypesr4 operators punctuationrxr r Namespacer9rFloatIntegerrr rr rrr:r;r+r)rrs D /C*G2I0IMI ;KN   ) ($.. 9 ,dmm < dmm $ ' . FLL ) FLL ) v~~ & 9 x ( ;  - v  T__ % Fr+rceZdZdZdZdZdgZdgZdZde jfde jd fd e fd e fd efd ej fdej"fdej$j&fdefdej*fdefdeej0ee fdej4fdefdefdefdefgde jfde jdfde jdfde jfgdZy) rz[ A MuPAD lexer. Contributed by Christopher Creutzig . MuPADzhttp://www.mupad.commupadz*.muz0.8z//.*?$/\*commentrra(?x)\b(?: next|break|end| axiom|end_axiom|category|end_category|domain|end_domain|inherits| if|%if|then|elif|else|end_if| case|of|do|otherwise|end_case| while|end_while| repeat|until|end_repeat| for|from|to|downto|step|end_for| proc|local|option|save|begin|end_proc| delete|frame )\baU(?x)\b(?: DOM_ARRAY|DOM_BOOL|DOM_COMPLEX|DOM_DOMAIN|DOM_EXEC|DOM_EXPR| DOM_FAIL|DOM_FLOAT|DOM_FRAME|DOM_FUNC_ENV|DOM_HFARRAY|DOM_IDENT| DOM_INT|DOM_INTERVAL|DOM_LIST|DOM_NIL|DOM_NULL|DOM_POLY|DOM_PROC| DOM_PROC_ENV|DOM_RAT|DOM_SET|DOM_STRING|DOM_TABLE|DOM_VAR )\bz(?x)\b(?: PI|EULER|E|CATALAN| NIL|FAIL|undefined|infinity| TRUE|FALSE|UNKNOWN )\bz\b(?:dom|procname)\bz-\.|,|:|;|=|\+|-|\*|/|\^|@|>|<|\$|\||!|\'|%|~=z(?x)\b(?: and|or|not|xor| assuming| div|mod| union|minus|intersect|in|subset )\bz \b(?:I|RDN_INF|RD_NINF|RD_NAN)\bzi(?x) ((?:[a-zA-Z_#][\w#]*|`[^`]*`) (?:::[a-zA-Z_#][\w#]*|`[^`]*`)*)(\s*)([(])z](?x) (?:[a-zA-Z_#][\w#]*|`[^`]*`) (?:::[a-zA-Z_#][\w#]*|`[^`]*`)*rr ryr!z[^/*]+z#push\*/#pop[*/]rrN)r,r-r.r/r0r1r2r3r4r r5 Multiliner rr r Classr6r7Pseudor r8rrFunctionrr9rr:r;r+r)rrsc D CiGIM ' W&& 2 !6 * !; /   jj  "  ]]   %dll&9&9 : =x H ]]  1& 9<dmmT; 7 9126-- A0 8 $f - Z 4Lc2 h)) * W&& 0 W&& / g'' (  i:Fr+rc eZdZdZdZdZdgZdgZdZde jdfd e fd e fe d d efdefdefdefdefgde jfde jdfde jfgdZy)rz A BC lexer. BCz https://www.gnu.org/software/bc/bcz*.bcz2.1rrrz[{}();,])ifelsewhileforbreakcontinuehaltreturndefineautoprintreadlengthscalesqrtlimitsquitwarrantyz\b)suffixz!\+\+|--|\|\||&&|([-<>+*%\^/!=])=?z[0-9]+(\.[0-9]*)?z\.[0-9]+r!z[^*/]+rrrrN)r,r-r.r/r0r1r2r3r4r rr rrr r rrr:r;r+r)rr s D ,CfGIMW&& 2 !6 * + &  )./18 9"#+ -"6 * & ! 4L )) * W&& / g'' ( !Fr+r)r/r$pygments.lexerrrrrrpygments.tokenrr r r r r rrrr__all__rrrrrr;r+r)rso LL--- CzCL7e7t,z,^EEPjr+