U
    luf0e                     @   s*  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 ddlmZ ddlmZmZ ddlmZ ddlmZ dd	lmZ dd
lmZ ddl m!Z! ddl"m#Z# dddddddddddddddddddgZ$G d d deZ%G d!d deZ&G d"d deZ'G d#d deZ(G d$d deZ)G d%d deZ*G d&d deZ+G d'd deZ,G d(d deZ-G d)d deZ.G d*d deZ/G d+d deZ0G d,d deZ1G d-d deZ2G d.d deZ3G d/d deZ4G d0d deZ5G d1d2 d2eZ6G d3d deZ7G d4d deZ8dS )5z
    pygments.lexers.parsers
    ~~~~~~~~~~~~~~~~~~~~~~~

    Lexers for parser generators.

    :copyright: Copyright 2006-2023 by the Pygments team, see AUTHORS.
    :license: BSD, see LICENSE for details.
    N)
RegexLexerDelegatingLexerincludebygroupsusing)
PunctuationOtherTextCommentOperatorKeywordNameStringNumber
Whitespace)	JavaLexer)CLexerCppLexer)ObjectiveCLexer)DLexer)CSharpLexer)	RubyLexer)PythonLexer)	PerlLexer
RagelLexerRagelEmbeddedLexerRagelCLexerRagelDLexerRagelCppLexerRagelObjectiveCLexerRagelRubyLexerRagelJavaLexer
AntlrLexerAntlrPythonLexerAntlrPerlLexerAntlrRubyLexerAntlrCppLexerAntlrCSharpLexerAntlrObjectiveCLexerAntlrJavaLexerAntlrActionScriptLexerTreetopLexer	EbnfLexerc                   @   sJ  e Zd ZdZdZdZdgZg Zdefgde	fgde
fde
fd	e
fd
e
fgdejfdejfgdejfdejfdefdejfgdej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defdefdefdefged ed!ed"ed#ed$ed%ed&d'ed(fd)efd*efg
d+d,d- d. efd'ed/fd0ed1fgd2	Zd3S )4r   zA pure `Ragel <www.colm.net/open-source/ragel>`_ lexer.  Use this
    for fragments of Ragel.  For ``.rl`` files, use
    :class:`RagelEmbeddedLexer` instead (or one of the
    language-specific subclasses).

    .. versionadded:: 1.1

    ZRagelz&http://www.colm.net/open-source/ragel/Zragel\s+z\#.*$z(access|action|alphtype)\bz (getkey|write|machine|include)\bz2(any|ascii|extend|alpha|digit|alnum|lower|upper)\bz3(xdigit|cntrl|graph|print|punct|space|zlen|empty)\bz0x[0-9A-Fa-f]+z[+-]?[0-9]+"(\\\\|\\[^\\]|[^"\\])*"'(\\\\|\\[^\\]|[^'\\])*'z\[(\\\\|\\[^\\]|[^\\\]])*\]/(?!\*)(\\\\|\\[^\\]|[^/\\])*/z[a-zA-Z_]\w*,z\||&|--?z
\.|<:|:>>?:z->z(>|\$|%|<|@|<>)(/|eof\b)z(>|\$|%|<|@|<>)(!|err\b)z(>|\$|%|<|@|<>)(\^|lerr\b)z(>|\$|%|<|@|<>)(~|to\b)z(>|\$|%|<|@|<>)(\*|from\b)z>|@|\$|%z\*|\?|\+|\{[0-9]*,[0-9]*\}z!|\^z\(|\)literals
whitespacecommentskeywordsnumbersidentifiers	operators\{host=;(|)	z[^{}\'"/#]+[^\\]\\[{}]r.   r/   //.*$\n?/\*(.|\n)*?\*/\#.*$\n?r0   /)+#push\}#pop)	r4   r5   r6   r7   r3   r8   r9   rootr;   N)__name__
__module____qualname____doc__nameurlaliases	filenamesr   r
   r   r   ZHexIntegerr   DoubleSingleRegexr   Variabler   r   r   joinr   tokens rY   rY   ;/tmp/pip-unpacked-wheel-7eq1ciah/pygments/lexers/parsers.pyr   #   sv   	c                   @   s   e Zd ZdZdZdgZdgZddd d efd	e	e
eee
efd
e
dfgddddd d ddddddf d eefde
dfgdZdd ZdS )r   z
    A lexer for Ragel embedded in a host language file.

    This will only highlight Ragel statements. If you want host language
    highlighting then call the language-specific Ragel lexer.

    .. versionadded:: 1.1
    zEmbedded Ragelzragel-em*.rlr>   r?   )	z
[^%\'"/#]+z%(?=[^%]|$)r.   r/   rB   rA   rC   r0   rD   rE   z(%%)(?![{%])(.*)($|;)(\n?)z(%%%%|%%)\{multi-line-fsm)z[^}\'"\[/#]z\}(?=[^%]|$)z\}%(?=[^%]|$)r@   z(>|\$|%|<|@|<>)/z /(?!\*)(\\\\|\\[^\\]|[^/\\])*/\*z/(?=[^/*]|$)r.   r/   z\[(\\\\|\\[^\\]|[^\]\\])*\]rB   rA   rC   z\}%%rH   )rI   r\   c                 C   s   d| kS )Nz@LANG: indeprY   textrY   rY   rZ   analyse_text   s    zRagelEmbeddedLexer.analyse_textN)rJ   rK   rL   rM   rN   rP   rQ   rW   r   r   r   r   r   r	   rX   r_   rY   rY   rY   rZ   r      sF   	  Ac                       s:   e Zd ZdZdZddgZdgZ fddZdd	 Z  Z	S )
r    zK
    A lexer for Ragel in a Ruby host file.

    .. versionadded:: 1.1
    zRagel in Ruby Hostz
ragel-rubyzragel-rbr[   c                    s   t  jttf| d S N)super__init__r   r   selfoptions	__class__rY   rZ   rb      s    zRagelRubyLexer.__init__c                 C   s   d| kS )Nz@LANG: rubyrY   r]   rY   rY   rZ   r_      s    zRagelRubyLexer.analyse_text
rJ   rK   rL   rM   rN   rP   rQ   rb   r_   __classcell__rY   rY   rf   rZ   r       s   c                       s8   e Zd ZdZdZdgZdgZ fddZdd Z  Z	S )	r   zH
    A lexer for Ragel in a C host file.

    .. versionadded:: 1.1
    zRagel in C Hostzragel-cr[   c                    s   t  jttf| d S r`   )ra   rb   r   r   rc   rf   rY   rZ   rb      s    zRagelCLexer.__init__c                 C   s   d| kS )Nz@LANG: crY   r]   rY   rY   rZ   r_      s    zRagelCLexer.analyse_textrh   rY   rY   rf   rZ   r      s   c                       s8   e Zd ZdZdZdgZdgZ fddZdd Z  Z	S )	r   zH
    A lexer for Ragel in a D host file.

    .. versionadded:: 1.1
    zRagel in D Hostzragel-dr[   c                    s   t  jttf| d S r`   )ra   rb   r   r   rc   rf   rY   rZ   rb     s    zRagelDLexer.__init__c                 C   s   d| kS )Nz@LANG: drY   r]   rY   rY   rZ   r_     s    zRagelDLexer.analyse_textrh   rY   rY   rf   rZ   r      s   c                       s8   e Zd ZdZdZdgZdgZ fddZdd Z  Z	S )	r   zJ
    A lexer for Ragel in a C++ host file.

    .. versionadded:: 1.1
    zRagel in CPP Hostz	ragel-cppr[   c                    s   t  jttf| d S r`   )ra   rb   r   r   rc   rf   rY   rZ   rb     s    zRagelCppLexer.__init__c                 C   s   d| kS )Nz
@LANG: c++rY   r]   rY   rY   rZ   r_     s    zRagelCppLexer.analyse_textrh   rY   rY   rf   rZ   r     s   c                       s8   e Zd ZdZdZdgZdgZ fddZdd Z  Z	S )	r   zS
    A lexer for Ragel in an Objective C host file.

    .. versionadded:: 1.1
    zRagel in Objective C Hostz
ragel-objcr[   c                    s   t  jttf| d S r`   )ra   rb   r   r   rc   rf   rY   rZ   rb   (  s    zRagelObjectiveCLexer.__init__c                 C   s   d| kS )Nz@LANG: objcrY   r]   rY   rY   rZ   r_   +  s    z!RagelObjectiveCLexer.analyse_textrh   rY   rY   rf   rZ   r     s   c                       s8   e Zd ZdZdZdgZdgZ fddZdd Z  Z	S )	r!   zK
    A lexer for Ragel in a Java host file.

    .. versionadded:: 1.1
    zRagel in Java Hostz
ragel-javar[   c                    s   t  jttf| d S r`   )ra   rb   r   r   rc   rf   rY   rZ   rb   :  s    zRagelJavaLexer.__init__c                 C   s   d| kS )Nz@LANG: javarY   r]   rY   rY   rZ   r_   =  s    zRagelJavaLexer.analyse_textrh   rY   rY   rf   rZ   r!   /  s   c                   @   sN  e Zd ZdZdZdgZg ZdZdZdZ	dZ
dZd	efgd
efdefgededde d eeeeeejefdedfdedfde d eeeejeedfdedfde d e d eejeeeejeedfde d eeeejedfg	dedfd efedd!ed"fd#edfgededd$efd!ed"fd#edfd%e d& eeeejfd'e d& eeeejfdedfd(eeeedfd)e d* eeeejeefde d eejeedfd+edfgededdedfd+efd,ejfd-ejfd.efd/ejfd0ejfd1efd2efd!ed"fd#edfd3edfgededd#efd4e d5 e
 d6 eejeeeeeefd7edfgededd#efd4e d8 d9ee
ed:f d* eejeeeeeefd7edfgd4d9d; d< efd=eeefd>eejeejfd#ed?fd7edfgd4d9d@ d< efd!ed?fdAedfd>eejeejfdBefgdC
ZdDdE Z dFS )Gr"   z
    Generic `ANTLR`_ Lexer.
    Should not be called directly, instead
    use DelegatingLexer for your target language.

    .. versionadded:: 1.1

    .. _ANTLR: http://www.antlr.org/
    ZANTLRZantlrz[A-Za-z]\w*[A-Z]\w*z[a-z]\w*z\'(?:\\\\|\\\'|[^\']*)\'z[0-9]+r-   z//.*$rB   r4   r5   z*(lexer|parser|tree)?(\s*)(grammar\b)(\s*)(z)(;)z	options\bre   ztokens\brX   z(scope)(\s*)(z
)(\s*)(\{)actionz(catch|finally)\b	exceptionz(@z)(\s*)(::)?(\s*)(z0((?:protected|private|public|fragment)\b)?(\s*)(z)(!)?)	rule-altsrule-prelimsz\nrH   z\sz\[nested-arg-actionr:   z	returns\bz(throws)(\s+)()z	(,)(\s*)(z(scope)(\s+)(\{)z(scope)(\s+)(z	)(\s*)(;)r2   r.   r/   z<<([^>]|>[^>])>>z\$?[A-Z_]\w*z\$?[a-z_]\w*z-(\+|\||->|=>|=|\(|\)|\.\.|\.|\?|\*|\^|!|\#|~)r1   r=   r>   z)(\s*)(=)?(\s*)(z
)?(\s*)(;)rG   z)(\s*)(=)(\s*)(r?   z\*)z[^${}\'"/\\]+r.   r/   rA   rB   r0   z\\(?!%)rD   rE   z(\\)(%)z(\$[a-zA-Z]+)(\.?)(text|value)?rF   )z[^$\[\]\'"/]+r.   r/   rA   rB   r0   rD   z\]z(\\\\|\\\]|\\\[|[^\[\]])+)
r4   r5   rI   rl   rn   rm   rX   re   rk   ro   c                 C   s   t d| t jS )Nz^\s*grammar\s+[a-zA-Z0-9]+\s*;)researchMr]   rY   rY   rZ   r_     s    zAntlrLexer.analyse_textN)!rJ   rK   rL   rM   rN   rP   rQ   Z_idZ
_TOKEN_REFZ	_RULE_REFZ_STRING_LITERALZ_INTr   r
   r   r   r   r   Classr   rV   Labelr   rS   rT   Constantr   rW   r	   r   ZPropertyrX   r_   rY   rY   rY   rZ   r"   A  s$  


  
	



   
    )c                       s:   e Zd ZdZdZdgZddgZ fddZdd	 Z  Z	S )
r&   z:
    ANTLR with C++ Target

    .. versionadded:: 1.1
    zANTLR With CPP Targetz	antlr-cpp*.G*.gc                    s   t  jttf| d S r`   )ra   rb   r   r"   rc   rf   rY   rZ   rb     s    zAntlrCppLexer.__init__c                 C   s   t | otd| tjS )Nz^\s*language\s*=\s*C\s*;r"   r_   rq   rr   rs   r]   rY   rY   rZ   r_     s    
zAntlrCppLexer.analyse_textrh   rY   rY   rf   rZ   r&     s   c                       s:   e Zd ZdZdZdgZddgZ fddZdd	 Z  Z	S )
r(   zB
    ANTLR with Objective-C Target

    .. versionadded:: 1.1
    zANTLR With ObjectiveC Targetz
antlr-objcrw   rx   c                    s   t  jttf| d S r`   )ra   rb   r   r"   rc   rf   rY   rZ   rb   "  s    zAntlrObjectiveCLexer.__init__c                 C   s   t | otd| S )Nz^\s*language\s*=\s*ObjC\s*;)r"   r_   rq   rr   r]   rY   rY   rZ   r_   %  s    

z!AntlrObjectiveCLexer.analyse_textrh   rY   rY   rf   rZ   r(     s   c                       s<   e Zd ZdZdZddgZddgZ fddZd	d
 Z  Z	S )r'   z9
    ANTLR with C# Target

    .. versionadded:: 1.1
    zANTLR With C# Targetzantlr-csharpzantlr-c#rw   rx   c                    s   t  jttf| d S r`   )ra   rb   r   r"   rc   rf   rY   rZ   rb   5  s    zAntlrCSharpLexer.__init__c                 C   s   t | otd| tjS )Nz^\s*language\s*=\s*CSharp2\s*;ry   r]   rY   rY   rZ   r_   8  s    
zAntlrCSharpLexer.analyse_textrh   rY   rY   rf   rZ   r'   *  s   c                       s:   e Zd ZdZdZdgZddgZ fddZdd	 Z  Z	S )
r#   z=
    ANTLR with Python Target

    .. versionadded:: 1.1
    zANTLR With Python Targetzantlr-pythonrw   rx   c                    s   t  jttf| d S r`   )ra   rb   r   r"   rc   rf   rY   rZ   rb   H  s    zAntlrPythonLexer.__init__c                 C   s   t | otd| tjS )Nz^\s*language\s*=\s*Python\s*;ry   r]   rY   rY   rZ   r_   K  s    
zAntlrPythonLexer.analyse_textrh   rY   rY   rf   rZ   r#   =  s   c                       s:   e Zd ZdZdZdgZddgZ fddZdd	 Z  Z	S )
r)   z:
    ANTLR with Java Target

    .. versionadded:: 1.
    zANTLR With Java Targetz
antlr-javarw   rx   c                    s   t  jttf| d S r`   )ra   rb   r   r"   rc   rf   rY   rZ   rb   [  s    zAntlrJavaLexer.__init__c                 C   s   t | odS )Ng?)r"   r_   r]   rY   rY   rZ   r_   ^  s    zAntlrJavaLexer.analyse_textrh   rY   rY   rf   rZ   r)   P  s   c                       s<   e Zd ZdZdZddgZddgZ fddZd	d
 Z  Z	S )r%   z;
    ANTLR with Ruby Target

    .. versionadded:: 1.1
    zANTLR With Ruby Targetz
antlr-rubyzantlr-rbrw   rx   c                    s   t  jttf| d S r`   )ra   rb   r   r"   rc   rf   rY   rZ   rb   n  s    zAntlrRubyLexer.__init__c                 C   s   t | otd| tjS )Nz^\s*language\s*=\s*Ruby\s*;ry   r]   rY   rY   rZ   r_   q  s    
zAntlrRubyLexer.analyse_textrh   rY   rY   rf   rZ   r%   c  s   c                       s:   e Zd ZdZdZdgZddgZ fddZdd	 Z  Z	S )
r$   z;
    ANTLR with Perl Target

    .. versionadded:: 1.1
    zANTLR With Perl Targetz
antlr-perlrw   rx   c                    s   t  jttf| d S r`   )ra   rb   r   r"   rc   rf   rY   rZ   rb     s    zAntlrPerlLexer.__init__c                 C   s   t | otd| tjS )Nz^\s*language\s*=\s*Perl5\s*;ry   r]   rY   rY   rZ   r_     s    
zAntlrPerlLexer.analyse_textrh   rY   rY   rf   rZ   r$   v  s   c                       s<   e Zd ZdZdZddgZddgZ fddZd	d
 Z  Z	S )r*   zC
    ANTLR with ActionScript Target

    .. versionadded:: 1.1
    zANTLR With ActionScript Targetzantlr-actionscriptzantlr-asrw   rx   c                    s"   ddl m} t j|tf| d S )Nr   )ActionScriptLexer)Zpygments.lexers.actionscriptrz   ra   rb   r"   )rd   re   rz   rf   rY   rZ   rb     s    zAntlrActionScriptLexer.__init__c                 C   s   t | otd| tjS )Nz#^\s*language\s*=\s*ActionScript\s*;ry   r]   rY   rY   rZ   r_     s    
z#AntlrActionScriptLexer.analyse_textrh   rY   rY   rf   rZ   r*     s   c                   @   sT  e Zd ZdZeddefdejdfdedfgededded	fdedfd
ejfgededdedfdedfdefgedd
ej	dfgededde
jfde
jfdeejefdefdefdefde
jfdeejeejfdeeej	efdedfde
jfgdedfdedfdefgded	fdedfdefgd efd!ejfgd"edfgd#	Zd$S )%TreetopBaseLexerz
    A base lexer for `Treetop <http://treetop.rubyforge.org/>`_ grammars.
    Not for direct use; use :class:`TreetopLexer` instead.

    .. versionadded:: 1.6
    spacezrequire[ \t]+[^\n\r]+[\n\r]zmodule\bmodulez	grammar\bgrammarendrF   z[A-Z]\w*(?:::[A-Z]\w*)*zrule\brulez	include\br   rj   rH   r.   r/   z([A-Za-z_]\w*)(:)z[A-Za-z_]\w*z[()]z	[?+*/&!~]z$\[(?:\\.|\[:\^?[a-z]+:\]|[^\\\]])+\]z([0-9]*)(\.\.)([0-9]*)z(<)([^>]+)(>)r:   inline_module\.rubyrG   z[^{}]+z
[ \t\n\r]+z#[^\n]*zend\b)	rI   r}   r~   r   r   r   r   r|   r   N)rJ   rK   rL   rM   r   r   r   	Namespacer   rt   r   rS   rT   r   ru   r   r   rU   r   rR   r   r
   rX   rY   rY   rY   rZ   r{     sf   	

r{   c                       s2   e Zd ZdZdZdgZddgZ fddZ  ZS )r+   ze
    A lexer for `Treetop <http://treetop.rubyforge.org/>`_ grammars.

    .. versionadded:: 1.6
    ZTreetopZtreetopz	*.treetopz*.ttc                    s   t  jttf| d S r`   )ra   rb   r   r{   rc   rf   rY   rZ   rb     s    zTreetopLexer.__init__)	rJ   rK   rL   rM   rN   rP   rQ   rb   ri   rY   rY   rf   rZ   r+     s
   c                   @   s   e Zd ZdZdZdgZdgZdgZedededd	e	d
fgedededde
jfde
jfdejfdefde	fdedfdedfg
defgdejdfgdejfeddejdfdejfgdefgdZdS )r,   z
    Lexer for `ISO/IEC 14977 EBNF
    <http://en.wikipedia.org/wiki/Extended_Backus%E2%80%93Naur_Form>`_
    grammars.

    .. versionadded:: 2.0
    ZEBNFZebnfz*.ebnfztext/x-ebnfr4   comment_start
identifierr<   
productionz"[^"]*"z'[^']*'z(\?[^?]*\?)z[\[\]{}(),|]-r=   rH   r   r-   z\(\*commentz[^*)]z\*\)z[*)]z([a-zA-Z][\w \-]*))rI   r   r4   r   r   r   N)rJ   rK   rL   rM   rN   rP   rQ   	mimetypesr   r   r   rS   rT   r   Entityr   r	   r
   Z	Multiliner   rX   rY   rY   rY   rZ   r,     sB   

)9rM   rq   Zpygments.lexerr   r   r   r   r   Zpygments.tokenr   r   r	   r
   r   r   r   r   r   r   Zpygments.lexers.jvmr   Zpygments.lexers.c_cppr   r   Zpygments.lexers.objectiver   Zpygments.lexers.dr   Zpygments.lexers.dotnetr   Zpygments.lexers.rubyr   Zpygments.lexers.pythonr   Zpygments.lexers.perlr   __all__r   r   r    r   r   r   r   r!   r"   r&   r(   r'   r#   r)   r%   r$   r*   r{   r+   r,   rY   rY   rY   rZ   <module>   sb   
0         	_S DE