3 ��X}V � @ s� d Z ddlZddlmZmZmZmZmZmZm Z m Z mZ ddlm Z mZmZmZmZmZmZmZmZmZ ddlmZ dddgZejd �Zd%ZG d"d� de�ZG d#d� de�ZG d$d� de�ZdS )&z� pygments.lexers.ruby ~~~~~~~~~~~~~~~~~~~~ Lexers for Ruby and related languages. :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. � N) �Lexer� RegexLexer�ExtendedRegexLexer�include�bygroups�default�LexerContext� do_insertions�words) �Text�Comment�Operator�Keyword�Name�String�Number�Punctuation�Error�Generic)�shebang_matches� RubyLexer�RubyConsoleLexer� FancyLexerz.*? �*�**�-�+�-@�+@�/�%�&�|�^�`�~�[]�[]=�<<�>>�<�<>�<=>�>�>=�==�===c r @ s@ e Zd ZdZdZdddgZdddd d ddd gZddgZej ej B Zdd� Zdd� Z dejfdejfdejfed�d4d5�efd6eeeej�fd7eee�d8fd9ed8fd:eee�d;fed�d4d5�ejfdNejfed�d_d5�ejfd`ejfed�d�d4d��ejfd�ejjfd�efd�efd�ejd�fd�eeej�d�fd�ejd�fd�eeej�d�fd�eej ee�fd�eej!ee�fd�eej"ee�fd�eej#ee�fd�ej$j%fd�ej$j&fd�ej$j'fd�ej$j'fd�ej$j'fd�efe(dՃd�ej)fd�ej*fee+d�dٍeeej�fd�eee�fd�efd�efd�efd�e,fd�efg(d�e,d�fd�eej%eej-�d�fe.d�gd�e,d�fd�ed�fd�ej%d�fe.d�gd�ee,e�d�fd�ed�fe(d�gd�ej/d�fd�ej/d�fe(d�gd�ej/d�fd�ej/fd�ej/fge(d�d�ej0fge(d�d�ejfd�ejfge(d�d�ej1fd�ej1fge(d�d�ejfd�ejfd�ejfd�ejfd�ejd�fgd�ejd�fgd��Z2e2j3e � � d�d�� Z4d�S ( r z= For `Ruby <http://www.ruby-lang.org>`_ source code. ZRuby�rbZrubyZdubyz*.rbz*.rbwZRakefilez*.rakez *.gemspecz*.rbxz*.dubyZGemfileztext/x-rubyzapplication/x-rubyc c s� |j d�}|t|jd�fV |j d�tj|jd�fV |j d�tj|jd�fV |j d�tj|jd�fV |jjdg �}t|� }|j |jd�dk|jd�f� |j d�|_ |jd�|_x&| j|d�D ]\}}}|||fV q�W |j� |_ |�r�x�|D ]�\} } g }x�t j|j|j �D ]�}| �r,|j� j� }n|j� j� }|| k�r�x$|D ]} | j � tj| j� fV �qHW |j � tj|j� fV |j� |_ P n |j |� �qW x"|D ]} | j � t| j� fV �q�W q�W t|j�|_|d d �= d S ) N� � � � �heredocstackz<<-� )�context)�startr �groupr ZHeredocZ Delimiter�__dict__� setdefault�bool�append�pos�end�get_tokens_unprocessed�line_re�finditer�text�strip�rstripr �len)�self�match�ctxr9 r6 Z outermost�i�t�vZtolerantZhdname�linesZcheckZamatch� rO �/usr/lib/python3.6/ruby.py�heredoc_callback, s>