3 ��X� � @ s6 d Z ddlZdgZejdej�Zdd� Zd dd�ZdS ) z� pygments.modeline ~~~~~~~~~~~~~~~~~ A simple modeline parser (based on pymodeline). :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. � N�get_filetype_from_bufferze (?: vi | vim | ex ) (?: [<=>]? \d* )? : .* (?: ft | filetype | syn | syntax ) = ( [^:\s]+ ) c C s t j| �}|r|jd�S d S )N� )�modeline_re�search�group)�l�m� r �/usr/lib/python3.6/modeline.py�get_filetype_from_line s r � c C sp | j � }x,|d| d d� D ]}t|�}|r|S qW x4t|dd�D ]$}|t|�k rDt|| �}|rD|S qDW dS )zL Scan the buffer for modelines and return filetype if one is found. r N���r r r )� splitlinesr �range�len)ZbufZ max_lines�linesr �ret�ir r r r s )r )�__doc__�re�__all__�compile�VERBOSEr r r r r r r �<module> s