]> git.lizzy.rs Git - micro.git/commitdiff
Improve ocaml syntax highlighting
authorZachary Yedidia <zyedidia@gmail.com>
Wed, 31 Jan 2018 03:34:44 +0000 (22:34 -0500)
committerZachary Yedidia <zyedidia@gmail.com>
Wed, 31 Jan 2018 03:34:44 +0000 (22:34 -0500)
cmd/micro/runtime.go
runtime/syntax/ocaml.yaml

index cad13caea3612ad88a1357a2cdfa5571a2efedb4..982723788bbae349a95d0684b65e717ff3d9edf9 100644 (file)
@@ -2528,7 +2528,7 @@ func runtimeSyntaxObjcYaml() (*asset, error) {
        return a, nil
 }
 
-var _runtimeSyntaxOcamlYaml = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xac\x92\x4f\x6b\xf3\x30\x0c\xc6\xef\xf9\x14\x22\x79\x0f\x69\x5f\x1c\xb2\xd3\x58\x2e\x61\xdd\x1f\xb6\xcb\x3a\x76\x1a\x58\x66\xb8\x89\x3a\x02\xb1\x53\x62\x15\xda\x6f\x3f\xec\x94\xa4\x85\xad\xa3\x30\x41\x82\x1e\xc9\x3f\xf9\xc1\x68\xdd\xb4\xc4\xfb\x0d\x15\xd0\x55\xda\xb4\x51\x54\x13\x53\xc5\x45\x04\x00\xe0\x9b\x56\x1b\x2a\x20\x46\xcc\x4c\xdb\x94\xff\xe2\x28\xea\xb7\x2d\xb9\xe1\x40\x02\x2f\x5b\xb3\xa2\xde\x0d\x2a\x81\x67\xcb\xf4\x39\xe9\x04\x16\x8d\xd5\xfd\x3e\x48\x01\x55\x67\x1d\x6b\xcb\x99\x0d\x54\x01\xb1\x28\x73\xb9\x5a\x28\x99\x5f\xf9\xef\x43\xcd\xe3\x91\x5c\x56\xac\xdb\xb3\x60\xb7\x54\x32\x17\xd7\xe1\x77\x82\xde\x53\xd5\x98\xb3\x30\x62\x2d\x11\xeb\x13\xea\x89\x76\xba\xfe\x95\xcc\xe5\xee\xdd\xdf\x78\xa3\xc5\xfa\x56\x3c\x1e\xa5\x47\xc3\xe0\x8d\x0e\x43\x2e\xb5\x93\x4d\x69\x2a\xe9\x41\xc9\xff\x42\x7d\xdb\x9d\x95\x7f\xea\x3c\xfb\xa9\x91\xca\xcd\x6b\x70\x71\x31\x39\x3a\x84\xbb\xce\x18\xb2\xec\x46\x73\x41\x0e\x2b\xe4\xc3\xb1\xee\x39\x2c\x59\x8a\x78\x78\x44\x1f\x64\xeb\x50\x9d\x23\xce\xa6\xea\xb0\x7f\x20\xd5\x57\x00\x00\x00\xff\xff\x85\xab\x4f\xff\xbc\x02\x00\x00")
+var _runtimeSyntaxOcamlYaml = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xe4\x93\xcd\x6e\xdb\x3a\x10\x85\xf7\x7e\x0a\xc2\xf7\x5e\xe4\x07\x57\x69\x90\x16\x68\xe3\x4d\x11\x14\xe8\x1b\x74\x53\xd3\x28\x46\xe4\x28\x9a\x96\x1a\x0a\xe4\xc8\x76\x92\xf1\xbb\x17\x92\xa3\x54\xce\x1f\xda\x75\xbd\x31\x79\x34\x73\xce\xf0\x23\x58\x51\x40\xb9\x69\x71\x61\xa2\x83\x26\xcc\x66\x1e\x05\x9d\x2c\x66\xc6\x18\xd3\x7f\x64\x68\x70\x61\xe6\xd6\x9e\x35\x81\x3e\xfe\x3b\x9f\xcd\x52\x17\x30\xef\x0b\x0a\x43\x1e\x59\xa8\x22\x4c\x43\x51\xb9\xbc\x2a\xbe\xae\x96\xe7\xc5\x25\x14\xb7\xdf\x56\x77\x17\xff\xef\xac\x2d\xe7\x43\xb1\x31\xff\x78\x74\x01\x12\x08\x45\xce\xf7\x06\x59\x40\xb0\x41\x96\x7d\xff\x71\x40\xd1\x35\x04\x6d\x50\xea\xe8\x95\x58\x81\xbd\x26\x74\xda\x26\x5a\x83\xa0\xae\x29\x49\x07\x41\x5d\xe4\x2c\x09\x88\xe5\x64\x9a\x91\x25\x75\x4e\xba\x84\x86\x04\x9b\x31\x66\x7f\xc6\x21\xa1\x5f\x6a\x6c\x91\xd5\x05\xc8\x59\x9b\xe8\xbb\x80\x8a\x5b\x87\x6d\x3f\x99\xe2\x56\x30\x31\x84\x03\xdb\x16\xa4\x57\x5f\x1a\xbb\xea\x58\xab\x8e\xdd\x60\x30\x2c\x62\xd2\x06\xc4\xd5\x2a\xe9\x46\x37\x24\xf5\xb3\x76\x45\x13\xfd\x80\xef\x25\x63\xc8\xba\xa9\x91\x35\x56\x43\xbf\x19\x0d\x5c\x64\x4f\xaf\x81\xa4\x4a\xa5\x6f\xc4\x90\xf1\x20\xba\x0c\xd1\x3d\x83\xa5\xc4\x6b\x62\x45\xf6\x1a\xcb\xef\xe8\x44\xf7\x20\x35\xd3\xb5\x56\x31\xe9\xa6\xa6\x80\xea\xa3\xfa\xc8\xa8\xd2\xff\x6f\x58\xe2\x81\xf5\x70\x25\xc0\x82\xa3\xff\x28\x9c\x95\x31\x86\x91\x7f\xea\x50\x2b\x78\x3c\xd6\xfe\x1a\xf2\x9b\xe1\x52\x1e\x0c\x72\x8b\x8e\x60\x6c\x25\x76\xa1\xf3\xa8\xc4\x35\x26\x12\x25\x26\x21\x08\x74\x8b\xe9\xc0\x0b\xb7\x6d\x32\x4f\xc8\x1e\x58\x31\x6e\x34\x61\xa5\x4d\x27\x50\x06\xd4\x00\xb7\x37\xda\x27\x27\xd1\x04\x34\x1d\x6e\x72\x8c\x2c\x89\xf8\x7a\x71\x9f\x63\x7a\xe8\xa9\x07\x7e\x34\x7f\x90\x90\xfd\xa1\x90\x7f\x50\x3b\x84\x5a\x7b\xf6\x4b\x9d\xbc\xa2\xf1\x37\xcd\xd9\xcf\xfa\xa9\x86\xfe\x5d\xfd\x37\xe9\x7b\xb5\xb0\xcf\x58\x42\x59\x71\x92\xf5\x91\xb5\x76\x10\x56\x7f\xd0\x7c\xbc\x3c\x2f\xde\xaf\xee\xde\xee\x74\xbb\xbc\x2a\x3e\x43\x51\x9d\x17\x97\xab\xbb\x8b\x9d\x76\xd3\xfd\xbb\x9d\x7e\x99\xee\x3f\xec\x4e\x7e\x1b\x95\x9d\x3f\x66\x35\x55\xfe\x36\x58\xcd\xf0\x62\x9f\x42\xb2\xc7\xd6\x9e\x3e\x01\x65\x4f\xad\x3d\x79\x8c\xc5\x2c\x57\xb3\x9f\x01\x00\x00\xff\xff\xe2\xce\x5b\x59\xc7\x05\x00\x00")
 
 func runtimeSyntaxOcamlYamlBytes() ([]byte, error) {
        return bindataRead(
index 9fc0418df05cf878c1cae76412b19d0a6ec0510b..006fbedf1d6c0f01072b95d9256415c3998fc18b 100644 (file)
@@ -4,23 +4,42 @@ detect:
     filename: "\\.mli?$"
 
 rules:
-    # Numbers
-    ## Integers
-    ### Binary
-    - constant.number: "-?0[bB][01][01_]*"
-    ### Octal
-    - constant.number: "-?0[oO][0-7][0-7_]*"
-    ### Decimal
-    - constant.number: "-?\\d[\\d_]*"
-    ### Hexadecimal
-    - constant.number: "-?0[xX][0-9a-fA-F][0-9a-fA-F_]*"
-    ## Real
-    ### Decimal
-    - constant.number: "-?\\d[\\d_]*.\\d[\\d_]*([eE][+-]\\d[\\d_]*.\\d[\\d_]*)?"
-    ### Hexadecimal
-    - constant.number: "-?0[xX][0-9a-fA-F][0-9a-fA-F_]*.[0-9a-fA-F][0-9a-fA-F_]*([pP][+-][0-9a-fA-F][0-9a-fA-F_]*.[0-9a-fA-F][0-9a-fA-F_]*)?"
-    # Comments
+    - identifier: "\\b[A-Z][0-9a-z_]{2,}\\b"
+      #declarations
+    - statement: "\\b(let|val|method|in|and|rec|private|virtual|constraint)\\b"
+      #structure items
+    - type: "\\b(type|open|class|module|exception|external)\\b"
+      #patterns
+    - statement: "\\b(fun|function|functor|match|try|with)\\b"
+      #patterns-modifiers
+    - statement: "\\b(as|when|of)\\b" 
+      #conditions
+    - statement: "\\b(if|then|else)\\b"
+      #blocs
+    - type: "\\b(begin|end|object|struct|sig|for|while|do|done|to|downto)\\b"
+      #constantes
+    - constant.bool: "\\b(true|false)\\b"
+      #modules/classes
+    - special: "\\b(include|inherit|initializer)\\b"
+      #expr modifiers
+    - special: "\\b(new|ref|mutable|lazy|assert|raise)\\b"
+    - constant.string:
+        start: "'"
+        end: "'"
+        skip: "\\\\."
+        rules:
+            - constant.specialChar: "%."
+            - constant.specialChar: "\\\\[abfnrtv'\\\"\\\\]"
+            - constant.specialChar: "\\\\([0-7]{3}|x[A-Fa-f0-9]{2}|u[A-Fa-f0-9]{4}|U[A-Fa-f0-9]{8})"
+    - constant.string:
+        start: "\""
+        end: "\""
+        skip: "\\\\."
+        rules:
+            - constant.specialChar: "%."
+            - constant.specialChar: "\\\\[abfnrtv'\\\"\\\\]"
+            - constant.specialChar: "\\\\([0-7]{3}|x[A-Fa-f0-9]{2}|u[A-Fa-f0-9]{4}|U[A-Fa-f0-9]{8})"
     - comment:
         start: "\\(\\*"
         end: "\\*\\)"
-        rules: []
\ No newline at end of file
+        rules: []