3 ��X� � @ s� d Z ddlZddlmZmZmZmZmZmZm Z m Z ddlmZm Z ddlmZmZmZmZmZmZmZmZmZ ddlmZ ddlmZ dd gZG d d� de�ZG dd � d e�ZdS )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 Zd ZdZdZddddgZddgZd gZ�dZ�dZ �d Z e�d!�Ze�d"�Z e�d#�Ze�d$�Z�d%�d&�d'�d(�dŜZe�d)�Ze�d*�Z�d�d� Z�d�d� Z�dS (+ 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. ZDelphi�delphiZpas�pascalZobjectpascalz*.pasz*.dprz text/x-pascal�absolute�and�array�asm�begin�break�case�const�constructor�continue� destructor�div�do�downto�else�end�file�for�function�goto�if�implementation�in� inherited�inline� interface�label�mod�nil�not�object�of�on�operator�or�packed� procedure�program�record�reintroduce�repeat�self�set�shl�shr�string�then�to�type�unit�until�uses�var�while�with�xor�as�class�except�exports�finalization�finally�initialization�is�library�property�raise� threadvar�try�dispose�exit�false�new�true�alias�cdecl�export� interrupt�nostackframe�register�safecall� softfloat�stdcall�varargs�name�dynamic�near�virtual�external�override� assembler�abstract�cppdeclr �far�far16�forward�index� oldfpccall�private� protected� published�public�ansichar� ansistring�bool�boolean�byte�bytebool�cardinal�char�comp�currency�double�dword�extended�int64�integer�iunknown�longbool�longint�longword� pansichar�pansistring�pbool�pboolean�pbyte� pbytearray� pcardinal�pchar�pcomp� pcurrency�pdate� pdatetime�pdouble�pdword� pextended�phandle�pint64�pinteger�plongint� plongword�pointer�ppointer� pshortint�pshortstring�psingle� psmallint�pstring�pvariant� pwidechar�pwidestring�pword� pwordarray� pwordbool�real�real48�shortint�shortstring�single�smallint�tclass�tdate� tdatetime�textfile�thandle�tobject�ttime�variant�widechar� widestring�word�wordbool�abs�acquireexceptionobject�addr� ansitoutf8�append�arctan�assert�assigned� assignfile�beginthread� blockread� blockwrite�chdir�chr�close� closefile�comptocurrency�comptodouble�concat�copy�cos�dec�delete�doubletocomp� endthread�enummodules�enumresourcemodules�eof�eoln�erase� exceptaddr�exceptobject�exclude�exp�filepos�filesize�fillchar�finalize�findclasshinstance� findhinstance�findresourcehinstance�flush�frac�freemem� get8087cw�getdir�getlasterror�getmem�getmemorymanager�getmodulefilename�getvariantmanager�halt�hi�high�incr � initialize�insert�int�ioresult�ismemorymanagerset�isvariantmanagerset�length�ln�lo�low�mkdir�move�odd�olestrtostring�olestrtostrvar�ord� paramcount�paramstr�pi�pos�pred�ptr� pucs4chars�random� randomize�read�readln� reallocmem�releaseexceptionobject�rename�reset�rewrite�rmdir�round�runerror�seek�seekeof�seekeoln� set8087cw� setlength�setlinebreakstyle�setmemorymanager� setstring� settextbuf�setvariantmanager�sin�sizeof�slice�sqr�sqrt�str�stringofchar�stringtoolestr�stringtowidechar�succ�swap�trunc�truncate�typeinfo�ucs4stringtowidestring� unicodetoutf8�uniquestring�upcase� utf8decode� utf8encode� utf8toansi� utf8tounicode�val� vararrayredim�varclear�widecharlentostring�widecharlentostrvar�widechartostring�widechartostrvar�widestringtoucs4string�write�writeln�abort�addexitproc�addterminateproc�adjustlinebreaks�allocmem�ansicomparefilename�ansicomparestr�ansicomparetext�ansidequotedstr�ansiextractquotedstr�ansilastchar� ansilowercase�ansilowercasefilename�ansipos� ansiquotedstr�ansisamestr�ansisametext�ansistrcomp�ansistricomp�ansistrlastchar�ansistrlcomp� ansistrlicomp�ansistrlower� ansistrpos�ansistrrscan�ansistrscan�ansistrupper� ansiuppercase�ansiuppercasefilename� appendstr� assignstr�beep� booltostr�bytetocharindex� bytetocharlen�bytetype�callterminateprocs� changefileext� charlength�chartobyteindex� chartobytelen� comparemem� comparestr�comparetext� createdir� createguid�currentyear� currtostr� currtostrf�date�datetimetofiledate� datetimetostr�datetimetostring�datetimetosystemtime�datetimetotimestamp� datetostr� dayofweek� decodedate�decodedatefully� decodetime� deletefile�directoryexists�diskfree�disksize� disposestr� encodedate� encodetime�exceptionerrormessage�excludetrailingbackslash�excludetrailingpathdelimiter�expandfilename�expandfilenamecase�expanduncfilename�extractfiledir�extractfiledrive�extractfileext�extractfilename�extractfilepath�extractrelativepath�extractshortpathname�fileage� fileclose� filecreate�filedatetodatetime� fileexists�filegetattr�filegetdate�fileisreadonly�fileopen�fileread� filesearch�fileseek�filesetattr�filesetdate�filesetreadonly� filewrite�finalizepackage� findclose�findcmdlineswitch� findfirst�findnext�floattocurr�floattodatetime�floattodecimal� floattostr�floattostrf�floattotext�floattotextfmt� fmtloadstr�fmtstr�forcedirectories�format� formatbuf� formatcurr�formatdatetime�formatfloat� freeandnil� getcurrentdir�getenvironmentvariable�getfileversion�getformatsettings�getlocaleformatsettings� getmodulename�getpackagedescription�getpackageinfo�gettime�guidtostring� incamonth�includetrailingbackslash�includetrailingpathdelimiter�incmonth�initializepackage�interlockeddecrement�interlockedexchange�interlockedexchangeadd�interlockedincrement�inttohex�inttostr�isdelimiter�isequalguid� isleapyear�ispathdelimiter�isvalidident� languages� lastdelimiter�loadpackage�loadstr� lowercase�msecstotimestamp�newstr� nextcharindex�now�outofmemoryerror� quotedstr�raiselastoserror�raiselastwin32error� removedir� renamefile�replacedate�replacetime�safeloadlibrary�samefilename�sametext� setcurrentdir� showexception�sleep�stralloc� strbufsize�strbytetype�strcat� strcharlength�strcomp�strcopy� strdispose�strecopy�strend�strfmt�stricomp� stringreplace�stringtoguid�strlcat�strlcomp�strlcopy�strlen�strlfmt� strlicomp�strlower�strmove�strnew�strnextchar�strpas�strpcopy� strplcopy�strpos�strrscan�strscan� strtobool�strtobooldef� strtocurr�strtocurrdef� strtodate�strtodatedef� strtodatetime�strtodatetimedef� strtofloat� strtofloatdef�strtoint� strtoint64� strtoint64def�strtointdef� strtotime�strtotimedef�strupper�supports�syserrormessage�systemtimetodatetime�texttofloat�time�timestamptodatetime�timestamptomsecs� timetostr�trim�trimleft� trimright� tryencodedate� tryencodetime�tryfloattocurr�tryfloattodatetime�trystrtobool�trystrtocurr�trystrtodate�trystrtodatetime� trystrtofloat�trystrtoint� trystrtoint64�trystrtotime� unloadpackage� uppercase�widecomparestr�widecomparetext� widefmtstr� wideformat� wideformatbuf� widelowercase�widesamestr�widesametext� wideuppercase� win32check�wraptext�activateclassgroup�allocatehwnd�bintohex�checksynchronize�collectionsequal�countgenerations�deallocatehwnd� equalrect�extractstrings� findclass�findglobalcomponent�getclass�groupdescendantswith�hextobin� identtoint�initinheritedcomponent� inttoident�invalidpoint�isuniqueglobalcomponentname� linestart�objectbinarytotext�objectresourcetotext�objecttexttobinary�objecttexttoresource�pointsequal�readcomponentres�readcomponentresex�readcomponentresfile�rect� registerclass�registerclassalias�registerclasses�registercomponents�registerintegerconsts�registernoicon�registernonactivex� smallpoint�startclassgroup�teststreamformat�unregisterclass�unregisterclasses�unregisterintegerconsts�unregistermoduleclasses�writecomponentresfile�arccos�arccosh�arccot�arccoth�arccsc�arccsch�arcsec�arcsech�arcsin�arcsinh�arctan2�arctanh�ceil�comparevalue�cosecant�cosh�cot�cotan�coth�csc�csch� cycletodeg�cycletograd� cycletorad� degtocycle� degtograd�degtorad�divmod�doubledecliningbalance�ensurerange�floor�frexp�futurevalue�getexceptionmask�getprecisionmode�getroundmode�gradtocycle� gradtodeg� gradtorad�hypot�inrange�interestpayment�interestrate�internalrateofreturn�intpower� isinfinite�isnan�iszero�ldexp�lnxp1�log10�log2�logn�max�maxintvalue�maxvalue�mean� meanandstddev�min�minintvalue�minvalue�momentskewkurtosis�netpresentvalue�norm�numberofperiods�payment� periodpayment�poly� popnstddev�popnvariance�power�presentvalue� radtocycle�radtodeg� radtograd�randg�randomrange�roundto� samevalue�sec�secant�sech�setexceptionmask�setprecisionmode�setroundmode�sign� simpleroundto�sincos�sinh�slndepreciation�stddev�sum�sumint�sumofsquares�sumsandsquares�syddepreciation�tan�tanh� totalvariance�variance)ZSystemZSysUtilsZClassesZMath�ah�al�ax�bh�bl�bp�bx�ch�cl�cr0�cr1�cr2�cr3�cr4�cs�cx�dh�di�dl�dr0�dr1�dr2�dr3�dr4�dr5�dr6�dr7�ds�dx�eax�ebp�ebx�ecx�edi�edx�es�esi�esp�fs�gs�mm0�mm1�mm2�mm3�mm4�mm5�mm6�mm7�si�sp�ss�st0�st1�st2�st3�st4�st5�st6�st7�xmm0�xmm1�xmm2�xmm3�xmm4�xmm5�xmm6�xmm7�aaa�aad�aam�aas�adc�add�arpl�bound�bsf�bsr�bswap�bt�btc�btr�bts�call�cbw�cdq�clc�cld�cli�clts�cmc�cmova�cmovae�cmovb�cmovbe�cmovc�cmovcxz�cmove�cmovg�cmovge�cmovl�cmovle�cmovna�cmovnae�cmovnb�cmovnbe�cmovnc�cmovne�cmovng�cmovnge�cmovnl�cmovnle�cmovno�cmovnp�cmovns�cmovnz�cmovo�cmovp�cmovpe�cmovpo�cmovs�cmovz�cmp�cmpsb�cmpsd�cmpsw�cmpxchg� cmpxchg486� cmpxchg8b�cpuid�cwd�cwde�daa�das�emms�enter�hlt�ibts�icebp�idiv�imul�insb�insd�insw�int01�int03�int1�int3�into�invd�invlpg�iret�iretd�iretw�ja�jae�jb�jbe�jc�jcxz�je�jecxz�jg�jge�jl�jle�jmp�jna�jnae�jnb�jnbe�jnc�jne�jng�jnge�jnl�jnle�jno�jnp�jns�jnz�jo�jp�jpe�jpo�js�jz�lahf�lar�lcall�lds�lea�leave�les�lfs�lgdt�lgs�lidt�ljmp�lldt�lmsw�loadall� loadall286�lock�lodsb�lodsd�lodsw�loop�loope�loopne�loopnz�loopz�lsl�lss�ltr�mov�movd�movq�movsb�movsd�movsw�movsx�movzx�mul�neg�nop�out�outsb�outsd�outsw�pop�popa�popad�popaw�popf�popfd�popfw�push�pusha�pushad�pushaw�pushf�pushfd�pushfw�rcl�rcr�rdmsr�rdpmc�rdshr�rdtsc�rep�repe�repne�repnz�repz�ret�retf�retn�rol�ror�rsdc�rsldt�rsm�sahf�sal�salc�sar�sbb�scasb�scasd�scasw�seta�setae�setb�setbe�setc�setcxz�sete�setg�setge�setl�setle�setna�setnae�setnb�setnbe�setnc�setne�setng�setnge�setnl�setnle�setno�setnp�setns�setnz�seto�setp�setpe�setpo�sets�setz�sgdt�shld�shrd�sidt�sldt�smi�smint�smintold�smsw�stc�std�sti�stosb�stosd�stosw�sub�svdc�svldt�svts�syscall�sysenter�sysexit�sysret�test�ud1�ud2�umov�verr�verw�wait�wbinvd�wrmsr�wrshr�xadd�xbts�xchg�xlat�xlatbc K s� t j| f|� t� | _t|dd�r0| jj| j� t|dd�rJ| jj| j� t|dd�rd| jj| j� t� | _ x,t |dt| j��D ]}| j j| j| � q�W d S )NZturbopascalTr Z freepascalZunits) r �__init__rE �keywordsr �update�TURBO_PASCAL_KEYWORDS�DELPHI_KEYWORDS�FREE_PASCAL_KEYWORDS�builtinsr �list� BUILTIN_UNITS)rD ZoptionsrL � r0 �/usr/lib/python3.6/pascal.pyr' - s zDelphiLexer.__init__c c s� t |tjtjB tjB �}dg}d}d}d}d}d}d} t� } ddg}�x^|j�s�t}|d, dk�r�|jd�rtt }�qv|jd�r�|j jd�r�tj }ntj}�qv|jd�r�tj}�qv|jd �r�t}| r�|j d kr�d} �qv|jd��rlt}d}|s�|�r�|j dk�r|d d7 <