mirror of
https://github.com/ralsina/tartrazine.git
synced 2024-11-10 05:22:23 +00:00
548 lines
16 KiB
XML
548 lines
16 KiB
XML
|
<lexer>
|
||
|
<config>
|
||
|
<name>Standard ML</name>
|
||
|
<alias>sml</alias>
|
||
|
<filename>*.sml</filename>
|
||
|
<filename>*.sig</filename>
|
||
|
<filename>*.fun</filename>
|
||
|
<mime_type>text/x-standardml</mime_type>
|
||
|
<mime_type>application/x-standardml</mime_type>
|
||
|
</config>
|
||
|
<rules>
|
||
|
<state name="delimiters">
|
||
|
<rule pattern="\(|\[|\{">
|
||
|
<token type="Punctuation"/>
|
||
|
<push state="main"/>
|
||
|
</rule>
|
||
|
<rule pattern="\)|\]|\}">
|
||
|
<token type="Punctuation"/>
|
||
|
<pop depth="1"/>
|
||
|
</rule>
|
||
|
<rule pattern="\b(let|if|local)\b(?!\')">
|
||
|
<token type="KeywordReserved"/>
|
||
|
<push state="main" state="main"/>
|
||
|
</rule>
|
||
|
<rule pattern="\b(struct|sig|while)\b(?!\')">
|
||
|
<token type="KeywordReserved"/>
|
||
|
<push state="main"/>
|
||
|
</rule>
|
||
|
<rule pattern="\b(do|else|end|in|then)\b(?!\')">
|
||
|
<token type="KeywordReserved"/>
|
||
|
<pop depth="1"/>
|
||
|
</rule>
|
||
|
</state>
|
||
|
<state name="root">
|
||
|
<rule>
|
||
|
<push state="main"/>
|
||
|
</rule>
|
||
|
</state>
|
||
|
<state name="breakout">
|
||
|
<rule pattern="(?=\b(where|do|handle|if|sig|op|while|case|as|else|signature|andalso|struct|infixr|functor|in|structure|then|local|rec|end|fun|of|orelse|val|include|fn|with|exception|let|and|infix|sharing|datatype|type|abstype|withtype|eqtype|nonfix|raise|open)\b(?!\'))">
|
||
|
<token type="Text"/>
|
||
|
<pop depth="1"/>
|
||
|
</rule>
|
||
|
</state>
|
||
|
<state name="tyvarseq">
|
||
|
<rule pattern="\s">
|
||
|
<token type="Text"/>
|
||
|
</rule>
|
||
|
<rule pattern="\(\*">
|
||
|
<token type="CommentMultiline"/>
|
||
|
<push state="comment"/>
|
||
|
</rule>
|
||
|
<rule pattern="\'[\w\']*">
|
||
|
<token type="NameDecorator"/>
|
||
|
</rule>
|
||
|
<rule pattern="[a-zA-Z][\w']*">
|
||
|
<token type="Name"/>
|
||
|
</rule>
|
||
|
<rule pattern=",">
|
||
|
<token type="Punctuation"/>
|
||
|
</rule>
|
||
|
<rule pattern="\)">
|
||
|
<token type="Punctuation"/>
|
||
|
<pop depth="1"/>
|
||
|
</rule>
|
||
|
<rule pattern="[!%&$#+\-/:<=>?@\\~`^|*]+">
|
||
|
<token type="Name"/>
|
||
|
</rule>
|
||
|
</state>
|
||
|
<state name="char">
|
||
|
<rule pattern="[^"\\]">
|
||
|
<token type="LiteralStringChar"/>
|
||
|
</rule>
|
||
|
<rule pattern="\\[\\"abtnvfr]">
|
||
|
<token type="LiteralStringEscape"/>
|
||
|
</rule>
|
||
|
<rule pattern="\\\^[\x40-\x5e]">
|
||
|
<token type="LiteralStringEscape"/>
|
||
|
</rule>
|
||
|
<rule pattern="\\[0-9]{3}">
|
||
|
<token type="LiteralStringEscape"/>
|
||
|
</rule>
|
||
|
<rule pattern="\\u[0-9a-fA-F]{4}">
|
||
|
<token type="LiteralStringEscape"/>
|
||
|
</rule>
|
||
|
<rule pattern="\\\s+\\">
|
||
|
<token type="LiteralStringInterpol"/>
|
||
|
</rule>
|
||
|
<rule pattern=""">
|
||
|
<token type="LiteralStringChar"/>
|
||
|
<pop depth="1"/>
|
||
|
</rule>
|
||
|
</state>
|
||
|
<state name="datbind">
|
||
|
<rule>
|
||
|
<include state="whitespace"/>
|
||
|
</rule>
|
||
|
<rule pattern="\b(and)\b(?!\')">
|
||
|
<token type="KeywordReserved"/>
|
||
|
<push state="#pop" state="dname"/>
|
||
|
</rule>
|
||
|
<rule pattern="\b(withtype)\b(?!\')">
|
||
|
<token type="KeywordReserved"/>
|
||
|
<push state="#pop" state="tname"/>
|
||
|
</rule>
|
||
|
<rule pattern="\b(of)\b(?!\')">
|
||
|
<token type="KeywordReserved"/>
|
||
|
</rule>
|
||
|
<rule pattern="(\|)(\s*)([a-zA-Z][\w']*)">
|
||
|
<bygroups>
|
||
|
<token type="Punctuation"/>
|
||
|
<token type="Text"/>
|
||
|
<token type="NameClass"/>
|
||
|
</bygroups>
|
||
|
</rule>
|
||
|
<rule pattern="(\|)(\s+)([!%&$#+\-/:<=>?@\\~`^|*]+)">
|
||
|
<bygroups>
|
||
|
<token type="Punctuation"/>
|
||
|
<token type="Text"/>
|
||
|
<token type="NameClass"/>
|
||
|
</bygroups>
|
||
|
</rule>
|
||
|
<rule>
|
||
|
<include state="breakout"/>
|
||
|
</rule>
|
||
|
<rule>
|
||
|
<include state="core"/>
|
||
|
</rule>
|
||
|
<rule pattern="\S+">
|
||
|
<token type="Error"/>
|
||
|
</rule>
|
||
|
</state>
|
||
|
<state name="string">
|
||
|
<rule pattern="[^"\\]">
|
||
|
<token type="LiteralStringDouble"/>
|
||
|
</rule>
|
||
|
<rule pattern="\\[\\"abtnvfr]">
|
||
|
<token type="LiteralStringEscape"/>
|
||
|
</rule>
|
||
|
<rule pattern="\\\^[\x40-\x5e]">
|
||
|
<token type="LiteralStringEscape"/>
|
||
|
</rule>
|
||
|
<rule pattern="\\[0-9]{3}">
|
||
|
<token type="LiteralStringEscape"/>
|
||
|
</rule>
|
||
|
<rule pattern="\\u[0-9a-fA-F]{4}">
|
||
|
<token type="LiteralStringEscape"/>
|
||
|
</rule>
|
||
|
<rule pattern="\\\s+\\">
|
||
|
<token type="LiteralStringInterpol"/>
|
||
|
</rule>
|
||
|
<rule pattern=""">
|
||
|
<token type="LiteralStringDouble"/>
|
||
|
<pop depth="1"/>
|
||
|
</rule>
|
||
|
</state>
|
||
|
<state name="tname">
|
||
|
<rule>
|
||
|
<include state="whitespace"/>
|
||
|
</rule>
|
||
|
<rule>
|
||
|
<include state="breakout"/>
|
||
|
</rule>
|
||
|
<rule pattern="\'[\w\']*">
|
||
|
<token type="NameDecorator"/>
|
||
|
</rule>
|
||
|
<rule pattern="\(">
|
||
|
<token type="Punctuation"/>
|
||
|
<push state="tyvarseq"/>
|
||
|
</rule>
|
||
|
<rule pattern="=(?![!%&$#+\-/:<=>?@\\~`^|*]+)">
|
||
|
<token type="Punctuation"/>
|
||
|
<push state="#pop" state="typbind"/>
|
||
|
</rule>
|
||
|
<rule pattern="([a-zA-Z][\w']*)">
|
||
|
<token type="KeywordType"/>
|
||
|
</rule>
|
||
|
<rule pattern="([!%&$#+\-/:<=>?@\\~`^|*]+)">
|
||
|
<token type="KeywordType"/>
|
||
|
</rule>
|
||
|
<rule pattern="\S+">
|
||
|
<token type="Error"/>
|
||
|
<pop depth="1"/>
|
||
|
</rule>
|
||
|
</state>
|
||
|
<state name="dname">
|
||
|
<rule>
|
||
|
<include state="whitespace"/>
|
||
|
</rule>
|
||
|
<rule>
|
||
|
<include state="breakout"/>
|
||
|
</rule>
|
||
|
<rule pattern="\'[\w\']*">
|
||
|
<token type="NameDecorator"/>
|
||
|
</rule>
|
||
|
<rule pattern="\(">
|
||
|
<token type="Punctuation"/>
|
||
|
<push state="tyvarseq"/>
|
||
|
</rule>
|
||
|
<rule pattern="(=)(\s*)(datatype)">
|
||
|
<bygroups>
|
||
|
<token type="Punctuation"/>
|
||
|
<token type="Text"/>
|
||
|
<token type="KeywordReserved"/>
|
||
|
</bygroups>
|
||
|
<pop depth="1"/>
|
||
|
</rule>
|
||
|
<rule pattern="=(?![!%&$#+\-/:<=>?@\\~`^|*]+)">
|
||
|
<token type="Punctuation"/>
|
||
|
<push state="#pop" state="datbind" state="datcon"/>
|
||
|
</rule>
|
||
|
<rule pattern="([a-zA-Z][\w']*)">
|
||
|
<token type="KeywordType"/>
|
||
|
</rule>
|
||
|
<rule pattern="([!%&$#+\-/:<=>?@\\~`^|*]+)">
|
||
|
<token type="KeywordType"/>
|
||
|
</rule>
|
||
|
<rule pattern="\S+">
|
||
|
<token type="Error"/>
|
||
|
<pop depth="1"/>
|
||
|
</rule>
|
||
|
</state>
|
||
|
<state name="typbind">
|
||
|
<rule>
|
||
|
<include state="whitespace"/>
|
||
|
</rule>
|
||
|
<rule pattern="\b(and)\b(?!\')">
|
||
|
<token type="KeywordReserved"/>
|
||
|
<push state="#pop" state="tname"/>
|
||
|
</rule>
|
||
|
<rule>
|
||
|
<include state="breakout"/>
|
||
|
</rule>
|
||
|
<rule>
|
||
|
<include state="core"/>
|
||
|
</rule>
|
||
|
<rule pattern="\S+">
|
||
|
<token type="Error"/>
|
||
|
<pop depth="1"/>
|
||
|
</rule>
|
||
|
</state>
|
||
|
<state name="ename">
|
||
|
<rule>
|
||
|
<include state="whitespace"/>
|
||
|
</rule>
|
||
|
<rule pattern="(exception|and)\b(\s+)([a-zA-Z][\w']*)">
|
||
|
<bygroups>
|
||
|
<token type="KeywordReserved"/>
|
||
|
<token type="Text"/>
|
||
|
<token type="NameClass"/>
|
||
|
</bygroups>
|
||
|
</rule>
|
||
|
<rule pattern="(exception|and)\b(\s*)([!%&$#+\-/:<=>?@\\~`^|*]+)">
|
||
|
<bygroups>
|
||
|
<token type="KeywordReserved"/>
|
||
|
<token type="Text"/>
|
||
|
<token type="NameClass"/>
|
||
|
</bygroups>
|
||
|
</rule>
|
||
|
<rule pattern="\b(of)\b(?!\')">
|
||
|
<token type="KeywordReserved"/>
|
||
|
</rule>
|
||
|
<rule>
|
||
|
<include state="breakout"/>
|
||
|
</rule>
|
||
|
<rule>
|
||
|
<include state="core"/>
|
||
|
</rule>
|
||
|
<rule pattern="\S+">
|
||
|
<token type="Error"/>
|
||
|
</rule>
|
||
|
</state>
|
||
|
<state name="vname">
|
||
|
<rule>
|
||
|
<include state="whitespace"/>
|
||
|
</rule>
|
||
|
<rule pattern="\'[\w\']*">
|
||
|
<token type="NameDecorator"/>
|
||
|
</rule>
|
||
|
<rule pattern="\(">
|
||
|
<token type="Punctuation"/>
|
||
|
<push state="tyvarseq"/>
|
||
|
</rule>
|
||
|
<rule pattern="([a-zA-Z][\w']*)(\s*)(=(?![!%&$#+\-/:<=>?@\\~`^|*]+))">
|
||
|
<bygroups>
|
||
|
<token type="NameVariable"/>
|
||
|
<token type="Text"/>
|
||
|
<token type="Punctuation"/>
|
||
|
</bygroups>
|
||
|
<pop depth="1"/>
|
||
|
</rule>
|
||
|
<rule pattern="([!%&$#+\-/:<=>?@\\~`^|*]+)(\s*)(=(?![!%&$#+\-/:<=>?@\\~`^|*]+))">
|
||
|
<bygroups>
|
||
|
<token type="NameVariable"/>
|
||
|
<token type="Text"/>
|
||
|
<token type="Punctuation"/>
|
||
|
</bygroups>
|
||
|
<pop depth="1"/>
|
||
|
</rule>
|
||
|
<rule pattern="([a-zA-Z][\w']*)">
|
||
|
<token type="NameVariable"/>
|
||
|
<pop depth="1"/>
|
||
|
</rule>
|
||
|
<rule pattern="([!%&$#+\-/:<=>?@\\~`^|*]+)">
|
||
|
<token type="NameVariable"/>
|
||
|
<pop depth="1"/>
|
||
|
</rule>
|
||
|
<rule>
|
||
|
<pop depth="1"/>
|
||
|
</rule>
|
||
|
</state>
|
||
|
<state name="sname">
|
||
|
<rule>
|
||
|
<include state="whitespace"/>
|
||
|
</rule>
|
||
|
<rule>
|
||
|
<include state="breakout"/>
|
||
|
</rule>
|
||
|
<rule pattern="([a-zA-Z][\w']*)">
|
||
|
<token type="NameNamespace"/>
|
||
|
</rule>
|
||
|
<rule>
|
||
|
<pop depth="1"/>
|
||
|
</rule>
|
||
|
</state>
|
||
|
<state name="main-fun">
|
||
|
<rule>
|
||
|
<include state="whitespace"/>
|
||
|
</rule>
|
||
|
<rule pattern="\s">
|
||
|
<token type="Text"/>
|
||
|
</rule>
|
||
|
<rule pattern="\(\*">
|
||
|
<token type="CommentMultiline"/>
|
||
|
<push state="comment"/>
|
||
|
</rule>
|
||
|
<rule pattern="\b(fun|and)\b(?!\')">
|
||
|
<token type="KeywordReserved"/>
|
||
|
<push state="fname"/>
|
||
|
</rule>
|
||
|
<rule pattern="\b(val)\b(?!\')">
|
||
|
<token type="KeywordReserved"/>
|
||
|
<push state="#pop" state="main" state="vname"/>
|
||
|
</rule>
|
||
|
<rule pattern="\|">
|
||
|
<token type="Punctuation"/>
|
||
|
<push state="fname"/>
|
||
|
</rule>
|
||
|
<rule pattern="\b(case|handle)\b(?!\')">
|
||
|
<token type="KeywordReserved"/>
|
||
|
<push state="#pop" state="main"/>
|
||
|
</rule>
|
||
|
<rule>
|
||
|
<include state="delimiters"/>
|
||
|
</rule>
|
||
|
<rule>
|
||
|
<include state="core"/>
|
||
|
</rule>
|
||
|
<rule pattern="\S+">
|
||
|
<token type="Error"/>
|
||
|
</rule>
|
||
|
</state>
|
||
|
<state name="datcon">
|
||
|
<rule>
|
||
|
<include state="whitespace"/>
|
||
|
</rule>
|
||
|
<rule pattern="([a-zA-Z][\w']*)">
|
||
|
<token type="NameClass"/>
|
||
|
<pop depth="1"/>
|
||
|
</rule>
|
||
|
<rule pattern="([!%&$#+\-/:<=>?@\\~`^|*]+)">
|
||
|
<token type="NameClass"/>
|
||
|
<pop depth="1"/>
|
||
|
</rule>
|
||
|
<rule pattern="\S+">
|
||
|
<token type="Error"/>
|
||
|
<pop depth="1"/>
|
||
|
</rule>
|
||
|
</state>
|
||
|
<state name="dotted">
|
||
|
<rule pattern="([a-zA-Z][\w']*)(\.)">
|
||
|
<token type="NameNamespace"/>
|
||
|
</rule>
|
||
|
<rule pattern="([a-zA-Z][\w']*)">
|
||
|
<token type="Name"/>
|
||
|
<pop depth="1"/>
|
||
|
</rule>
|
||
|
<rule pattern="([!%&$#+\-/:<=>?@\\~`^|*]+)">
|
||
|
<token type="Name"/>
|
||
|
<pop depth="1"/>
|
||
|
</rule>
|
||
|
<rule pattern="\s+">
|
||
|
<token type="Error"/>
|
||
|
</rule>
|
||
|
<rule pattern="\S+">
|
||
|
<token type="Error"/>
|
||
|
</rule>
|
||
|
</state>
|
||
|
<state name="main">
|
||
|
<rule>
|
||
|
<include state="whitespace"/>
|
||
|
</rule>
|
||
|
<rule pattern="\b(val|and)\b(?!\')">
|
||
|
<token type="KeywordReserved"/>
|
||
|
<push state="vname"/>
|
||
|
</rule>
|
||
|
<rule pattern="\b(fun)\b(?!\')">
|
||
|
<token type="KeywordReserved"/>
|
||
|
<push state="#pop" state="main-fun" state="fname"/>
|
||
|
</rule>
|
||
|
<rule>
|
||
|
<include state="delimiters"/>
|
||
|
</rule>
|
||
|
<rule>
|
||
|
<include state="core"/>
|
||
|
</rule>
|
||
|
<rule pattern="\S+">
|
||
|
<token type="Error"/>
|
||
|
</rule>
|
||
|
</state>
|
||
|
<state name="comment">
|
||
|
<rule pattern="[^(*)]">
|
||
|
<token type="CommentMultiline"/>
|
||
|
</rule>
|
||
|
<rule pattern="\(\*">
|
||
|
<token type="CommentMultiline"/>
|
||
|
<push/>
|
||
|
</rule>
|
||
|
<rule pattern="\*\)">
|
||
|
<token type="CommentMultiline"/>
|
||
|
<pop depth="1"/>
|
||
|
</rule>
|
||
|
<rule pattern="[(*)]">
|
||
|
<token type="CommentMultiline"/>
|
||
|
</rule>
|
||
|
</state>
|
||
|
<state name="whitespace">
|
||
|
<rule pattern="\s+">
|
||
|
<token type="Text"/>
|
||
|
</rule>
|
||
|
<rule pattern="\(\*">
|
||
|
<token type="CommentMultiline"/>
|
||
|
<push state="comment"/>
|
||
|
</rule>
|
||
|
</state>
|
||
|
<state name="core">
|
||
|
<rule pattern="(_|\}|\{|\)|;|,|\[|\(|\]|\.\.\.)">
|
||
|
<token type="Punctuation"/>
|
||
|
</rule>
|
||
|
<rule pattern="#"">
|
||
|
<token type="LiteralStringChar"/>
|
||
|
<push state="char"/>
|
||
|
</rule>
|
||
|
<rule pattern=""">
|
||
|
<token type="LiteralStringDouble"/>
|
||
|
<push state="string"/>
|
||
|
</rule>
|
||
|
<rule pattern="~?0x[0-9a-fA-F]+">
|
||
|
<token type="LiteralNumberHex"/>
|
||
|
</rule>
|
||
|
<rule pattern="0wx[0-9a-fA-F]+">
|
||
|
<token type="LiteralNumberHex"/>
|
||
|
</rule>
|
||
|
<rule pattern="0w\d+">
|
||
|
<token type="LiteralNumberInteger"/>
|
||
|
</rule>
|
||
|
<rule pattern="~?\d+\.\d+[eE]~?\d+">
|
||
|
<token type="LiteralNumberFloat"/>
|
||
|
</rule>
|
||
|
<rule pattern="~?\d+\.\d+">
|
||
|
<token type="LiteralNumberFloat"/>
|
||
|
</rule>
|
||
|
<rule pattern="~?\d+[eE]~?\d+">
|
||
|
<token type="LiteralNumberFloat"/>
|
||
|
</rule>
|
||
|
<rule pattern="~?\d+">
|
||
|
<token type="LiteralNumberInteger"/>
|
||
|
</rule>
|
||
|
<rule pattern="#\s*[1-9][0-9]*">
|
||
|
<token type="NameLabel"/>
|
||
|
</rule>
|
||
|
<rule pattern="#\s*([a-zA-Z][\w']*)">
|
||
|
<token type="NameLabel"/>
|
||
|
</rule>
|
||
|
<rule pattern="#\s+([!%&$#+\-/:<=>?@\\~`^|*]+)">
|
||
|
<token type="NameLabel"/>
|
||
|
</rule>
|
||
|
<rule pattern="\b(datatype|abstype)\b(?!\')">
|
||
|
<token type="KeywordReserved"/>
|
||
|
<push state="dname"/>
|
||
|
</rule>
|
||
|
<rule pattern="(?=\b(exception)\b(?!\'))">
|
||
|
<token type="Text"/>
|
||
|
<push state="ename"/>
|
||
|
</rule>
|
||
|
<rule pattern="\b(functor|include|open|signature|structure)\b(?!\')">
|
||
|
<token type="KeywordReserved"/>
|
||
|
<push state="sname"/>
|
||
|
</rule>
|
||
|
<rule pattern="\b(type|eqtype)\b(?!\')">
|
||
|
<token type="KeywordReserved"/>
|
||
|
<push state="tname"/>
|
||
|
</rule>
|
||
|
<rule pattern="\'[\w\']*">
|
||
|
<token type="NameDecorator"/>
|
||
|
</rule>
|
||
|
<rule pattern="([a-zA-Z][\w']*)(\.)">
|
||
|
<token type="NameNamespace"/>
|
||
|
<push state="dotted"/>
|
||
|
</rule>
|
||
|
<rule pattern="\b(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|functor|include|sharing|sig|signature|struct|structure|where)\b">
|
||
|
<token type="KeywordReserved"/>
|
||
|
</rule>
|
||
|
<rule pattern="([a-zA-Z][\w']*)">
|
||
|
<token type="Name"/>
|
||
|
</rule>
|
||
|
<rule pattern="\b(:|\|,=|=>|->|#|:>)\b">
|
||
|
<token type="KeywordReserved"/>
|
||
|
</rule>
|
||
|
<rule pattern="([!%&$#+\-/:<=>?@\\~`^|*]+)">
|
||
|
<token type="Name"/>
|
||
|
</rule>
|
||
|
</state>
|
||
|
<state name="fname">
|
||
|
<rule>
|
||
|
<include state="whitespace"/>
|
||
|
</rule>
|
||
|
<rule pattern="\'[\w\']*">
|
||
|
<token type="NameDecorator"/>
|
||
|
</rule>
|
||
|
<rule pattern="\(">
|
||
|
<token type="Punctuation"/>
|
||
|
<push state="tyvarseq"/>
|
||
|
</rule>
|
||
|
<rule pattern="([a-zA-Z][\w']*)">
|
||
|
<token type="NameFunction"/>
|
||
|
<pop depth="1"/>
|
||
|
</rule>
|
||
|
<rule pattern="([!%&$#+\-/:<=>?@\\~`^|*]+)">
|
||
|
<token type="NameFunction"/>
|
||
|
<pop depth="1"/>
|
||
|
</rule>
|
||
|
<rule>
|
||
|
<pop depth="1"/>
|
||
|
</rule>
|
||
|
</state>
|
||
|
</rules>
|
||
|
</lexer>
|