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

View File

@@ -17,20 +17,18 @@ rules:
- statement: "\\b(if|then|else)\\b" - statement: "\\b(if|then|else)\\b"
#blocs #blocs
- type: "\\b(begin|end|object|struct|sig|for|while|do|done|to|downto)\\b" - type: "\\b(begin|end|object|struct|sig|for|while|do|done|to|downto)\\b"
- type: "'[0-9A-Za-z_]+"
#constantes #constantes
- constant.bool: "\\b(true|false)\\b" - constant.bool: "\\b(true|false)\\b"
#modules/classes #modules/classes
- special: "\\b(include|inherit|initializer)\\b" - special: "\\b(include|inherit|initializer)\\b"
#expr modifiers #expr modifiers
- special: "\\b(new|ref|mutable|lazy|assert|raise)\\b" - special: "\\b(new|ref|mutable|lazy|assert|raise)\\b"
- constant.string: #character literal
start: "'" - constant.string: "'(\\\\[0-7]{3}|\\\\x[A-Fa-f0-9]{2}|\\\\u[A-Fa-f0-9]{4}|\\\\U[A-Fa-f0-9]{8}|\\\\[abfnrtv'\\\"\\\\]|.)'"
end: "'" - constant.specialChar: "\\\\[abfnrtv'\\\"\\\\]"
skip: "\\\\." - constant.specialChar: "\\\\([0-7]{3}|x[A-Fa-f0-9]{2}|u[A-Fa-f0-9]{4}|U[A-Fa-f0-9]{8})"
rules: #string literal
- 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: - constant.string:
start: "\"" start: "\""
end: "\"" end: "\""