From a98b5ea6fe8e8cc98a55e0fd793e6e8660ea31c1 Mon Sep 17 00:00:00 2001 From: Armand Philippot Date: Thu, 30 Dec 2021 19:47:21 +0100 Subject: chore: add prismjs for syntax highlighting --- public/prism/prism-ocaml.min.js | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 public/prism/prism-ocaml.min.js (limited to 'public/prism/prism-ocaml.min.js') diff --git a/public/prism/prism-ocaml.min.js b/public/prism/prism-ocaml.min.js new file mode 100644 index 0000000..3c43425 --- /dev/null +++ b/public/prism/prism-ocaml.min.js @@ -0,0 +1,27 @@ +Prism.languages.ocaml = { + comment: { pattern: /\(\*[\s\S]*?\*\)/, greedy: !0 }, + char: { pattern: /'(?:[^\\\r\n']|\\(?:.|[ox]?[0-9a-f]{1,3}))'/i, greedy: !0 }, + string: [ + { pattern: /"(?:\\(?:[\s\S]|\r\n)|[^\\\r\n"])*"/, greedy: !0 }, + { pattern: /\{([a-z_]*)\|[\s\S]*?\|\1\}/, greedy: !0 }, + ], + number: [ + /\b(?:0b[01][01_]*|0o[0-7][0-7_]*)\b/i, + /\b0x[a-f0-9][a-f0-9_]*(?:\.[a-f0-9_]*)?(?:p[+-]?\d[\d_]*)?(?!\w)/i, + /\b\d[\d_]*(?:\.[\d_]*)?(?:e[+-]?\d[\d_]*)?(?!\w)/i, + ], + directive: { pattern: /\B#\w+/, alias: 'property' }, + label: { pattern: /\B~\w+/, alias: 'property' }, + 'type-variable': { pattern: /\B'\w+/, alias: 'function' }, + variant: { pattern: /`\w+/, alias: 'symbol' }, + keyword: + /\b(?:as|assert|begin|class|constraint|do|done|downto|else|end|exception|external|for|fun|function|functor|if|in|include|inherit|initializer|lazy|let|match|method|module|mutable|new|nonrec|object|of|open|private|rec|sig|struct|then|to|try|type|val|value|virtual|when|where|while|with)\b/, + boolean: /\b(?:false|true)\b/, + 'operator-like-punctuation': { + pattern: /\[[<>|]|[>|]\]|\{<|>\}/, + alias: 'punctuation', + }, + operator: + /\.[.~]|:[=>]|[=<>@^|&+\-*\/$%!?~][!$%&*+\-.\/:<=>?@^|~]*|\b(?:and|asr|land|lor|lsl|lsr|lxor|mod|or)\b/, + punctuation: /;;|::|[(){}\[\].,:;#]|\b_\b/, +}; -- cgit v1.2.3