diff --git a/mode/ocaml.py b/mode/ocaml.py index 5b9ca60..430e16f 100644 --- a/mode/ocaml.py +++ b/mode/ocaml.py @@ -23,6 +23,8 @@ class OcamlGrammar(Grammar): PatternRule(r'linenum', r'#[0-9]+ *(?:"(?:[^"\\]|\\[0-9]{3}|\\x[0-9A-Za-z]{2}|\\.)*")?'), + PatternRule(r'delimiter', r"[()]"), + PatternRule(r'keyword', r"(?:with|while|when|virtual|val|type|try|true|to|then|struct|sig|rec|private|parser|or|open|of|object|new|mutable|module|mod|method|match|lxor|lsr|lsl|lor|let|lazy|land|initializer|inherti|include|in|if|functor|function|fun|for|false|external|exception|end|else|downto|done|do|constraint|class|begin|asr|assert|as|and)(?!['a-zA-Z0-9_])"), PatternRule(r'builtin', r"(?:int|char|string|float|bool|false|true|unit|exn|array|list|option|int32|int64|nativeint|format4|lazy_t)(?!['a-zA-Z0-9_])"), @@ -54,10 +56,10 @@ class OcamlGrammar(Grammar): class Ocaml(mode2.Fundamental): grammar = OcamlGrammar - #opentokens = ('delimiter',) - #opentags = {'(': ')'} - #closetokens = ('delimiter',) - #closetags = {')': '('} + opentokens = ('delimiter',) + opentags = {'(': ')'} + closetokens = ('delimiter',) + closetags = {')': '('} colors = { 'comment.start': ('red', 'default'), 'comment.null': ('red', 'default'), @@ -85,8 +87,8 @@ class Ocaml(mode2.Fundamental): } def __init__(self, w): mode2.Fundamental.__init__(self, w) - #self.add_bindings('close-paren', (')',)) - #self.add_bindings('close-brace', ('}',)) - #self.add_bindings('close-bracket', (']',)) + self.add_bindings('close-paren', (')',)) + self.add_bindings('close-brace', ('}',)) + self.add_bindings('close-bracket', (']',)) def name(self): return "Ocaml"