
    |e&                         d Z ddlZddl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 g dZ G d de      Z G d d	e      Z G d
 de      Z G d de      Z G d de      Zy)z
    pygments.lexers.algebra
    ~~~~~~~~~~~~~~~~~~~~~~~

    Lexers for computer algebra systems.

    :copyright: Copyright 2006-2023 by the Pygments team, see AUTHORS.
    :license: BSD, see LICENSE for details.
    N)Lexer
RegexLexerbygroupsdo_insertionswords)
TextCommentOperatorKeywordNameStringNumberPunctuationGeneric
Whitespace)GAPLexerGAPConsoleLexerMathematicaLexer
MuPADLexerBCLexerc                       e Zd ZdZdZdZdgZg dZddej                  fde
fd	efd
efdej                  fdej                  fdefdej"                  fdej$                  fdefdefdefgiZd Zy)r   z9
    For GAP source code.

    .. versionadded:: 2.0
    GAPzhttps://www.gap-system.orggap)z*.gz*.gdz*.giz*.gaprootz#.*$"(?:[^"\\]|\\.)*"\(|\)|\[|\]|\{|\}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\.|,|:=|;|=|\+|-|\*|/|\^|>|<z=(?x)\b(?:
                and|or|not|mod|in
              )\bzC(?x)
              (?:\w+|`[^`]*`)
              (?:::\w+|`[^`]*`)*[0-9]+(?:\.[0-9]*)?(?:e[0-9]+)?\.[0-9]+(?:e[0-9]+)?.c                     d}t        j                  d|       r|dz  }t        j                  d|       r|dz  }t        |d      S )N        zl(InstallTrueMethod|Declare(Attribute|Category|Filter|Operation|GlobalFunction|Synonym|SynonymAttr|Property))gffffff?zm(DeclareRepresentation|Install(GlobalFunction|Method|ImmediateMethod|OtherMethod)|New(Family|Type)|Objectify)g      ?)researchmin)textscores     9/usr/lib/python3/dist-packages/pygments/lexers/algebra.pyanalyse_textzGAPLexer.analyse_textH   sV     99>?C
 SLE 99HIM
 SLE5#    N)__name__
__module____qualname____doc__nameurlaliases	filenamesr	   Singler   r   r   r   ConstantBuiltinr
   WordVariabler   r   tokensr(    r)   r'   r   r      s    
 D
&CgG0I 	gnn%!6*!;/  ]] \\	
 -h7 ]]$%)]]4 08$f-4LG$
&FPr)   r   c                   .    e Zd ZdZdZddgZdgZd Zd Zy)	r   z`
    For GAP console sessions. Modeled after JuliaConsoleLexer.

    .. versionadded:: 2.14
    zGAP sessionzgap-consolezgap-replz*.tstc           	   #     K   t        di | j                  }d}d}g }d}d}|j                  d      D ])  }|j                  d      s|j                  d      r>|j	                  t        |      dt        j                  |d d fgf       ||dd  z  }d}d}n|sK|j                  d	      r:|j	                  t        |      dt        j                  |d d
 fgf       ||d
d  z  }nk|r't        ||j                  |            E d {    d}g }|j                  d      s|r|t        j                  |f d}n|t        j                  |f d}|t        |      z  }, |r$t        ||j                  |            E d {    y y 7 7 w)Nr    FT)keependszgap> zbrk>    z>    zError, r8   )r   options
splitlines
startswithappendlenr   Promptr   get_tokens_unprocessedErrorOutput)	selfr%   gaplexerstartcurcode
insertionsoutputerrorlines	            r'   rE   z&GAPConsoleLexer.get_tokens_unprocessedf   s    +dll+
OOTO2 	Dw'4??7+C!!3w<1gnnd2Ah2O1P"QR48# 5!!3w<1gnnd2Ah2O1P"QR48#,"H$C$CG$L N N N G!#J??9-44 E55SYE+	. $H;;GDF F F NFs%   DFFA;FF
F
Fc                 2    t        j                  d|       ryy)Nz^gap> g?r!   )r"   r#   )r%   s    r'   r(   zGAPConsoleLexer.analyse_text   s    
 99Y%r)   N)	r*   r+   r,   r-   r.   r0   r1   rE   r(   r8   r)   r'   r   r   \   s+    
 Dj)G	I!FHr)   r   c                   2   e Zd ZdZdZdZg dZg dZg dZdZ	dZ
d	 Zd
defdej                  fdej                  fdej                  fdefdej"                  fdej"                  fdej$                  f ee	      ef ee
      efdefdej0                  fgiZy)r   zG
    Lexer for Mathematica source code.

    .. versionadded:: 2.0
    Mathematicaz#http://www.wolfram.com/mathematica/)mathematicammanb)z*.nbz*.cdfz*.nbpz*.ma)zapplication/mathematicaz#application/vnd.wolfram.mathematicaz+application/vnd.wolfram.mathematica.packagezapplication/vnd.wolfram.cdf) z;;=z=.z!===z:=z->z:>z/.+-*/^z&&z||!z<>|z/;?@z//z/@z@@z@@@z~~z===&<>z<=z>=),;()[]{}c                 8    ddj                  d | D              z  S )Nz(%s)r]   c              3   F   K   | ]  }t        j                  |        y w)N)r"   escape).0entrys     r'   	<genexpr>z1MathematicaLexer._multi_escape.<locals>.<genexpr>   s     !Hu"))E"2!Hs   !)join)entriess    r'   _multi_escapezMathematicaLexer._multi_escape   s    !H!HHIIr)   r   z(?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-   r.   r/   r0   r1   	mimetypes	operatorspunctuationrs   r	   r   	Namespacer6   r   FloatIntegerr   r
   r   r   r   r   r7   r8   r)   r'   r   r      s    
 D
/C*G2I0II ;KJ 	)($..9,dmm<dmm$'.FLL)FLL)v~~&9x(;-vT__%
Fr)   r   c                      e Zd ZdZdZdZdgZdgZdej                  fdej                  dfd	efd
efdefdej                  fdej                   fdej"                  j$                  fdefdej(                  fdefd eej.                  ee      fdej2                  fdefdefdefdefgdej                  fdej                  dfdej                  dfdej                  fgdZy)r   zv
    A MuPAD lexer.
    Contributed by Christopher Creutzig <christopher@creutzig.de>.

    .. versionadded:: 0.8
    MuPADzhttp://www.mupad.commupadz*.muz//.*?$/\*commentr   r   a  (?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#]*|`[^`]*`)*r   r   rt   r   z[^/*]+z#push\*/#pop[*/]r   r   N)r*   r+   r,   r-   r.   r/   r0   r1   r	   r2   	Multiliner   r   r   r   Classr3   r4   Pseudor
   r5   r   r   Functionr   r6   r   r7   r8   r)   r'   r   r      s^    D
 CiGI 'W&&	2!6*!;/
 

 jj"
 ]] %dll&9&9:=xH ]] 1&9< dmmT;79126--A 08$f-Z 4Lc2
h ))*W&&0W&&/g''(	
i:Fr)   r   c            	           e Zd ZdZdZdZdgZdgZdej                  dfde
fd	ef ed
d      efdefdefdefdefgdej                  fdej                  dfdej                  fgdZy)r   z0
    A BC lexer.

    .. versionadded:: 2.1
    BCz https://www.gnu.org/software/bc/bcz*.bcr~   r   r   z[{}();,])ifelsewhileforbreakcontinuehaltreturndefineautoprintreadlengthscalesqrtlimitsquitwarrantyz\b)suffixz!\+\+|--|\|\||&&|([-<>+*%\^/!=])=?z[0-9]+(\.[0-9]*)?z\.[0-9]+r   z[^*/]+r   r   r   r   N)r*   r+   r,   r-   r.   r/   r0   r1   r	   r   r   r   r   r   r
   r   r   r7   r8   r)   r'   r   r     s    
 D
,CfGI W&&	2!6*+&   )./ 189"#+- "6*&!4L
  ))*W&&/g''(
!Fr)   r   )r-   r"   pygments.lexerr   r   r   r   r   pygments.tokenr   r	   r
   r   r   r   r   r   r   r   __all__r   r   r   r   r   r8   r)   r'   <module>r      so    
 L L- - -Dz DN6e 6r-z -`F FR j  r)   