moduleRougemoduleLexersclassOCaml<RegexLexerdesc'Objective CAML (ocaml.org)'tag'ocaml'filenames'*.ml','*.mli','*.mll','*.mly'mimetypes'text/x-ocaml'defself.keywords@keywords||=Set.new%w(
as assert begin class constraint do done downto else end
exception external false for fun function functor if in include
inherit initializer lazy let match method module mutable new
object of open private raise rec sig struct then to true try
type value val virtual when while with
)enddefself.keyopts@keyopts||=Set.new%w(
!= # & && ( ) * \+ , - -. -> . .. : :: := :> ; ;; < <- =
> >] >} ? ?? [ [< [> [| ] _ ` { {< | |] } ~
)enddefself.word_operators@word_operators||=Set.new%w(and asr land lor lsl lxor mod or)enddefself.primitives@primitives||=Set.new%w(unit int float bool string char list array)endoperator=%r([\[\];,{}_()!$%&*+./:<=>?@^|~#-]+)id=/[a-z][\w']*/iupper_id=/[A-Z][\w']*/state:rootdorule/\s+/m,Textrule/false|true|[(][)]|\[\]/,Name::Builtin::Pseudorule/#{upper_id}(?=\s*[.])/,Name::Namespace,:dottedruleupper_id,Name::Classrule/[(][*](?![)])/,Comment,:commentruleiddo|m|match=m[0]ifself.class.keywords.include?matchtokenKeywordelsifself.class.word_operators.include?matchtokenOperator::Wordelsifself.class.primitives.include?matchtokenKeyword::TypeelsetokenNameendendruleoperatordo|m|match=m[0]ifself.class.keyopts.include?matchtokenPunctuationelsetokenOperatorendendrule/-?\d[\d_]*(.[\d_]*)?(e[+-]?\d[\d_]*)/i,Num::Floatrule/0x\h[\h_]*/i,Num::Hexrule/0o[0-7][0-7_]*/i,Num::Octrule/0b[01][01_]*/i,Num::Binrule/\d[\d_]*/,Num::Integerrule/'(?:(\\[\\"'ntbr ])|(\\[0-9]{3})|(\\x\h{2}))'/,Str::Charrule/'[.]'/,Str::Charrule/'/,Keywordrule/"/,Str::Double,:stringrule/[~?]#{id}/,Name::Variableendstate:commentdorule/[^(*)]+/,Commentrule(/[(][*]/){tokenComment;push}rule/[*][)]/,Comment,:pop!rule/[(*)]/,Commentendstate:stringdorule/[^\\"]+/,Str::Doublemixin:escape_sequencerule/\\\n/,Str::Doublerule/"/,Str::Double,:pop!endstate:escape_sequencedorule/\\[\\"'ntbr]/,Str::Escaperule/\\\d{3}/,Str::Escaperule/\\x\h{2}/,Str::Escapeendstate:dotteddorule/\s+/m,Textrule/[.]/,Punctuationrule/#{upper_id}(?=\s*[.])/,Name::Namespaceruleupper_id,Name::Class,:pop!ruleid,Name,:pop!endendendend