From 63ffc40a6b955896035d2e085281bd6860ae8bdf Mon Sep 17 00:00:00 2001 From: rei <80625541+LordOfTrident@users.noreply.github.com> Date: Mon, 19 Aug 2024 21:03:41 +0200 Subject: [PATCH] Fix Ocaml syntax highlighting (#3427) * Fix (kinda) Ocaml syntax highlighting * Remove functions rule * Highlight character with escape sequence * Add suggested changes --- runtime/syntax/ocaml.yaml | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/runtime/syntax/ocaml.yaml b/runtime/syntax/ocaml.yaml index d606d1ed..d7915e54 100644 --- a/runtime/syntax/ocaml.yaml +++ b/runtime/syntax/ocaml.yaml @@ -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: "\""