]> luflow.net public git repositories - flow-web.git/blob - static/highlight/es/languages/sml.js
Initial commit.
[flow-web.git] / static / highlight / es / languages / sml.js
1 /*! `sml` grammar compiled for Highlight.js 11.11.1 */
2 var hljsGrammar = (function () {
3 'use strict';
4
5 /*
6 Language: SML (Standard ML)
7 Author: Edwin Dalorzo <edwin@dalorzo.org>
8 Description: SML language definition.
9 Website: https://www.smlnj.org
10 Origin: ocaml.js
11 Category: functional
12 */
13 function sml(hljs) {
14 return {
15 name: 'SML (Standard ML)',
16 aliases: [ 'ml' ],
17 keywords: {
18 $pattern: '[a-z_]\\w*!?',
19 keyword:
20 /* according to Definition of Standard ML 97 */
21 'abstype and andalso as case datatype do else end eqtype '
22 + 'exception fn fun functor handle if in include infix infixr '
23 + 'let local nonfix of op open orelse raise rec sharing sig '
24 + 'signature struct structure then type val with withtype where while',
25 built_in:
26 /* built-in types according to basis library */
27 'array bool char exn int list option order real ref string substring vector unit word',
28 literal:
29 'true false NONE SOME LESS EQUAL GREATER nil'
30 },
31 illegal: /\/\/|>>/,
32 contains: [
33 {
34 className: 'literal',
35 begin: /\[(\|\|)?\]|\(\)/,
36 relevance: 0
37 },
38 hljs.COMMENT(
39 '\\(\\*',
40 '\\*\\)',
41 { contains: [ 'self' ] }
42 ),
43 { /* type variable */
44 className: 'symbol',
45 begin: '\'[A-Za-z_](?!\')[\\w\']*'
46 /* the grammar is ambiguous on how 'a'b should be interpreted but not the compiler */
47 },
48 { /* polymorphic variant */
49 className: 'type',
50 begin: '`[A-Z][\\w\']*'
51 },
52 { /* module or constructor */
53 className: 'type',
54 begin: '\\b[A-Z][\\w\']*',
55 relevance: 0
56 },
57 { /* don't color identifiers, but safely catch all identifiers with ' */
58 begin: '[a-z_]\\w*\'[\\w\']*' },
59 hljs.inherit(hljs.APOS_STRING_MODE, {
60 className: 'string',
61 relevance: 0
62 }),
63 hljs.inherit(hljs.QUOTE_STRING_MODE, { illegal: null }),
64 {
65 className: 'number',
66 begin:
67 '\\b(0[xX][a-fA-F0-9_]+[Lln]?|'
68 + '0[oO][0-7_]+[Lln]?|'
69 + '0[bB][01_]+[Lln]?|'
70 + '[0-9][0-9_]*([Lln]|(\\.[0-9_]*)?([eE][-+]?[0-9_]+)?)?)',
71 relevance: 0
72 },
73 { begin: /[-=]>/ // relevance booster
74 }
75 ]
76 };
77 }
78
79 return sml;
80
81 })();
82 ;
83 export default hljsGrammar;