source: node_modules/refractor/lang/reason.js

main
Last change on this file was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago

Initial commit

  • Property mode set to 100644
File size: 1.3 KB
Line 
1'use strict'
2
3module.exports = reason
4reason.displayName = 'reason'
5reason.aliases = []
6function reason(Prism) {
7 Prism.languages.reason = Prism.languages.extend('clike', {
8 string: {
9 pattern: /"(?:\\(?:\r\n|[\s\S])|[^\\\r\n"])*"/,
10 greedy: true
11 },
12 // 'class-name' must be matched *after* 'constructor' defined below
13 'class-name': /\b[A-Z]\w*/,
14 keyword:
15 /\b(?:and|as|assert|begin|class|constraint|do|done|downto|else|end|exception|external|for|fun|function|functor|if|in|include|inherit|initializer|lazy|let|method|module|mutable|new|nonrec|object|of|open|or|private|rec|sig|struct|switch|then|to|try|type|val|virtual|when|while|with)\b/,
16 operator:
17 /\.{3}|:[:=]|\|>|->|=(?:==?|>)?|<=?|>=?|[|^?'#!~`]|[+\-*\/]\.?|\b(?:asr|land|lor|lsl|lsr|lxor|mod)\b/
18 })
19 Prism.languages.insertBefore('reason', 'class-name', {
20 char: {
21 pattern: /'(?:\\x[\da-f]{2}|\\o[0-3][0-7][0-7]|\\\d{3}|\\.|[^'\\\r\n])'/,
22 greedy: true
23 },
24 // Negative look-ahead prevents from matching things like String.capitalize
25 constructor: /\b[A-Z]\w*\b(?!\s*\.)/,
26 label: {
27 pattern: /\b[a-z]\w*(?=::)/,
28 alias: 'symbol'
29 }
30 }) // We can't match functions property, so let's not even try.
31 delete Prism.languages.reason.function
32}
Note: See TracBrowser for help on using the repository browser.