3 �;�e�l � @ s� d Z ddlZddlmZmZmZmZmZ ddlm Z m Z mZmZm Z mZmZmZmZ dddgZG dd� de�ZG d d� de�ZG d d� de�ZdS )z� pygments.lexers.ml ~~~~~~~~~~~~~~~~~~ Lexers for ML family languages. :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. � N)� RegexLexer�include�bygroups�default�words) �Text�Comment�Operator�Keyword�Name�String�Number�Punctuation�Error�SMLLexer� OcamlLexer�OpaLexerc * @ s0 e Zd ZdZdZdgZdddgZddgZed��Z ed��Z ed��ZdCZdDZ dEdF� ZdGdH� ZdIdJ� ZdKdL� ZdMefdNejdOfgdPedQfdRedSfdTejd�fdUejdQfdVejdSfgdWdXjdYdZ� eD �� efd[ejd\fd]ejd^fd_ejfd`ejfdaejfdbejfdcejfddejfdeejfdfe j!fdge e j!fdhe e j!fdiejdjfdkejdlfdmejdnfdoejdpfdqe j"fdre edsfdWe efdWe efgdre efdWe edSfdWe edSfdMe#fdte#fge$dQ�ge%du�dvejdwfdxejd�fe%d{�e%d|�dte#fge%du�d}efdNejdOfd~ejdzfdejd�fd3edzfd�ejd�fe%d{�e%d|�dte#fg eej�eej�d�dXje � edSfge%du�e%d��dWe e j&fe$dS�ge%du�dqe j"fd�ed�fdWe e j'dSfdWe e j'dSfe$dS�ge%du�dqe j"fd�ed�fd�ee f e(e j)ee�dSfd�e e f e(e j)ee�dSfdWe e j)dSfdWe e j)dSfe$dS�ge%du�e%d��dqe j"fd�ed�fd�e ed�fdWe ej*fdWe ej*fdte#dSfge%du�d�ejd�fe%d��e%d|�dte#dSfge%du�e%d��dqe j"fd�ed�fd�e(eeej�dSfd�e ed�fdWe ej*fdWe ej*fdte#dSfg e%du�d�ejd�fd�ejd�fd�ejfd�e e(eee j+�fd�e e(eee j+�fe%d��e%d|�dte#fg e%du�d�e e(ejee j+�fd�e e(ejee j+�fd�ejfd�ee f e j+fe$dS�ge%du�dWe e j+dSfdWe e j+dSfdte#dSfgd}efdNejdOfdqe j"fee fd?efd�edSfe e fgd�ejfdNejd�fd�ejdSfd�ejfgd��Z,d�S )�r zB For the Standard ML language. .. versionadded:: 1.5 zStandard MLZsmlz*.smlz*.sigz*.funztext/x-standardmlzapplication/x-standardml�abstype�and�andalso�as�case�datatype�do�else�end� exception�fn�fun�handle�if�in�infix�infixr�let�local�nonfix�of�op�open�orelse�raise�rec�then�type�val�with�withtype�while�eqtype�functorr �sharing�sig� signature�struct� structure�where�:�\|�=�=>�->�#�:>�(�)�[�]�{�}�,�;�...�_z[a-zA-Z][\w']*z[!%&$#+\-/:<=>?@\\~`^|*]+c C s: d| fdt jfdt jfdt jfdt jfdt jfd| dfgS ) Nz[^"\\]z\\[\\"abtnvfr]z\\\^[\x40-\x5e]z \\[0-9]{3}z\\u[0-9a-fA-F]{4}z\\\s+\\�"z#pop)r �EscapeZInterpol)Zwhatkind� rN �/usr/lib/python3.6/ml.py�stringy= s zSMLLexer.stringyc c sP |j d�| jkrt}ntj}|jd�||j d�fV |jd�t|j d�fV d S )N� � )�group�alphanumid_reservedr r � Namespace�startr )�self�match�tokenrN rN rO �long_id_callbackL s zSMLLexer.long_id_callbackc c sL |j d�| jkrt}n|j d�| jkr,t}nt}|jd�||j d�fV d S )NrQ )rS rT r �symbolicid_reservedr rV )rW rX rY rN rN rO �end_id_callbackT s zSMLLexer.end_id_callbackc c sF |j d�}|| jkrtj}n|| jkr,t}nt}|jd�||fV d S )NrQ )rS rT r �Reservedr[ r r rV )rW rX �strrY rN rN rO �id_callback] s zSMLLexer.id_callbackz\s+z\(\*�commentz\(|\[|\{�mainz\)|\]|\}�#popz\b(let|if|local)\b(?!\')z\b(struct|sig|while)\b(?!\')z\b(do|else|end|in|then)\b(?!\')z(%s)�|c c s | ]}t j|�V qd S )N)�re�escape)�.0�zrN rN rO � <genexpr>} s zSMLLexer.<genexpr>z#"�charrL �stringz~?0x[0-9a-fA-F]+z0wx[0-9a-fA-F]+z0w\d+z~?\d+\.\d+[eE]~?\d+z ~?\d+\.\d+z~?\d+[eE]~?\d+z~?\d+z#\s*[1-9][0-9]*z#\s*(%s)z#\s+(%s)z\b(datatype|abstype)\b(?!\')�dnamez\b(exception)\b(?!\')�enamez4\b(functor|include|open|signature|structure)\b(?!\')�snamez\b(type|eqtype)\b(?!\')�tnamez \'[\w\']*z(%s)(\.)�dottedz\S+� whitespacez\b(val|and)\b(?!\')�vnamez\b(fun)\b(?!\')�main-fun�fname� delimiters�corez\sz\b(fun|and)\b(?!\')z\b(val)\b(?!\')z\b(case|handle)\b(?!\')z(?=\b(%s)\b(?!\'))�breakoutz\(�tyvarseqz(%s)(\s*)(=(?!%s))z=(?!%s)�typbindz\b(and)\b(?!\')z(=)(\s*)(datatype)�datbind�datconz\b(withtype)\b(?!\')z\b(of)\b(?!\')z (\|)(\s*)(%s)z (\|)(\s+)(%s)z(and\b)(\s+)(%s)z(and\b)(\s*)(%s)z (%s)|(%s)z\)z[^(*)]z#pushz\*\)z[(*)])rp rt ru ro �rootra zmain-funri rj rv rm rs rq rn rx rk ry rl rz rw r` N))r r r r r r r r r r r r r r r! r"