B
    G
\                 @   s   d Z ddlZddlmZmZmZmZmZmZ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dlmZ ddlmZ dd	gZG d
d deZG dd	 d	eZdS )z
    pygments.lexers.pascal
    ~~~~~~~~~~~~~~~~~~~~~~

    Lexers for Pascal family languages.

    :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
    :license: BSD, see LICENSE for details.
    N)Lexer
RegexLexerincludebygroupswordsusingthisdefault)get_bool_optget_list_opt)	TextCommentOperatorKeywordNameStringNumberPunctuationError)Scanner)Modula2LexerDelphiLexerAdaLexerc               @   s   e Zd ZdZdZddddgZddgZd	gZd
ZdZ	dZ
edZedZedZedZdddddZedZedZdd Zdd ZdS )r   aj  
    For `Delphi <http://www.borland.com/delphi/>`_ (Borland Object Pascal),
    Turbo Pascal and Free Pascal source code.

    Additional options accepted:

    `turbopascal`
        Highlight Turbo Pascal specific keywords (default: ``True``).
    `delphi`
        Highlight Borland Delphi specific keywords (default: ``True``).
    `freepascal`
        Highlight Free Pascal specific keywords (default: ``True``).
    `units`
        A list of units that should be considered builtin, supported are
        ``System``, ``SysUtils``, ``Classes`` and ``Math``.
        Default is to consider all of them builtin.
    ZDelphidelphiZpaspascalZobjectpascalz*.pasz*.dprztext/x-pascal)8absoluteandarrayasmbeginbreakcaseconstconstructorcontinue
destructordivdoZdowntoelseendfileforfunctiongotoifimplementationinZ	inheritedinline	interfacelabelmodZnilnotobjectofonoperatororZpacked	procedureprogramrecordZreintroducerepeatselfsetshlshrstringthentotypeunituntilusesvarwhilewithxor)asclassexceptZexportsfinalizationfinallyinitializationislibraryr8   propertyraise	threadvartry)disposeexitZfalsenewtrue)r   rO   r"   r#   r%   r)   rQ   r,   r/   rS   r3   rU   r9   r;   r<   rV   r=   rX   rF   rG   rI   rJ   )aliasZcdeclZexportr1   Z	interruptZnostackframer   registerZsafecallZ	softfloatZstdcallZvarargsnameZdynamicZnearZvirtualZexternaloverride	assembler)r   abstractrb   Zcppdeclr	   ZfarZfar16ZforwardindexZ
oldfpccallZprivate	protectedZ	publishedZpublic)GZansicharZ
ansistringboolZbooleanZbyteZbyteboolZcardinalcharcompZcurrencyZdoubleZdwordZextendedZint64ZintegerZiunknownZlongboolZlongintZlongwordZ	pansicharZpansistringZpboolZpbooleanZpbyteZ
pbytearrayZ	pcardinalZpcharZpcompZ	pcurrencyZpdateZ	pdatetimeZpdoubleZpdwordZ	pextendedZphandleZpint64ZpintegerZplongintZ	plongwordZpointerZppointerZ	pshortintZpshortstringZpsingleZ	psmallintZpstringZpvariantZ	pwidecharZpwidestringZpwordZ
pwordarrayZ	pwordboolrealZreal48ZshortintZshortstringZsingleZsmallintrC   ZtclassZtdateZ	tdatetimeZtextfileZthandleZtobjectZttimeZvariantZwidecharZ
widestringZwordZwordbool)absZacquireexceptionobjectZaddrZ
ansitoutf8appendZarctanassertassignedZ
assignfileZbeginthreadZ	blockreadZ
blockwriter    chdirchrcloseZ	closefileZcomptocurrencyZcomptodoubleconcatr$   copyZcosdecdeleterZ   ZdoubletocompZ	endthreadZenummodulesZenumresourcemoduleseofZeolnZeraseZ
exceptaddrZexceptobjectZexcluder[   ZexpZfileposZfilesizeZfillcharfinalizeZfindclasshinstanceZfindhinstanceZfindresourcehinstanceflushZfracZfreememZ	get8087cwZgetdirZgetlasterrorZgetmemZgetmemorymanagerZgetmodulefilenameZgetvariantmanagerZhalthiZhighincr   Z
initializeinsertintZioresultZismemorymanagersetZisvariantmanagersetlengthZlnloZlowmkdirZmover\   ZoddZolestrtostringZolestrtostrvarordZ
paramcountZparamstrZpiposZpredZptrZ
pucs4charsZrandomZ	randomizereadZreadlnZ
reallocmemZreleaseexceptionobjectrenameresetZrewritermdirroundZrunerrorseekZseekeofZseekeolnZ	set8087cwZ	setlengthZsetlinebreakstyleZsetmemorymanagerZ	setstringZ
settextbufZsetvariantmanagerZsinZsizeofsliceZsqrZsqrtstrZstringofcharZstringtoolestrZstringtowidecharZsuccZswapZtrunctruncateZtypeinfoZucs4stringtowidestringZunicodetoutf8ZuniquestringZupcaseZ
utf8decodeZ
utf8encodeZ
utf8toansiZutf8tounicodevalZvararrayredimZvarclearZwidecharlentostringZwidecharlentostrvarZwidechartostringZwidechartostrvarZwidestringtoucs4stringwriteZwriteln)abortZaddexitprocZaddterminateprocZadjustlinebreaksZallocmemZansicomparefilenameZansicomparestrZansicomparetextZansidequotedstrZansiextractquotedstrZansilastcharZansilowercaseZansilowercasefilenameZansiposZansiquotedstrZansisamestrZansisametextZansistrcompZansistricompZansistrlastcharZansistrlcompZansistrlicompZansistrlowerZ
ansistrposZansistrrscanZansistrscanZansistrupperZansiuppercaseZansiuppercasefilenameZ	appendstrZ	assignstrZbeepZ	booltostrZbytetocharindexZbytetocharlenZbytetypeZcallterminateprocsZchangefileextZ
charlengthZchartobyteindexZchartobytelenZ
comparememZ
comparestrZcomparetextZ	createdirZ
createguidZcurrentyearZ	currtostrZ
currtostrfZdateZdatetimetofiledateZdatetimetostrZdatetimetostringZdatetimetosystemtimeZdatetimetotimestampZ	datetostrZ	dayofweekZ
decodedateZdecodedatefullyZ
decodetimeZ
deletefileZdirectoryexistsZdiskfreeZdisksizeZ
disposestrZ
encodedateZ
encodetimeZexceptionerrormessageZexcludetrailingbackslashZexcludetrailingpathdelimiterZexpandfilenameZexpandfilenamecaseZexpanduncfilenameZextractfiledirZextractfiledriveZextractfileextZextractfilenameZextractfilepathZextractrelativepathZextractshortpathnameZfileageZ	filecloseZ
filecreateZfiledatetodatetimeZ
fileexistsZfilegetattrZfilegetdateZfileisreadonlyZfileopenZfilereadZ
filesearchZfileseekZfilesetattrZfilesetdateZfilesetreadonlyZ	filewriteZfinalizepackageZ	findcloseZfindcmdlineswitchZ	findfirstZfindnextZfloattocurrZfloattodatetimeZfloattodecimalZ
floattostrZfloattostrfZfloattotextZfloattotextfmtZ
fmtloadstrZfmtstrZforcedirectoriesformatZ	formatbufZ
formatcurrZformatdatetimeZformatfloatZ
freeandnilZgetcurrentdirZgetenvironmentvariableZgetfileversionZgetformatsettingsZgetlocaleformatsettingsgetmodulenameZgetpackagedescriptionZgetpackageinfoZgettimeZguidtostringZ	incamonthZincludetrailingbackslashZincludetrailingpathdelimiterZincmonthZinitializepackageZinterlockeddecrementZinterlockedexchangeZinterlockedexchangeaddZinterlockedincrementZinttohexZinttostrZisdelimiterZisequalguidZ
isleapyearZispathdelimiterZisvalididentZ	languagesZlastdelimiterZloadpackageZloadstrZ	lowercaseZmsecstotimestampZnewstrZnextcharindexZnowZoutofmemoryerrorZ	quotedstrZraiselastoserrorZraiselastwin32errorZ	removedirZ
renamefileZreplacedateZreplacetimeZsafeloadlibraryZsamefilenameZsametextZsetcurrentdirZshowexceptionZsleepZstrallocZ
strbufsizeZstrbytetypeZstrcatZstrcharlengthZstrcompZstrcopyZ
strdisposeZstrecopyZstrendZstrfmtZstricompZstringreplaceZstringtoguidZstrlcatZstrlcompZstrlcopyZstrlenZstrlfmtZ	strlicompZstrlowerZstrmoveZstrnewZstrnextcharZstrpasZstrpcopyZ	strplcopyZstrposZstrrscanZstrscanZ	strtoboolZstrtobooldefZ	strtocurrZstrtocurrdefZ	strtodateZstrtodatedefZstrtodatetimeZstrtodatetimedefZ
strtofloatZstrtofloatdefZstrtointZ
strtoint64Zstrtoint64defZstrtointdefZ	strtotimeZstrtotimedefZstrupperZsupportsZsyserrormessageZsystemtimetodatetimeZtexttofloatZtimeZtimestamptodatetimeZtimestamptomsecsZ	timetostrZtrimZtrimleftZ	trimrightZtryencodedateZtryencodetimeZtryfloattocurrZtryfloattodatetimeZtrystrtoboolZtrystrtocurrZtrystrtodateZtrystrtodatetimeZtrystrtofloatZtrystrtointZtrystrtoint64ZtrystrtotimeZunloadpackageZ	uppercaseZwidecomparestrZwidecomparetextZ
widefmtstrZ
wideformatZwideformatbufZwidelowercaseZwidesamestrZwidesametextZwideuppercaseZ
win32checkZwraptext),ZactivateclassgroupZallocatehwndZbintohexZchecksynchronizeZcollectionsequalZcountgenerationsZdeallocatehwndZ	equalrectZextractstringsZ	findclassZfindglobalcomponentZgetclassZgroupdescendantswithZhextobinZ
identtointZinitinheritedcomponentZ
inttoidentZinvalidpointZisuniqueglobalcomponentnameZ	linestartZobjectbinarytotextZobjectresourcetotextZobjecttexttobinaryZobjecttexttoresourceZpointsequalZreadcomponentresZreadcomponentresexZreadcomponentresfileZrectZregisterclassZregisterclassaliasZregisterclassesZregistercomponentsZregisterintegerconstsZregisternoiconZregisternonactivexZ
smallpointZstartclassgroupZteststreamformatZunregisterclassZunregisterclassesZunregisterintegerconstsZunregistermoduleclassesZwritecomponentresfile)dZarccosZarccoshZarccotZarccothZarccscZarccschZarcsecZarcsechZarcsinZarcsinhZarctan2ZarctanhZceilZcomparevalueZcosecantZcoshZcotZcotanZcothZcscZcschZ
cycletodegZcycletogradZ
cycletoradZ
degtocycleZ	degtogradZdegtoraddivmodZdoubledecliningbalanceZensurerangeZfloorZfrexpZfuturevalueZgetexceptionmaskZgetprecisionmodeZgetroundmodeZgradtocycleZ	gradtodegZ	gradtoradZhypotZinrangeZinterestpaymentZinterestrateZinternalrateofreturnZintpowerZ
isinfiniteZisnanZiszeroZldexpZlnxp1Zlog10Zlog2ZlognmaxZmaxintvalueZmaxvalueZmeanZmeanandstddevminZminintvalueZminvalueZmomentskewkurtosisZnetpresentvalueZnormZnumberofperiodsZpaymentZperiodpaymentZpolyZ
popnstddevZpopnvarianceZpowerZpresentvalueZ
radtocycleZradtodegZ	radtogradZrandgZrandomrangeZroundtoZ	samevalueZsecZsecantZsechZsetexceptionmaskZsetprecisionmodeZsetroundmodeZsignZsimpleroundtoZsincosZsinhZslndepreciationZstddevsumZsumintZsumofsquaresZsumsandsquaresZsyddepreciationZtanZtanhZtotalvarianceZvariance)ZSystemZSysUtilsZClassesZMath)CZahZalZaxZbhZblZbpZbxZchZclZcr0Zcr1Zcr2Zcr3Zcr4ZcsZcxZdhZdiZdlZdr0Zdr1Zdr2Zdr3Zdr4Zdr5Zdr6Zdr7ZdsZdxZeaxZebpZebxZecxZediZedxZesZesiZespZfsZgsZmm0Zmm1Zmm2Zmm3Zmm4Zmm5Zmm6Zmm7ZsiZspZssZst0Zst1Zst2Zst3Zst4Zst5Zst6Zst7Zxmm0Zxmm1Zxmm2Zxmm3Zxmm4Zxmm5Zxmm6Zxmm7(  ZaaaZaadZaamZaasZadcaddr   ZarplZboundZbsfZbsrZbswapZbtZbtcZbtrZbtsZcallZcbwZcdqZclcZcldZcliZcltsZcmcZcmovaZcmovaeZcmovbZcmovbeZcmovcZcmovcxzZcmoveZcmovgZcmovgeZcmovlZcmovleZcmovnaZcmovnaeZcmovnbZcmovnbeZcmovncZcmovneZcmovngZcmovngeZcmovnlZcmovnleZcmovnoZcmovnpZcmovnsZcmovnzZcmovoZcmovpZcmovpeZcmovpoZcmovsZcmovzZcmpZcmpsbZcmpsdZcmpswZcmpxchgZ
cmpxchg486Z	cmpxchg8bZcpuidcwdZcwdeZdaaZdasrs   r&   ZemmsZenterZhltZibtsZicebpZidivimulr0   ry   ZinsbZinsdZinswr{   Zint01Zint03Zint1Zint3ZintoZinvdZinvlpgZiretZiretdZiretwZjaZjaeZjbZjbeZjcjcxzr   ZjeZjecxzZjgZjgeZjlZjleZjmpZjnaZjnaeZjnbZjnbeZjncZjneZjngZjngeZjnlZjnleZjnoZjnpZjnsZjnzZjoZjpZjpeZjpoZjsZjzZlahfZlarZlcallZldsZleaZleaveZlesZlfsZlgdtZlgsZlidtZljmpZlldtZlmswZloadallZ
loadall286lockZlodsbZlodsdZlodswloopZloopeZloopneZloopnzZloopzZlslZlssZltrZmovZmovdZmovqZmovsbZmovsdZmovswZmovsxZmovzxmulnegZnopr5   r:   outZoutsbZoutsdZoutswpopZpopaZpopadZpopawZpopfZpopfdZpopfwpushZpushaZpushadZpushawZpushfZpushfdZpushfwZrclZrcrZrdmsrZrdpmcZrdshrZrdtscZrepZrepeZrepneZrepnzZrepzZretZretfZretnZrolZrorZrsdcZrsldtZrsmZsahfZsalZsalcZsarZsbbZscasbZscasdZscaswZsetaZsetaeZsetbZsetbeZsetcZsetcxzZseteZsetgZsetgeZsetlZsetleZsetnaZsetnaeZsetnbZsetnbeZsetncZsetneZsetngZsetngeZsetnlZsetnleZsetnoZsetnpZsetnsZsetnzZsetoZsetpZsetpeZsetpoZsetsZsetzZsgdtrA   ZshldrB   ZshrdZsidtZsldtZsmiZsmintZsmintoldZsmswZstcZstdZstiZstosbZstosdZstoswr   subZsvdcZsvldtZsvtsZsyscallZsysenterZsysexitZsysrettestZud1Zud2ZumovZverrZverwwaitZwbinvdZwrmsrZwrshrZxaddZxbtsZxchgZxlatZxlatbrM   c             K   s   t j| f| t | _t|ddr0| j| j t|ddrJ| j| j t|ddrd| j| j t | _	x,t
|dt| jD ]}| j	| j|  qW d S )NZturbopascalTr   Z
freepascalZunits)r   __init__r@   keywordsr
   updateTURBO_PASCAL_KEYWORDSDELPHI_KEYWORDSFREE_PASCAL_KEYWORDSbuiltinsr   listBUILTIN_UNITS)r?   ZoptionsrG    r   5lib/python3.7/site-packages/pygments/lexers/pascal.pyr   -  s    zDelphiLexer.__init__c             c   s  t |tjtjB tjB }dg}d}d}d}d}d}d}	t }
ddg}x\|jst}|d dkr|drtt	}qt|dr|j
drtj}ntj}qt|drtj}qt|d	rt}|	r|j
d
krd}	qt|drlt}d}|s|r|j
dkr|d  d7  < nX|j
dkr.|d  d8  < n:|j
dkrL|d  d7  < n|j
dkr|d  d8  < qt|dr&|j
 }|dkrtjj}q|| jkr@t}|s|r|| jkr|d dkr|d dkrd}d}ddg}t }
|dkrd}	n<|dkr|d n&|dkr,d}d}n|dkr$d}d}n|rZ|| jkrZtj}n|rv|dkrvtj}d}n|r|drtj}n
tj}d}n|rtj}d}nv|	rtj}|
 |j
  nX||
krtj}nF|| j!krtj"}n2|| j#krtj}n|s || j$kr tj}nt}n|drBt%}|d nn|drVt%j&}nZ|drjt'j(}nF|dr~t'j)}n2|drt'j*}nt+|dkr|,  |-  n|d dkr|d rt%j.}n<|drt%}|,  n"|d!rt%}n|-  |,  n^|d dkrt|dr8t	}n<|d"rTt}|,  n |dr~|j
drvtj}ntj}n|drtj}n|drt%}|d n|d#rtj}n|dr|j
 }|| j/krt}n|| j0krtj}nt}np|d$rt}n^|dr(t}nL|dr<t'j(}n8|drPt'j)}n$|drdt'j*}n|-  |,  |j
1 r|j
d%k}|j2||j
pd&fV  qHW d S )'NinitialFr   z\s+z\{.*?\}|\(\*.*?\*\)$z//.*?$z[-+*\/=<>:;,.@\^];z[\(\)\[\]]+(   )[]z[A-Za-z_][A-Za-z_0-9]*result)r3   r-   Tr   rV   )r;   r9   r,   r#   r%   )r   r   z\s*\.\s*'rC   z\#(\d+|\$[0-9A-Fa-f]+)z\$[0-9A-Fa-f]+z\d+(?![eE]|\.[^.])z&\d+(\.\d+([eE][+-]?\d+)?|[eE][+-]?\d+)z''z[^']*r)   z@@[A-Za-z_][A-Za-z_0-9]*z[-+*\/=<>:;,.@\^]+. )3r   reDOTALL	MULTILINE
IGNORECASEr@   Zeosr   scanr   match
startswithr   PreprocZ	MultilineSingler   r   lowerr   ZBuiltinZPseudor   r   BLOCK_KEYWORDSrk   FUNCTION_MODIFIERSr   ClassFunctionZPropertyLabelr   BUILTIN_TYPESType
DIRECTIVESr   r   ZCharr   HexIntegerFloatlenr   Zget_charZEscapeASM_INSTRUCTIONSASM_REGISTERSstripZ	start_pos)r?   textscannerstackZin_function_blockZin_property_blockZwas_dotZnext_token_is_functionZnext_token_is_propertyZcollect_labelsZblock_labelsZbrace_balancetokenZlowercase_namer   r   r   get_tokens_unprocessed:  s.   

















z"DelphiLexer.get_tokens_unprocessedN)__name__
__module____qualname____doc__r`   aliases	filenames	mimetypesr   r   r   r@   r   r   r   r   r   r   r   r   r   r   r   r   r   r      s4   !C
(c               @   s  e Zd ZdZdZdddgZdddgZd	gZej	ej
B Zd
efdejfd
efdejdfdeejeejdfdejfdeejefdeejedfdeejeejfdejfedddejfdejfdejfdejdfdejdfdeejedfd eejeeeejfd!ejfd"eejeeeejfed#ddd$ejfd%efed&ed'd(ejfd)eee e!fd*efd+efd,efgd-e"j#fd.e"j$fd/e"j%fgd0eeej&fgd1ed2fd3ed4fd5ejd4fd6ej'fed7gd8ejfd9ej'fd:efd3ed4fgd3ed4fd1ed;fd<ejfdejd=fd>ejd?fd@eejed4fed7gd3ed4fdAeejeejfed7gdBejd4fed7gdCejd4fe(d4gdDed4fdEej)fdFefdGejfed7gdHejfdIejfdJejd4fd3ed4fd1edKfdLej*fed7gdMeej)eefdNefdDed4fed7gdOZ+dPS )Qr   z9
    For Ada source code.

    .. versionadded:: 1.3
    ZAdaZadaZada95Zada2005z*.adbz*.adsz*.adaz
text/x-adaz[^\S\n]+z--.*?\nzfunction|procedure|entry
subprogramz(subtype|type)(\s+)(\w+)type_defztask|protectedz(subtype)(\s+)z
(end)(\s+)r)   z(pragma)(\s+)(\w+)z(true|false|null)\b)ZAddressZByteZBoolean	CharacterZ
ControlledZCountZCursorZDurationZ	File_ModeZ	File_Typer   	Generatorr   Z
Long_FloatZLong_IntegerZLong_Long_FloatZLong_Long_IntegerZNaturalZPositiveZReference_TypeZShort_FloatZShort_IntegerZShort_Short_FloatZShort_Short_Integerr   ZWide_CharacterZWide_Stringz\b)suffixz,(and(\s+then)?|in|mod|not|or(\s+else)|rem)\bzgeneric|privatepackagezarray\b	array_defz(with|use)(\s+)importz(\w+)(\s*)(:)(\s*)(constant)z<<\w+>>z0(\w+)(\s*)(:)(\s*)(declare|begin|loop|for|while))<r   rj   rc   ZacceptaccessZaliasedallr   Zatr   bodyr!   ZconstantZdeclareZdelayZdeltaZdigitsr'   r(   Zelsifr)   entryZ	exceptionr[   r2   r+   r-   r.   rT   Zlimitedr   r\   Znullr7   r:   Zothersr   Z
overridingZpragmare   rW   ranger=   renamesZrequeuereturnreverseZselectZseparateZsubtypeZsynchronizedZtaskZtaggedZ	terminaterD   rF   rH   ZwhenrK   rM   )prefixr   z"[^"]*"	attributenumbersz'[^']'z(\w+)(\s*|[(,])z(<>|=>|:=|[()|:;,.'])z
[*<>+=/&-]z\n+z[0-9_]+#[0-9a-f]+#z[0-9_]+\.[0-9_]*z[0-9_]+z(')(\w+)z\()z#popformal_partr   z#popzis\bz"[^"]+"|\w+rootz(if|case|record|loop|select)z"[^"]+"|[\w.]+z\s+r   zwith|and|use)z#popr   zrecord\b
record_defz(null record)(;)z(\w+)(\s+)(range)z
end recordz[\w.]+z\)z\w+z,|:[^=]z(in|not|null|out|access)\br   zis\s+new|renamesrT   package_instantiationz([\w.]+)z("[^"]+"|\w+)(\s+)(=>)z[\w.\'"])r   r   r   r   r)   r   r   r   r   r   r   r   N),r   r   r   r   r`   r   r   r   r   r   r   flagsr   r   r   r   ZDeclarationr   r   ZReservedr   ZConstantr   r   ZWordZ	Namespacer   r   r   r   r   r   r   r   r   r   r   r   Z	Attributer   r	   ZVariabler   tokensr   r   r   r   r     s   













)r   r   Zpygments.lexerr   r   r   r   r   r   r   r	   Zpygments.utilr
   r   Zpygments.tokenr   r   r   r   r   r   r   r   r   Zpygments.scannerr   Zpygments.lexers.modula2r   __all__r   r   r   r   r   r   <module>
   s   (,   g