o
    xiQ                     @   sr   d Z ddlZddlmZmZ ddl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 dgZG dd deZdS )z
    pygments.lexers.modula2
    ~~~~~~~~~~~~~~~~~~~~~~~

    Multi-Dialect Lexer for Modula-2.

    :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
    :license: BSD, see LICENSE for details.
    N)
RegexLexerinclude)get_bool_optget_list_opt)	TextCommentOperatorKeywordNameStringNumberPunctuationErrorModula2Lexerc                   @   s  e Zd ZdZdZddgZddgZdgZej	ej
B Zdefd	efgd
ejfdejfdejfdejfdejfdejfdejfdejfgdefgdejfdejfgdejfdejfdejfgdejfdejfdejfgdefdefgdefdefdefd efd!efd"efd#efd$efd%efd&efg
d'efd(efd)efd*efd+efd,efd-efd.efd/efg	d0efd1efd2efd3efd4efd5efd6efgd7efd8efd9efgd:ejfd;ejfd<ejfgd=ejfd>ejfged?ed@edAedBedCedDedEedFedGedHedIedJedKgdLZdMZdNZdOZ dPZ!dQZ"dRZ#dSZ$dTZ%dUZ&dVZ'dWZ(dXZ)dYZ*dZZ+d[Z,d\Z-d]Z.d^Z/d_Z0d_Z1d`Z2d_Z3daZ4dbZ5d_Z6d_Z7d_Z8dcZ9ddZ:deZ;dfZ<dgZ=dhZ>diZ?djZ@dkZAd_ZBd_ZCd_ZDd_ZEd_ZFdlZGdmZHdnZIdoZJdpZKdqZLdrZMdsZNd_e!fe%fe)fe-fe%fe!fe%fe%fds	ZOee"e&e*fee"fee&fee*fee*e.fee&e1fee"e4fee&e7fee&e:fds	ZPee#e'e+fee#fee'fee+fee+e/fee'e2fee#e5fee'e8fee'e;fds	ZQe e$e(e,fe e$fe e(fe e,fe e,e0fe e(e3fe e$e6fe e(e9fe e(e<fds	ZRd_d_d_eGfeGfd_d_d_d_ds	ZSd_e=feBfeHeIeGfeHeIfeBfe=feBfeBfds	ZTd_e>feCfeJfeJfeCfe>feCfeCfds	ZUd_e?feDfeKfeKfeDfe?feDfeDfds	ZVd_e@feEfeLfeLfeEfe@feEfeEfds	ZWd_eAfeFfeMfeMfeFfeAfeFfeFfds	ZXdtdu ZYdvdw ZZdxdy Z[dzd{ Z\d|S )}r   a  
    For `Modula-2 <http://www.modula2.org/>`_ source code.

    The Modula-2 lexer supports several dialects.  By default, it operates in
    fallback mode, recognising the *combined* literals, punctuation symbols
    and operators of all supported dialects, and the *combined* reserved words
    and builtins of PIM Modula-2, ISO Modula-2 and Modula-2 R10, while not
    differentiating between library defined identifiers.

    To select a specific dialect, a dialect option may be passed
    or a dialect tag may be embedded into a source file.

    Dialect Options:

    `m2pim`
        Select PIM Modula-2 dialect.
    `m2iso`
        Select ISO Modula-2 dialect.
    `m2r10`
        Select Modula-2 R10 dialect.
    `objm2`
        Select Objective Modula-2 dialect.

    The PIM and ISO dialect options may be qualified with a language extension.

    Language Extensions:

    `+aglet`
        Select Aglet Modula-2 extensions, available with m2iso.
    `+gm2`
        Select GNU Modula-2 extensions, available with m2pim.
    `+p1`
        Select p1 Modula-2 extensions, available with m2iso.
    `+xds`
        Select XDS Modula-2 extensions, available with m2iso.


    Passing a Dialect Option via Unix Commandline Interface

    Dialect options may be passed to the lexer using the `dialect` key.
    Only one such option should be passed. If multiple dialect options are
    passed, the first valid option is used, any subsequent options are ignored.

    Examples:

    `$ pygmentize -O full,dialect=m2iso -f html -o /path/to/output /path/to/input`
        Use ISO dialect to render input to HTML output
    `$ pygmentize -O full,dialect=m2iso+p1 -f rtf -o /path/to/output /path/to/input`
        Use ISO dialect with p1 extensions to render input to RTF output


    Embedding a Dialect Option within a source file

    A dialect option may be embedded in a source file in form of a dialect
    tag, a specially formatted comment that specifies a dialect option.

    Dialect Tag EBNF::

       dialectTag :
           OpeningCommentDelim Prefix dialectOption ClosingCommentDelim ;

       dialectOption :
           'm2pim' | 'm2iso' | 'm2r10' | 'objm2' |
           'm2iso+aglet' | 'm2pim+gm2' | 'm2iso+p1' | 'm2iso+xds' ;

       Prefix : '!' ;

       OpeningCommentDelim : '(*' ;

       ClosingCommentDelim : '*)' ;

    No whitespace is permitted between the tokens of a dialect tag.

    In the event that a source file contains multiple dialect tags, the first
    tag that contains a valid dialect option will be used and any subsequent
    dialect tags will be ignored.  Ideally, a dialect tag should be placed
    at the beginning of a source file.

    An embedded dialect tag overrides a dialect option set via command line.

    Examples:

    ``(*!m2r10*) DEFINITION MODULE Foobar; ...``
        Use Modula2 R10 dialect to render this source file.
    ``(*!m2pim+gm2*) DEFINITION MODULE Bazbam; ...``
        Use PIM dialect with GNU extensions to render this source file.


    Algol Publication Mode:

    In Algol publication mode, source text is rendered for publication of
    algorithms in scientific papers and academic texts, following the format
    of the Revised Algol-60 Language Report.  It is activated by passing
    one of two corresponding styles as an option:

    `algol`
        render reserved words lowercase underline boldface
        and builtins lowercase boldface italic
    `algol_nu`
        render reserved words lowercase boldface (no underlining)
        and builtins lowercase boldface italic

    The lexer automatically performs the required lowercase conversion when
    this mode is activated.

    Example:

    ``$ pygmentize -O full,style=algol -f latex -o /path/to/output /path/to/input``
        Render input file in Algol publication mode to LaTeX output.


    Rendering Mode of First Class ADT Identifiers:

    The rendering of standard library first class ADT identifiers is controlled
    by option flag "treat_stdlib_adts_as_builtins".

    When this option is turned on, standard library ADT identifiers are rendered
    as builtins.  When it is turned off, they are rendered as ordinary library
    identifiers.

    `treat_stdlib_adts_as_builtins` (default: On)

    The option is useful for dialects that support ADTs as first class objects
    and provide ADTs in the standard library that would otherwise be built-in.

    At present, only Modula-2 R10 supports library ADTs as first class objects
    and therefore, no ADT identifiers are defined for any other dialects.

    Example:

    ``$ pygmentize -O full,dialect=m2r10,treat_stdlib_adts_as_builtins=Off ...``
        Render standard library ADTs as ordinary library types.

    .. versionadded:: 1.3

    .. versionchanged:: 2.1
       Added multi-dialect support.
    zModula-2modula2m2z*.defz*.modztext/x-modula2z\n+z\s+z\(\*!m2pim\*\)z\(\*!m2iso\*\)z\(\*!m2r10\*\)z\(\*!objm2\*\)z\(\*!m2iso\+aglet\*\)z\(\*!m2pim\+gm2\*\)z\(\*!m2iso\+p1\*\)z\(\*!m2iso\+xds\*\)z([a-zA-Z_$][\w$]*)z0b[01]+(\'[01]+)*z0[ux][0-9A-F]+(\'[0-9A-F]+)*z>[0-9]+(\'[0-9]+)*\.[0-9]+(\'[0-9]+)*[eE][+-]?[0-9]+(\'[0-9]+)*z$[0-9]+(\'[0-9]+)*\.[0-9]+(\'[0-9]+)*z[0-9]+(\'[0-9]+)*z[0-7]+Bz[0-7]+Cz
[0-9A-F]+Hz'(\\\\|\\'|[^'])*'z"(\\\\|\\"|[^"])*"z\*\.z\+><><=>===::z:=z\+\+--z[+-]z[*/]z\\z[=#<>]z\^@&~`z\.\.<<>>->z\|###z\|\*z[()\[\]{},.:;|]!z\?z^//.*?\nz\(\*([^$].*?)\*\)z/\*(.*?)\*/z	<\*.*?\*>z\(\*\$.*?\*\)
whitespacedialecttagspragmascommentsidentifierssuffixed_number_literalsprefixed_number_literalsplain_number_literalsstring_literalsdigraph_punctuationdigraph_operatorsunigraph_punctuationunigraph_operators)r!   r"   r%   r'   r(   r&   r)   r+   r-   r*   r,   r$   r#   root)%ANDARRAYBEGINBYCASECONST
DEFINITIONDIVDOELSEELSIFENDEXITFORFROMIFIMPLEMENTATIONIMPORTINLOOPMODMODULENOTOFORPOINTER	PROCEDURERECORDREPEATRETURNSETTHENTOTYPEUNTILVARWHILE)ABSBOOLEANCARDINALCHARCHRFALSEINTEGERLONGINTLONGREALMAXMINNILODDORDREALTRUE)ADDRESSBYTEWORDADR)r    r   r   $%?\r   ++r   r   *.+>r   r   r   |#r   )EXPORT	QUALIFIEDWITH)BITSETCAPDECDISPOSEEXCLFLOATHALTHIGHINCINCLNEWr_   PROCSIZETRUNCVAL)SYSTEMPROCESSTSIZE
NEWPROCESSTRANSFER)r   rh   ri   rj   rk   r   rl   r   r   rm   rn   r   r   r   ro   r   )EXCEPTrp   FINALLYFORWARD	PACKEDSETrq   REMRETRYrr   ABSTRACTASCLASSGUARDINHERITOVERRIDEREADONLYREVEALTRACEDUNSAFEGUARDED)rs   rt   CMPLXCOMPLEXru   rv   rw   rx   ry   rz   IMr{   r|   INTINTERRUPTIBLELENGTHLFLOATLONGCOMPLEXr}   r~   
PROTECTIONREr   r   UNINTERRUBTIBLEr   CREATEDESTROYEMPTYISMEMBERSELF):r   
BITSPERLOCLOCSPERBYTELOCSPERWORDLOCADDADRSUBADRDIFADRMAKEADRrg   ROTATESHIFTCASTr   
COROUTINESATTACH	COROUTINECURRENTDETACHHANDLERINTERRUPTSOURCE
IOTRANSFER
IsATTACHEDLISTENNEWCOROUTINEPROTr   
EXCEPTIONSAllocateSourceCurrentNumberExceptionNumberExceptionSource
GetMessageIsCurrentSourceIsExceptionalExecutionRAISETERMINATIONIsTerminating	HasHaltedM2EXCEPTIONM2ExceptionsM2ExceptionIsM2ExceptionindexExceptionrangeExceptioncaseSelectExceptioninvalidLocationfunctionExceptionwholeValueExceptionwholeDivExceptionrealValueExceptionrealDivExceptioncomplexValueExceptioncomplexDivExceptionprotExceptionsysExceptioncoExceptionexException)r    r   r   rh   ri   r   r   )ALIASARGLIST	BLUEPRINTCOPYGENLIBINDETERMINATEr}   NONEOPAQUEREFERENTIALRELEASERETAINASMREG)rV   COUNTr   EXISTSINSERTr   LONGCARDOCTETPTRPREDREADREADNEWREMOVERETRIEVESORTSTORESUBSETSUCCTLIMITTMAXTMINrc   r   UNICHARWRITEWRITEF)KTPROPERTIESPROPERTYLITERAL	TPROPERTYTLITERALTBUILTINTDYNTREFCTNILTBASE
TPRECISIONTMAXEXPTMINEXP
CONVERSIONTSXFSIZESXFr   UNSAFEr   	INTRINSICAVAILADDSUBADDCSUBCFETCHADDFETCHSUBSHLSHRASHRROTLROTRROTLCROTRCBWNOTBWANDBWORBWXORBWNANDBWNORSETBITTESTBITLSBITMSBITCSBITSBAILry   TODOFFIADDRVARGLISTVARGCATOMICr  r  SWAPCASr{   ru   r   r#  r!  r"  COMPILERDEBUGMODNAMEPROCNAMELINENUMDEFAULTHASH	ASSEMBLERREGISTERSETREGGETREGCODE)r    rh   ri   r   r   )BYCOPYBYREFr   CONTINUECRITICALINOUTMETHODONOPTIONALOUTPRIVATE	PROTECTEDPROTOCOLPUBLICSUPERTRY)OBJECTNOYES )	BITSET8BITSET16BITSET32	CARDINAL8
CARDINAL16
CARDINAL32INTEGER8	INTEGER16	INTEGER32)
r   __ATTRIBUTE____BUILTIN__
__COLUMN____DATE____FILE____FUNCTION____LINE__
__MODULE__VOLATILE)rR  rS  rT  rU  rV  rW  
CARDINAL64	COMPLEX32	COMPLEX64	COMPLEX96
COMPLEX128rX  rY  rZ  	INTEGER64REAL8REAL16REAL32REAL96REAL128THROW)BCD)SEQ)	ASHASSERTDIFFADR_TYPEENTIERINDEXLENr   	SHORTCARDSHORTINT)r   r   BOOL8BOOL16BOOL32CARD8CARD16CARD32INT8INT16INT32REFMOVEFILLGETPUTCCintunsignedsize_tvoidCOMPILEROPTIONEQUATION)Terminal
FileSystemInOut	RealInOutMathLib0Storage)FlagFlagSetResponseCommandLock
Permission
MediumTypeFileFileProcDirectoryProcFileCommandDirectoryCommand)9ReadBusyRead	ReadAgainWriteWriteStringWriteLnCreateLookupCloseDeleteRenameSetReadSetWrite	SetModifySetOpenDoioSetPosGetPosLengthResetAgainReadWord	WriteWordReadChar	WriteCharCreateMediumDeleteMedium
AssignNameDeassignName
ReadMediumLookupMedium	OpenInput
OpenOutput
CloseInputCloseOutput
ReadStringReadIntReadCardReadWrdWriteInt	WriteCardWriteOctWriteHexWriteWrdReadReal	WriteReal
WriteFixPtWriteRealOctsqrtexplnsincosarctanentierALLOCATE
DEALLOCATE)DonetermCHinout)EOL)0rp  LONGBCDrs   SHORTBITSET
LONGBITSETLONGLONGBITSETr   r   rx  LONGLONGCARDry  LONGLONGINTPOSINTSHORTPOSINT
LONGPOSINTLONGLONGPOSINTrR  rS  rT  BITSET64	BITSET128BS8BS16BS32BS64BS128rU  rV  rW  rd  CARDINAL128r}  r~  r  CARD64CARD128rX  rY  rZ  ri  
INTEGER128r  r  r  INT64INT128STRING	UNISTRING)	ProtoRootProtoComputationalProtoNumericProtoScalarProtoNonScalarProtoCardinalProtoInteger	ProtoRealProtoComplexProtoVector
ProtoTupleProtoCompArrayProtoCollectionProtoStaticArrayProtoStaticSetProtoStaticString
ProtoArrayProtoStringProtoSetProtoMultiSetProtoDictionaryProtoMultiDictProtoExtensionProtoIOProtoCardMathProtoIntMathProtoRealMath)ASCII	BooleanIOCharIO	UnicharIOOctetIO
CardinalIO
LongCardIO	IntegerIO	LongIntIORealIO
LongRealIOBCDIO	LongBCDIOCardMathLongCardMathIntMathLongIntMathRealMathLongRealMathBCDMathLongBCDMathFileIOr  r  	IOSupport)r  Status)r  r  r   )stdInstdOutstdErr)pitau)	unknownm2pimm2isom2r10objm2zm2iso+agletz	m2pim+gm2zm2iso+p1z	m2iso+xdsc                 K   s   t |dg }|D ]}|| jdd v r| |  nq| d d| _t |dg }d|v s1d|v r5d	| _nd| _t|d
d	| _tj| fi | d S )Ndialect   r0  Fstylealgolalgol_nuTtreat_stdlib_adts_as_builtins)	r   dialectsset_dialectdialect_set_by_tagalgol_publication_moder   r;  r   __init__)selfoptionsr<  dialect_optionstylesrQ  rQ  X/home/ubuntu/.local/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/modula2.pyr@    s    

zModula2Lexer.__init__c                 C   s  || j vrd}n|}t }| j| D ]	}|t| qt }| j| D ]	}|t| q$t }| j| D ]}|t|| q6t }| j| D ]}|t|| qKt }| j| D ]}|t|| q`t }	| j	| D ]}|	t|| qut }
| j
| D ]}|
t|| qt }| j| D ]}|t|| qt }| j| D ]}|t|| qt }| j| D ]}|t|| q|| _|| _|| _|| _|| _|| _|	| _|
| _|| _|| _|| _d S )Nr0  )r<  setlexemes_to_reject_dbupdatereserved_words_dbbuiltins_db
differencepseudo_builtins_dbstdlib_adts_dbstdlib_modules_dbstdlib_types_dbstdlib_procedures_dbstdlib_variables_dbstdlib_constants_dbr5  lexemes_to_rejectreserved_wordsbuiltinspseudo_builtinsadtsmodulestypes
procedures	variables	constants)rA  
dialect_idr5  lexemes_to_reject_setlistreswords_setbuiltins_setpseudo_builtins_setadts_setmodules_set	types_setprocedures_setvariables_setconstants_setrQ  rQ  rE  r=    sX   

zModula2Lexer.set_dialectc           
      C   s   d}d}t |}t |}|}| }t ||| krA||rA||rA||| }tdt | jD ]}	|| j|	 kr>|  S q1dS dS )Nz(*!z*)r6  r0  )len
startswithendswithranger<  )
rA  dialect_tagleft_tag_delimright_tag_delimleft_tag_delim_lenright_tag_delim_lenindicator_startindicator_end	indicatorindexrQ  rQ  rE  get_dialect_from_dialect_tag}  s$   	z)Modula2Lexer.get_dialect_from_dialect_tagc                 c   s   t | |D ]N\}}}| js&|tjkr&| |}|dkr&| | d| _|tu r|| jv r;t	j
}| jr9| }n|| jv rLtj}| jrJ| }n|| jv r]tjj}| jr\| }n|| jv ru| jsitj}ntjj}| jrt| }n|| jv r~tj}n|| jv rtj}n|| jv rtj}n|| jv rtj}n|| jv rtj}n|tv r| jdvrd|v s|dd dv rt}n| jdv r|tj u rt}n|tj!u rd	|v rt}n}|tj"u rd
|v rt}nq|tv r|tj#u r| jdvrt}|tj$u r|%dr| j%drt}nJ|%dr| jdkr| j%dstj&}n3|| j'v r%t}| jrP|dkr1d}n|dkr9d}n|dkrAd}n|dkrId}n|dkrPd}|||fV  qd S )Nr0  T)r0  r3  r4  'r      )0b0x0u)r3  r4  HEz<*r1  z(*$#u   ≠r   u   ≤r   u   ≥r   u   ≡rm   u   •)(r   get_tokens_unprocessedr>  r   Specialrv  r=  r
   rT  r	   Reservedr?  lowerrU  BuiltinrV  PseudorW  r;  	NamespacerX  rY  ClassrZ  Functionr[  Variabler\  Constantr   r5  r   OctHexFloatSinglePreprocrj  	MultilinerS  )rA  textru  tokenvalueindicated_dialectrQ  rQ  rE  r    s   























z#Modula2Lexer.get_tokens_unprocessedN)]__name__
__module____qualname____doc__namealiases	filenames	mimetypesre	MULTILINEDOTALLflagsr   r   r  r
   r   Binr  r  Integerr  r   r   r   r  r  r  r   tokenscommon_reserved_wordscommon_builtinscommon_pseudo_builtinspim_lexemes_to_rejectpim_additional_reserved_wordspim_additional_builtinspim_additional_pseudo_builtinsiso_lexemes_to_rejectiso_additional_reserved_wordsiso_additional_builtinsiso_additional_pseudo_builtinsm2r10_lexemes_to_rejectm2r10_additional_reserved_wordsm2r10_additional_builtins m2r10_additional_pseudo_builtinsobjm2_lexemes_to_rejectobjm2_additional_reserved_wordsobjm2_additional_builtins objm2_additional_pseudo_builtinsaglet_additional_reserved_wordsaglet_additional_builtins aglet_additional_pseudo_builtinsgm2_additional_reserved_wordsgm2_additional_builtinsgm2_additional_pseudo_builtinsp1_additional_reserved_wordsp1_additional_builtinsp1_additional_pseudo_builtinsxds_additional_reserved_wordsxds_additional_builtinsxds_additional_pseudo_builtinspim_stdlib_module_identifierspim_stdlib_type_identifierspim_stdlib_proc_identifierspim_stdlib_var_identifierspim_stdlib_const_identifiersiso_stdlib_module_identifiersiso_stdlib_type_identifiersiso_stdlib_proc_identifiersiso_stdlib_var_identifiersiso_stdlib_const_identifiersm2r10_stdlib_adt_identifiers"m2r10_stdlib_blueprint_identifiersm2r10_stdlib_module_identifiersm2r10_stdlib_type_identifiersm2r10_stdlib_proc_identifiersm2r10_stdlib_var_identifiersm2r10_stdlib_const_identifiersr<  rG  rI  rJ  rL  rM  rN  rO  rP  rQ  rR  r@  r=  rv  r  rQ  rQ  rQ  rE  r      s    

  %

			
		+	C	C	B141111&f0)r  r  pygments.lexerr   r   pygments.utilr   r   pygments.tokenr   r   r   r	   r
   r   r   r   r   __all__r   rQ  rQ  rQ  rE  <module>   s   
,