3

V'ícg…ã@s$dZddlZddlmZmZmZmZmZddlm	Z	m
Z
mZmZm
Z
mZmZmZmZmZmZddlmZmZddlmZmZmZmZddlmZmZmZm Z m!Z!ddlm"Z"d	d
ddd
dddgZ#ej$dƒZ%ej$dƒZ&ej$dej'ƒZ(ej$dej'ƒZ)ej$dƒZ*ej$dƒZ+ej$dej'ƒZ,ej$dej'ƒZ-ej$dƒZ.dd„Z/Gdd„dƒZ0Gdd	„d	e0eƒZ1Gdd
„d
e0eƒZ2Gd d!„d!e0eƒZ3ej$d"ƒZ4ej$d#ƒZ5ej$d$ƒZ6ej$d%ƒZ5ej$d&ƒZ7ej$d'ƒZ8Gd(d)„d)ƒZ9Gd*d„deƒZ:Gd+d„deƒZ;Gd,d
„d
eƒZ<Gd-d„deƒZ=Gd.d„deƒZ>Gd/d„deƒZ?dS)0aš
    pygments.lexers.sql
    ~~~~~~~~~~~~~~~~~~~

    Lexers for various SQL dialects and related interactive sessions.

    Postgres specific lexers:

    `PostgresLexer`
        A SQL lexer for the PostgreSQL dialect. Differences w.r.t. the SQL
        lexer are:

        - keywords and data types list parsed from the PG docs (run the
          `_postgres_builtins` module to update them);
        - Content of $-strings parsed using a specific lexer, e.g. the content
          of a PL/Python function is parsed using the Python lexer;
        - parse PG specific constructs: E-strings, $-strings, U&-strings,
          different operators and punctuation.

    `PlPgsqlLexer`
        A lexer for the PL/pgSQL language. Adds a few specific construct on
        top of the PG SQL lexer (such as <<label>>).

    `PostgresConsoleLexer`
        A lexer to highlight an interactive psql session:

        - identifies the prompt and does its best to detect the end of command
          in multiline statement where not all the lines are prefixed by a
          prompt, telling them apart from the output;
        - highlights errors in the output and notification levels;
        - handles psql backslash commands.

    The ``tests/examplefiles`` contains a few test files with data to be
    parsed by these lexers.

    :copyright: Copyright 2006-2022 by the Pygments team, see AUTHORS.
    :license: BSD, see LICENSE for details.
éN)ÚLexerÚ
RegexLexerÚ
do_insertionsÚbygroupsÚwords)ÚPunctuationÚ
WhitespaceÚTextÚCommentÚOperatorÚKeywordÚNameÚStringÚNumberÚGenericÚLiteral)Úget_lexer_by_nameÚ
ClassNotFound)ÚKEYWORDSÚ	DATATYPESÚPSEUDO_TYPESÚPLPGSQL_KEYWORDS)ÚMYSQL_CONSTANTSÚMYSQL_DATATYPESÚMYSQL_FUNCTIONSÚMYSQL_KEYWORDSÚMYSQL_OPTIMIZER_HINTS)Ú_tsql_builtinsÚ
PostgresLexerÚPlPgsqlLexerÚPostgresConsoleLexerÚSqlLexerÚTransactSqlLexerÚ
MySqlLexerÚSqliteConsoleLexerÚRqlLexerz.*?
z^(?:sqlite|   ...)>(?= )z\s+LANGUAGE\s+'?(\w+)'?z\bDO\bz\[[a-zA-Z_]\w*\]z`[a-zA-Z_]\w*`z\bgo\bz
\bdeclare\s+@z@[a-zA-Z_]\w*\bccsˆd}tj|j|jƒ|jƒd…ƒ}|dk	r>|j|jdƒƒ}n|ttj|jtd|j	ƒdƒ|j	ƒ…ƒƒ}|r‚|j|d
jdƒƒ}n8tt
j|jtd|j	ƒdƒ|j	ƒ…ƒƒ}|rº|jdƒ}|j	dƒt|jdƒfV|j	dƒtj|jdƒfV|j	dƒt|jdƒfV|r"|j
|jd	ƒƒEdHn|j	d	ƒt|jd	ƒfV|j	d
ƒt|jd
ƒfV|j	dƒtj|jdƒfV|j	dƒt|jdƒfVdS)z¼Parse the content of a $-string using a lexer

    The lexer is chosen looking for a nearby LANGUAGE or assumed as
    plpgsql if inside a DO statement and no LANGUAGE has been found.
    NédéréÚplpgsqléééééééÿÿÿÿ)Úlanguage_reÚmatchÚtextÚendÚ
_get_lexerÚgroupÚlistÚfinditerÚmaxÚstartÚdo_rerZ	DelimiterÚget_tokens_unprocessed)Úlexerr2ÚlxÚm©r@ú7/tmp/pip-build-gk9425m9/Pygments/pygments/lexers/sql.pyÚlanguage_callbackNs* $$
rBcs(eZdZdZ‡fdd„Zdd„Z‡ZS)ÚPostgresBasea£Base class for Postgres-related lexers.

    This is implemented as a mixin to avoid the Lexer metaclass kicking in.
    this way the different lexer don't have a common Lexer ancestor. If they
    had, _tokens could be created on this ancestor and not updated for the
    other classes, resulting e.g. in PL/pgSQL parsed as SQL. This shortcoming
    seem to suggest that regexp lexers are not really subclassable.
    c's"||_tƒj|f|žŽEdHdS)N)r3Úsuperr<)Úselfr3Úargs)Ú	__class__r@rAr<{sz#PostgresBase.get_tokens_unprocessedcCs¶|jƒdkrtd|jŽS|g}|jdƒr:|j|dd…ƒ|jdƒrV|j|dd…ƒ|jdƒr||jdƒr||j|dd	…ƒx4|D](}yt|f|jŽStk
r¨Yq‚Xq‚WdSdS)
NÚsqlÚ
postgresqlÚplr*Úur')rIr0r0)ÚlowerrÚoptionsÚ
startswithÚappendÚendswithr)rEÚlangÚtriesr>r@r@rAr5€s



zPostgresBase._get_lexer)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r<r5Ú
__classcell__r@r@)rGrArCrsrCc@s:eZdZdZdZddgZdgZejZ	de
fdejfdej
d	fd
djdd
„eeDƒƒdejfeeddefdefdefdejfdejfdejfdeejejƒdfdeejejƒdfdefdefdejfdefgdej
d	fdej
dfd ej
fd!ej
fgd"ejfd#ejfd$ejdfgd%ejfd&ejfd'ejdfgd(œZ d)S)*rzM
    Lexer for the PostgreSQL dialect of SQL.

    .. versionadded:: 1.5
    zPostgreSQL SQL dialectrIZpostgresztext/x-postgresqlz\s+z--.*\n?z/\*zmultiline-commentsú(ú|ccs|]}|jddƒVqdS)ú z\s+N)Úreplace)Ú.0Úsr@r@rAú	<genexpr>¨szPostgresLexer.<genexpr>z)\bz\b)Úsuffixz[+*/<>=~!@#%^&|`?-]+z::z\$\d+z&([0-9]*\.[0-9]*|[0-9]+)(e[+-]?[0-9]+)?z[0-9]+z((?:E|U&)?)(')Ústringz((?:U&)?)(")zquoted-identz$(?s)(\$)([^$]*)(\$)(.*?)(\$)(\2)(\$)z	[a-z_]\w*z:(['"]?)[a-z]\w*\b\1z[;:()\[\]{},.]z\*/z#popz[^/*]+z[/*]z[^']+z''ú'z[^"]+z""ú")Úrootzmultiline-commentsr`zquoted-identN)!rSrTrUrVÚnameÚaliasesÚ	mimetypesÚreÚ
IGNORECASEÚflagsrr
ÚSingleÚ	MultilineÚjoinrrr
ÚBuiltinrrrrÚVariablerÚFloatÚIntegerrrZAffixrBrÚtokensr@r@r@rAr—s@



c@sºeZdZdZdZdgZdgZejZ	dd„e
jjƒDƒZxPe
edƒD]4\ZZedekrDeeed	d
efede<[PqDWdsˆtdƒ‚d
ejfdefdejfdejfgeddd…<dS)rzR
    Handle the extra syntax in Pl/pgSQL language.

    .. versionadded:: 1.5
    zPL/pgSQLr)ztext/x-plpgsqlcCsi|]\}}|dd…|“qS)Nr@)r\ÚkÚlr@r@rAú
<dictcomp>ÚszPlPgsqlLexer.<dictcomp>rcr'z\b)r_rzSQL keywords not foundz\%[a-z]\w*\bz:=z\<\<[a-z]\w*\>\>z\#[a-z]\w*\bN)rSrTrUrVrdrerfrgrhrirrqÚitemsÚ	enumerateÚiÚpatternrrrrÚAssertionErrorr
rmrÚLabelÚPseudor@r@r@rArÏs"c@s†eZdZdZdZgZejZdd„e	j
jƒDƒZ
e
djde
jdfƒdedfd	efde
jfd
ejfdejfdejfd
ejfge
d<dS)ÚPsqlRegexLexerz­
    Extend the PostgresLexer adding support specific for psql commands.

    This is not a complete psql lexer yet as it lacks prompt support
    and output rendering.
    z'PostgreSQL console - regexp based lexercCsi|]\}}|dd…|“qS)Nr@)r\rrrsr@r@rArtüszPsqlRegexLexer.<dictcomp>rcz\\[^\s]+zpsql-commandz\nz\s+z:(['"]?)[a-z]\w*\b\1z'(''|[^'])*'z	`([^`])*`z[^\s]+N)rSrTrUrVrdrergrhrirrqrurOrr{r	rr
rnrrjZBacktickÚSymbolr@r@r@rAr|ðsr|z^(\S.*?)??[=\-\(\$\'\"][#>]z\s*\\z
;\s*(--.*?)?$z(\s*)(\\.+?)(\s+)$z(ERROR|FATAL):zS((?:DEBUG|INFO|NOTICE|WARNING|ERROR|FATAL|HINT|DETAIL|CONTEXT|LINE [0-9]+):)(.*?\n)c@s4eZdZdZdd„Zdd„Zdd„Zdd	„ZeZd
S)Ú	lookaheadz0Wrap an iterator and allow pushing back an item.cCst|ƒ|_d|_dS)N)ÚiterÚ	_nextitem)rEÚxr@r@rAÚ__init__s
zlookahead.__init__cCs|S)Nr@)rEr@r@rAÚ__iter__szlookahead.__iter__cCs
||_|S)N)r€)rErwr@r@rAÚsendszlookahead.sendcCs$|jdk	r|j}d|_|St|jƒS)N)r€Únextr)rEÚnir@r@rAÚ__next__"s

zlookahead.__next__N)	rSrTrUrVr‚rƒr„r‡r…r@r@r@rAr~sr~c@s,eZdZdZdZdddgZdgZdd„Zd	S)
r z=
    Lexer for psql sessions.

    .. versionadded:: 1.5
    zPostgreSQL console (psql)Zpsqlzpostgresql-consolezpostgres-consoleztext/x-postgresql-psqlccs tf|jŽ}ttj|ƒƒ}x~d}g}x¤|D]œ}|jdƒr^|r^td	|jŽ}|j|ƒEdHPtj	|ƒ}|dk	rª|j
t|ƒdtj
|jƒfgfƒ||t|jƒƒd…7}n||7}tj	|ƒsÆtj|ƒr,Pq,Wt||j|ƒƒEdHtj}	x®|D]¢}tj	|ƒ}|dk	r|j|ƒPtj	|ƒ}
|
dk	r„|
jdƒjdƒsJ|
jdƒjdƒrPtj}	|
jdƒtj|
jdƒfV|
jdƒ|	|
jdƒfVqîd|	|fVqîWdSqWdS)
NÚú$Úconsolerr'ÚERRORÚFATALr*)rŠ)r|rMr~Úline_reÚfindallrNrr<Ú	re_promptr2rOÚlenrÚPromptr6Úre_psql_commandÚre_end_commandÚsearchrÚOutputr„Ú
re_messageÚErrorr:ZStrong)rEÚdatarHÚlinesÚcurcodeÚ
insertionsÚliner=ZmpromptZ	out_tokenZmmsgr@r@rAr<6sH










z+PostgresConsoleLexer.get_tokens_unprocessedN)rSrTrUrVrdrerfr<r@r@r@rAr +s

cý@sêeZdZdZdZdgZdgZdgZej	Z
defdej
fdejd	fed+ddefed,ddejfdefdejfdej
fd ejfd!efd"efgdejd	fd#ejd$fd%ejfd&ejfgd'œZd(d)„Zd*S(-r!z
    Lexer for Structured Query Language. Currently, this lexer does
    not recognize any special syntax except ANSI SQL.
    ÚSQLrHz*.sqlz
text/x-sqlz\s+z--.*\n?z/\*zmultiline-commentsÚABORTÚABSÚABSOLUTEÚACCESSÚADAÚADDÚADMINÚAFTERÚ	AGGREGATEÚALIASÚALLÚALLOCATEÚALTERÚANALYSEÚANALYZEÚANDÚANYÚAREÚASÚASCÚ
ASENSITIVEÚ	ASSERTIONÚ
ASSIGNMENTÚ
ASYMMETRICÚATÚATOMICÚ
AUTHORIZATIONÚAVGÚBACKWARDÚBEFOREÚBEGINÚBETWEENÚBITVARÚ
BIT_LENGTHÚBOTHÚBREADTHÚBYÚCÚCACHEÚCALLÚCALLEDÚCARDINALITYÚCASCADEÚCASCADEDÚCASEÚCASTÚCATALOGÚCATALOG_NAMEÚCHAINÚCHARACTERISTICSÚCHARACTER_LENGTHÚCHARACTER_SET_CATALOGÚCHARACTER_SET_NAMEÚCHARACTER_SET_SCHEMAÚCHAR_LENGTHÚCHECKÚCHECKEDÚ
CHECKPOINTÚCLASSÚCLASS_ORIGINÚCLOBÚCLOSEÚCLUSTERÚCOALESCEÚCOBOLÚCOLLATEÚ	COLLATIONÚCOLLATION_CATALOGÚCOLLATION_NAMEÚCOLLATION_SCHEMAÚCOLUMNÚCOLUMN_NAMEÚCOMMAND_FUNCTIONÚCOMMAND_FUNCTION_CODEÚCOMMENTÚCOMMITÚ	COMMITTEDÚ
COMPLETIONÚCONDITION_NUMBERÚCONNECTÚ
CONNECTIONÚCONNECTION_NAMEÚ
CONSTRAINTÚCONSTRAINTSÚCONSTRAINT_CATALOGÚCONSTRAINT_NAMEÚCONSTRAINT_SCHEMAÚCONSTRUCTORÚCONTAINSÚCONTINUEÚ
CONVERSIONÚCONVERTÚCOPYÚ
CORRESPONDINGÚCOUNTÚCREATEÚCREATEDBÚ
CREATEUSERÚCROSSÚCUBEÚCURRENTÚCURRENT_DATEÚCURRENT_PATHÚCURRENT_ROLEÚCURRENT_TIMEÚCURRENT_TIMESTAMPÚCURRENT_USERÚCURSORÚCURSOR_NAMEÚCYCLEÚDATAÚDATABASEÚDATETIME_INTERVAL_CODEÚDATETIME_INTERVAL_PRECISIONÚDAYÚ
DEALLOCATEÚDECLAREÚDEFAULTÚDEFAULTSÚ
DEFERRABLEÚDEFERREDÚDEFINEDÚDEFINERÚDELETEÚ	DELIMITERÚ
DELIMITERSÚDEREFÚDESCÚDESCRIBEÚ
DESCRIPTORÚDESTROYÚ
DESTRUCTORÚ
DETERMINISTICÚDIAGNOSTICSÚ
DICTIONARYÚ
DISCONNECTÚDISPATCHÚDISTINCTÚDOÚDOMAINÚDROPÚDYNAMICÚDYNAMIC_FUNCTIONÚDYNAMIC_FUNCTION_CODEÚEACHÚELSEÚELSIFÚENCODINGÚ	ENCRYPTEDÚENDúEND-EXECÚEQUALSÚESCAPEÚEVERYÚ	EXCEPTIONÚEXCEPTÚ	EXCLUDINGÚ	EXCLUSIVEÚEXECÚEXECUTEÚEXISTINGÚEXISTSÚEXPLAINÚEXTERNALÚEXTRACTÚFALSEÚFETCHÚFINALÚFIRSTÚFORÚFORCEÚFOREIGNÚFORTRANÚFORWARDÚFOUNDÚFREEÚFREEZEÚFROMÚFULLÚFUNCTIONÚGÚGENERALÚ	GENERATEDÚGETÚGLOBALÚGOÚGOTOÚGRANTÚGRANTEDÚGROUPÚGROUPINGÚHANDLERÚHAVINGÚ	HIERARCHYÚHOLDÚHOSTÚIDENTITYÚIFÚIGNOREÚILIKEÚ	IMMEDIATEÚIMMEDIATELYÚ	IMMUTABLEÚIMPLEMENTATIONÚIMPLICITÚINÚ	INCLUDINGÚ	INCREMENTÚINDEXÚ
INDITCATORÚINFIXÚINHERITSÚ
INITIALIZEÚ	INITIALLYÚINNERÚINOUTÚINPUTÚINSENSITIVEÚINSERTÚINSTANTIABLEÚINSTEADÚ	INTERSECTÚINTOÚINVOKERÚISÚISNULLÚ	ISOLATIONÚITERATEÚJOINÚKEYÚ
KEY_MEMBERÚKEY_TYPEÚLANCOMPILERÚLANGUAGEÚLARGEÚLASTÚLATERALÚLEADINGÚLEFTÚLENGTHÚLESSÚLEVELÚLIKEÚLIMITÚLISTENÚLOADÚLOCALÚ	LOCALTIMEÚLOCALTIMESTAMPÚLOCATIONÚLOCATORÚLOCKÚLOWERÚMAPÚMATCHÚMAXÚMAXVALUEÚMESSAGE_LENGTHÚMESSAGE_OCTET_LENGTHÚMESSAGE_TEXTÚMETHODÚMINÚMINUTEÚMINVALUEÚMODÚMODEÚMODIFIESÚMODIFYÚMONTHÚMOREÚMOVEÚMUMPSÚNAMESÚNATIONALÚNATURALÚNCHARÚNCLOBÚNEWÚNEXTÚNOÚ
NOCREATEDBÚNOCREATEUSERÚNONEÚNOTÚNOTHINGÚNOTIFYÚNOTNULLÚNULLÚNULLABLEÚNULLIFÚOBJECTÚOCTET_LENGTHÚOFÚOFFÚOFFSETÚOIDSÚOLDÚONÚONLYÚOPENÚ	OPERATIONÚOPERATORÚOPTIONÚOPTIONSÚORÚORDERÚ
ORDINALITYÚOUTÚOUTERÚOUTPUTÚOVERLAPSÚOVERLAYÚ
OVERRIDINGÚOWNERÚPADÚ	PARAMETERÚ
PARAMETERSÚPARAMETER_MODEÚPARAMETER_NAMEÚPARAMETER_ORDINAL_POSITIONÚPARAMETER_SPECIFIC_CATALOGÚPARAMETER_SPECIFIC_NAMEÚPARAMETER_SPECIFIC_SCHEMAÚPARTIALÚPASCALÚPENDANTÚPERIODÚPLACINGÚPLIÚPOSITIONÚPOSTFIXÚPRECEEDSÚ	PRECISIONÚPREFIXÚPREORDERÚPREPAREÚPRESERVEÚPRIMARYÚPRIORÚ
PRIVILEGESÚ
PROCEDURALÚ	PROCEDUREÚPUBLICÚREADÚREADSÚRECHECKÚ	RECURSIVEÚREFÚ
REFERENCESÚREFERENCINGÚREINDEXÚRELATIVEÚRENAMEÚ
REPEATABLEÚREPLACEÚRESETÚRESTARTÚRESTRICTÚRESULTÚRETURNÚRETURNED_LENGTHÚRETURNED_OCTET_LENGTHÚRETURNED_SQLSTATEÚRETURNSÚREVOKEÚRIGHTÚROLEÚROLLBACKÚROLLUPÚROUTINEÚROUTINE_CATALOGÚROUTINE_NAMEÚROUTINE_SCHEMAÚROWÚROWSÚ	ROW_COUNTÚRULEÚ
SAVE_POINTÚSCALEÚSCHEMAÚSCHEMA_NAMEÚSCOPEÚSCROLLÚSEARCHÚSECONDÚSECURITYÚSELECTÚSELFÚ	SENSITIVEÚSERIALIZABLEÚSERVER_NAMEÚSESSIONÚSESSION_USERÚSETÚSETOFÚSETSÚSHAREÚSHOWÚSIMILARÚSIMPLEÚSIZEÚSOMEÚSOURCEÚSPACEÚSPECIFICÚSPECIFICTYPEÚ
SPECIFIC_NAMEÚSQLCODEÚSQLERRORÚSQLEXCEPTIONÚSQLSTATEÚSQLWARNINIGÚSTABLEÚSTARTÚSTATEÚ	STATEMENTÚSTATICÚ
STATISTICSÚSTDINÚSTDOUTÚSTORAGEÚSTRICTÚ	STRUCTUREÚSTYPEÚSUBCLASS_ORIGINÚSUBLISTÚ	SUBSTRINGÚSUCCEEDSÚSUMÚ	SYMMETRICÚSYSIDÚSYSTEMÚSYSTEM_USERÚTABLEÚ
TABLE_NAMEú TEMPÚTEMPLATEÚ	TEMPORARYÚ	TERMINATEÚTHANÚTHENÚTIMEÚ	TIMESTAMPÚ
TIMEZONE_HOURÚTIMEZONE_MINUTEÚTOÚTOASTÚTRAILINGÚTRANSACTIONÚTRANSACTIONS_COMMITTEDÚTRANSACTIONS_ROLLED_BACKÚTRANSACTION_ACTIVEÚ	TRANSFORMÚ
TRANSFORMSÚ	TRANSLATEÚTRANSLATIONÚTREATÚTRIGGERÚTRIGGER_CATALOGÚTRIGGER_NAMEÚTRIGGER_SCHEMAÚTRIMÚTRUEÚTRUNCATEÚTRUSTEDÚTYPEÚUNCOMMITTEDÚUNDERÚUNENCRYPTEDÚUNIONÚUNIQUEÚUNKNOWNÚUNLISTENÚUNNAMEDÚUNNESTÚUNTILÚUPDATEÚUPPERÚUSAGEÚUSERÚUSER_DEFINED_TYPE_CATALOGÚUSER_DEFINED_TYPE_NAMEÚUSER_DEFINED_TYPE_SCHEMAÚUSINGÚVACUUMÚVALIDÚ	VALIDATORÚVALUESÚVARIABLEÚVERBOSEÚVERSIONÚVERSIONSÚ
VERSIONINGÚVIEWÚVOLATILEÚWHENÚWHENEVERÚWHEREÚWITHÚWITHOUTÚWORKÚWRITEÚYEARÚZONEz\b)r_ÚARRAYÚBIGINTÚBINARYÚBITÚBLOBÚBOOLEANÚCHARÚ	CHARACTERÚDATEÚDECÚDECIMALÚFLOATÚINTÚINTEGERÚINTERVALÚNUMBERÚNUMERICÚREALÚSERIALÚSMALLINTÚVARCHARÚVARYINGÚINT8ÚSERIAL8ÚTEXTz[+*/<>=~!@#%^&|`?-]z[0-9]+z'(''|[^'])*'z"(""|[^"])*"z[a-z_][\w$]*z[;:()\[\],.]z\*/z#popz[^/*]+z[/*])rczmultiline-commentscCsdS)Nr@)rEr3r@r@rAÚanalyse_textószSqlLexer.analyse_textN(ùržrŸr r¡r¢r£r¤r¥r¦r§r¨r©rªr«r¬r­r®r¯r°r±r²r³r´rµr¶r·r¸r¹rºr»r¼r½r¾r¿rÀrÁrÂrÃrÄrÅrÆrÇrÈrÉrÊrËrÌrÍrÎrÏrÐrÑrÒrÓrÔrÕrÖr×rØrÙrÚrÛrÜrÝrÞrßràrárârãrärårærçrèrérêrërìrírîrïrðrñròrórôrõrör÷rørùrúrûrürýrþrÿrrrrrrrrrr	r
rrr
rrrrrrrrrrrrrrrrrrr r!r"r#r$r%r&r'r(r)r*r+r,r-r.r/r0r1r2r3r4r5r6r7r8r9r:r;r<r=r>r?r@rArBrCrDrErFrGrHrIrJrKrLrMrNrOrPrQrRrSrTrUrVrWrXrYrZr[r\r]r^r_r`rarbrcrdrerfrgrhrirjrkrlrmrnrorprqrrrsrtrurvrwrxryrzr{r|r}r~rr€rr‚rƒr„r…r†r‡rˆr‰rŠr‹rŒrrŽrrr‘r’r“r”r•r–r—r˜r™ršr›rœrržrŸr r¡r¢r£r¤r¥r¦r§r¨r©rªr«r¬r­r®r¯r°r±r²r³r´rµr¶r·r¸r¹rºr»r¼r½r¾r¿rÀrÁrÂrÃrÄrÅrÆrÇrÈrÉrÊrËrÌrÍrÎrÏrÐrÑrÒrÓrÔrÕrÖr×rØrÙrÚrÛrÜrÝrÞrßràrárârãrärårærçrèrérêrërìrírîrïrðrñròrórôrõrör÷rørùrúrûrürýrþrÿrrrrrrrrrr	r
rrr
rrrrrrrrrrrrrrrrrrr r!r"r#r$r%r&r'r(r)r*r+r,r-r.r/r0r1r2r3r4rr5r6r7r8r9r:r;r<r=r>r?r@rArBrCrDrErFrGrHrIrJrKrLrMrNrOrPrQrRrSrTrUrVrWrXrYrZr[r\r]r^r_r`rarbrcrdrerfrgrhrirjrkrlrmrnrorprqrrrsrtrurvrwrxryrzr{r|r}r~rr€rr‚rƒr„r…r†r‡rˆr‰rŠr‹rŒrrŽrrr‘r’r“r”r•)r–r—r˜r™ršr›rœrržrŸr r¡r¢r£r¤r¥r¦r§r¨r©rªr«r¬r­r®)rSrTrUrVrdreÚ	filenamesrfrgrhrirr
rjrkrrr
rmrrrprr}rrqr¯r@r@r@rAr!ssæ






c@sXeZdZdZdZddgZdgZdgZej	Z
defdej
fd	ejd
feejƒefeejddejfeejddejfeejddejfd
eeeejƒfeejddefdeeeeƒfdejfdej fdej fdej fdej!fde"j
fde"j#fde$fdej%fdej&fdeeje$ƒfdefdej&j'fgd	ejd
fdejdfdejfdejfgd œZ(d!d"„Z)d#S)$r"z«
    Transact-SQL (T-SQL) is Microsoft's and Sybase's proprietary extension to
    SQL.

    The list of keywords includes ODBC and keywords reserved for future use..
    zTransact-SQLZtsqlzt-sqlz*.sqlztext/x-tsqlz\s+z	--.*?$\n?z/\*zmultiline-commentsz\b)r_z(goto)(\s+)(\w+\b)z(\[)([^]]+)(\])z0x[0-9a-f]+z[0-9]+\.[0-9]*(e[+-]?[0-9]+)?z\.[0-9]+(e[+-]?[0-9]+)?z[0-9]+e[+-]?[0-9]+z[0-9]+z'(''|[^'])*'z"(""|[^"])*"z[;(),.]z@@\w+z@\w+z(\w+)(:)z#?#?\w+z\?z\*/z#popz[^/*]+z[/*])rczmultiline-commentscCs¨d}tj|ƒrd}nttj|ƒƒ}ttj|ƒƒ}||}|dkrV|d|krV|d7}n"||krh|d7}n|dkrx|d7}tj|ƒdk	rŽ|d7}tj|ƒdk	r¤|d7}|S)Nrgð?r'r*gà?gš™™™™™É?gš™™™™™¹?)Útsql_declare_rer”rÚname_between_backtick_rerŽÚname_between_bracket_reÚtsql_variable_reÚ
tsql_go_re)r3ÚratingÚname_between_backtick_countÚname_between_bracket_countÚdialect_name_countr@r@rAr¯.s(


zTransactSqlLexer.analyse_textN)*rSrTrUrVrdrer°rfrgrhrirr
rjrkrrZ	OPERATORSrZOPERATOR_WORDSÚWordÚTYPESr
ZClassZ	FUNCTIONSÚFunctionrrrzrrÚHexrorprr}rrmrnZMagicrqr¯r@r@r@rAr"÷sD


c"@s‚eZdZdZdZdgZdgZejZ	de
fdejfdej
dfd	ejd
fdejfdejfd
ejfdejfdejfdejfdejfdejfdejfdejfdejfdejdfdejdfdejfdejfdejdfdejdfd ejd!fd"ejfd#efd$efd%eee
eƒfeed&d&d'ejfee d&d&d'ej!fee"d&d&d'efee#d&d(d'eej$e
e%ƒfd)efd*ej&d+fd,e%fg!d-ej
fd.ej
d/fee'd&d0ej(fd1ej
fd2ej
fgd3ejfd.ejd/fd2ejfgd4ejfd5ej)fd6ej)fdejd/fgd7ejfd8ej)fd6ej)fdejd/fgd9ejfd5ejfdejd/fgd:ejfd8ejfdejd/fgd;ejfd<ejfd*ejd/fgd;ej&fd<ej&j)fd*ej&d/fgd=œ	Z*d>d?„Z+d@S)Ar#a5The Oracle MySQL lexer.

    This lexer does not attempt to maintain strict compatibility with
    MariaDB syntax or keywords. Although MySQL and MariaDB's common code
    history suggests there may be significant overlap between the two,
    compatibility between the two is not a target for this lexer.
    ZMySQLZmysqlztext/x-mysqlz\s+z
(?:#|--\s+).*z/\*\+zoptimizer-hintsz/\*zmultiline-commentzx'([0-9a-f]{2})+'z0x[0-9a-f]+zb'[01]+'z0b[01]+z[0-9]+\.[0-9]*(e[+-]?[0-9]+)?z[0-9]*\.[0-9]+(e[+-]?[0-9]+)?z[0-9]+e[+-]?[0-9]+z"[0-9]+(?=[^0-9a-z$_\u0080-\uffff])zI\{\s*d\s*(?P<quote>['\"])\s*\d{2}(\d{2})?.?\d{2}.?\d{2}\s*(?P=quote)\s*\}zZ\{\s*t\s*(?P<quote>['\"])\s*(?:\d+\s+)?\d{1,2}.?\d{1,2}.?\d{1,2}(\.\d*)?\s*(?P=quote)\s*\}zp\{\s*ts\s*(?P<quote>['\"])\s*\d{2}(?:\d{2})?.?\d{2}.?\d{2}\s+\d{1,2}.?\d{1,2}.?\d{1,2}(\.\d*)?\s*(?P=quote)\s*\}razsingle-quoted-stringrbzdouble-quoted-stringz9@@(?:global\.|persist\.|persist_only\.|session\.)?[a-z_]+z
@[a-z0-9_$.]+z@'zsingle-quoted-variablez@"zdouble-quoted-variablez@`zbacktick-quoted-variablez\?z[!%&*+/:<=>^|~-]+z\b(set)(?!\s*\()z\b(character)(\s+)(set)\bz\b)Úprefixr_z\b(\s*)(\()u[0-9a-z$_€-ï¿¿]+ú`zschema-object-namez[(),.;]z[^*a-z]+z\*/z#pop)r_z[a-z]+z\*z[^*]+z[^'\\]+z''z\\[0'"bnrtZ\\%_]z[^"\\]+z""z[^']+z[^"]+z[^`]+z``)	rczoptimizer-hintszmultiline-commentzsingle-quoted-stringzdouble-quoted-stringzsingle-quoted-variablezdouble-quoted-variablezbacktick-quoted-variablezschema-object-namecCsld}ttj|ƒƒ}ttj|ƒƒ}||}|dkrF|d|krF|d7}n"||krX|d7}n|dkrh|d7}|S)Nrr'r*gà?gš™™™™™É?gš™™™™™¹?)rr²rŽr³)r3r¶r·r¸r¹r@r@rAr¯ïs

zMySqlLexer.analyse_textN),rSrTrUrVrdrerfrgrhrirr
rjÚSpecialrkrr½ZBinrorprÚDaterÚDoubler
rnrrrrrÚConstantrÚTyperrr¼rZQuotedrZPreprocZEscaperqr¯r@r@r@rAr#KsŽ












c@s.eZdZdZdZdgZdgZdgZdd„ZdS)	r$zO
    Lexer for example sessions using sqlite3.

    .. versionadded:: 0.11
    Z
sqlite3conZsqlite3z*.sqlite3-consoleztext/x-sqlite3-consoleccstf|jŽ}d}g}xÎtj|ƒD]À}|jƒ}tj|ƒ}|dk	rŽ|jt|ƒdt	j
|dd…fgfƒ|jt|ƒdtdfgfƒ||dd…7}q |r°t||j
|ƒƒEdHd}g}|jdƒrÎ|jƒt	j|fVq |jƒt	j|fVq W|rþt||j
|ƒƒEdHdS)Nrˆrr/rZézSQL error: )r!rMrr8r6Úsqlite_prompt_rer2rOrrr‘rrr<rNr:Ú	Tracebackr•)rEr˜rHršr›r2rœZprompt_matchr@r@rAr<s.



z)SqliteConsoleLexer.get_tokens_unprocessedN)	rSrTrUrVrdrer°rfr<r@r@r@rAr$sc@sveZdZdZdZdZdgZdgZdgZe	j
Zddefd	e
fd
efdejfdejfd
efdejfdejfdefg	iZdS)r%zG
    Lexer for Relation Query Language.

    .. versionadded:: 2.0
    ZRQLz"http://www.logilab.org/project/rqlZrqlz*.rqlz
text/x-rqlrcz\s+zŽ(DELETE|SET|INSERT|UNION|DISTINCT|WITH|WHERE|BEING|OR|AND|NOT|GROUPBY|HAVING|ORDERBY|ASC|DESC|LIMIT|OFFSET|TODAY|NOW|TRUE|FALSE|NULL|EXISTS)\bz
[+*/<>=%-]z)(Any|is|instance_of|CWEType|CWRelation)\bz[0-9]+z[A-Z_]\w*\??z'(''|[^'])*'z"(""|[^"])*"z[;:()\[\],.]N)rSrTrUrVrdÚurlrer°rfrgrhrirrrr
rmrrprrjrrqr@r@r@rAr%+s$)@rVrgZpygments.lexerrrrrrZpygments.tokenrrr	r
rrr
rrrrZpygments.lexersrrZ"pygments.lexers._postgres_builtinsrrrrZpygments.lexers._mysql_builtinsrrrrrrÚ__all__ÚcompilerrÆrhr1r;r³r²rµr±r´rBrCrrr|rr’r“Zre_errorr–r~r r!r"r#r$r%r@r@r@rAÚ<module>&sP4




$%8!




HT8)