Fix Ocaml syntax highlighting (#3427)

* Fix (kinda) Ocaml syntax highlighting

* Remove functions rule

* Highlight character with escape sequence

* Add suggested changes
This commit is contained in:
rei 2024-08-19 21:03:41 +02:00 committed by GitHub
parent a09c98a6dc
commit 63ffc40a6b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -17,20 +17,18 @@ rules:
- statement: "\\b(if|then|else)\\b"
#blocs
- type: "\\b(begin|end|object|struct|sig|for|while|do|done|to|downto)\\b"
- type: "'[0-9A-Za-z_]+"
#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})"
#character literal
- constant.string: "'(\\\\[0-7]{3}|\\\\x[A-Fa-f0-9]{2}|\\\\u[A-Fa-f0-9]{4}|\\\\U[A-Fa-f0-9]{8}|\\\\[abfnrtv'\\\"\\\\]|.)'"
- 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})"
#string literal
- constant.string:
start: "\""
end: "\""