# Objective Caml language definition file
#
# Author: Andre Simon
#   Mail: andre.simon1@gmx.de
#   Date: 17.11.2003
# ------------------------------------------
# This file is a part of highlight, a free source code converter released under the GPL.
#
# The file is used to describe keywords and special symbols of programming languages.
# See README in the highlight directory for details.
#
# New definition files for future releases of highlight are always appreciated ;)
#
# ----------
# andre.simon1@gmx.de
# http:/www.andre-simon.de/

$DESCRIPTION=Objective Caml

$KEYWORDS(kwa)=and as assert asr begin  class constraint do done downto else
end exception external false for fun function functor if in include inherit
initializer land lazy let lor lsl lsr lxor match method mod module mutable new
object of open or private rec sig struct then to true try type val virtual when
while with value

# Types and type variables
$KEYWORDS(kwb)=bool string int real word float unit option ref
$KEYWORDS(kwb)=regex('[a-zA-Z0-9_']+)

# Modules
$KEYWORDS(kwc)=regex(\b[A-Z][a-zA-Z0-9_']*(?=\.))

# Constructors
$KEYWORDS(kwd)=regex(\b[A-Z][a-zA-Z0-9_']*)

$STRINGDELIMITERS=" '

$ML_COMMENT=(* *)

$ALLOWNESTEDCOMMENTS=true

$IGNORECASE=false

$ESCCHAR=regex(\\\d{3}|\\x\p{XDigit}{2}|\\[ntvbrfa\\\?'"])

$SYMBOLS= ( ) [ ] { } , ; : & | < > !  = / * %  + - .

$DIGIT=regex((?:0x|0X|0b|0B)[0-9a-fA-F]+|\d*[\.\_]?\d+(?:[eE][\-\+]\d+)?[lLuUbfdm]*)

# This breaks keywords (kwa) for some reason:
# $IDENTIFIER=regex([a-z_][a-zA-Z0-9_']*)
