1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 | function sml(hljs) {
|
10 | return {
|
11 | name: 'SML (Standard ML)',
|
12 | aliases: [ 'ml' ],
|
13 | keywords: {
|
14 | $pattern: '[a-z_]\\w*!?',
|
15 | keyword:
|
16 |
|
17 | 'abstype and andalso as case datatype do else end eqtype ' +
|
18 | 'exception fn fun functor handle if in include infix infixr ' +
|
19 | 'let local nonfix of op open orelse raise rec sharing sig ' +
|
20 | 'signature struct structure then type val with withtype where while',
|
21 | built_in:
|
22 |
|
23 | 'array bool char exn int list option order real ref string substring vector unit word',
|
24 | literal:
|
25 | 'true false NONE SOME LESS EQUAL GREATER nil'
|
26 | },
|
27 | illegal: /\/\/|>>/,
|
28 | contains: [
|
29 | {
|
30 | className: 'literal',
|
31 | begin: /\[(\|\|)?\]|\(\)/,
|
32 | relevance: 0
|
33 | },
|
34 | hljs.COMMENT(
|
35 | '\\(\\*',
|
36 | '\\*\\)',
|
37 | {
|
38 | contains: [ 'self' ]
|
39 | }
|
40 | ),
|
41 | {
|
42 | className: 'symbol',
|
43 | begin: '\'[A-Za-z_](?!\')[\\w\']*'
|
44 |
|
45 | },
|
46 | {
|
47 | className: 'type',
|
48 | begin: '`[A-Z][\\w\']*'
|
49 | },
|
50 | {
|
51 | className: 'type',
|
52 | begin: '\\b[A-Z][\\w\']*',
|
53 | relevance: 0
|
54 | },
|
55 | {
|
56 | begin: '[a-z_]\\w*\'[\\w\']*'
|
57 | },
|
58 | hljs.inherit(hljs.APOS_STRING_MODE, {
|
59 | className: 'string',
|
60 | relevance: 0
|
61 | }),
|
62 | hljs.inherit(hljs.QUOTE_STRING_MODE, {
|
63 | illegal: null
|
64 | }),
|
65 | {
|
66 | className: 'number',
|
67 | begin:
|
68 | '\\b(0[xX][a-fA-F0-9_]+[Lln]?|' +
|
69 | '0[oO][0-7_]+[Lln]?|' +
|
70 | '0[bB][01_]+[Lln]?|' +
|
71 | '[0-9][0-9_]*([Lln]|(\\.[0-9_]*)?([eE][-+]?[0-9_]+)?)?)',
|
72 | relevance: 0
|
73 | },
|
74 | {
|
75 | begin: /[-=]>/
|
76 | }
|
77 | ]
|
78 | };
|
79 | }
|
80 |
|
81 | export { sml as default };
|