]>
luflow.net public git repositories - flow-web.git/blob - static/highlight/languages/sml.js
1 /*! `sml` grammar compiled for Highlight.js 11.11.1 */
3 var hljsGrammar
= (function () {
7 Language: SML (Standard ML)
8 Author: Edwin Dalorzo <edwin@dalorzo.org>
9 Description: SML language definition.
10 Website: https://www.smlnj.org
16 name: 'SML (Standard ML)',
19 $pattern: '[a-z_]\\w*!?',
21 /* according to Definition of Standard ML 97 */
22 'abstype and andalso as case datatype do else end eqtype '
23 + 'exception fn fun functor handle if in include infix infixr '
24 + 'let local nonfix of op open orelse raise rec sharing sig '
25 + 'signature struct structure then type val with withtype where while',
27 /* built-in types according to basis library */
28 'array bool char exn int list option order real ref string substring vector unit word',
30 'true false NONE SOME LESS EQUAL GREATER nil'
36 begin: /\[(\|\|)?\]|\(\)/,
42 { contains: [ 'self' ] }
46 begin: '\'[A-Za-z_](?!\')[\\w\']*'
47 /* the grammar is ambiguous on how 'a'b should be interpreted but not the compiler */
49 { /* polymorphic variant */
51 begin: '`[A-Z][\\w\']*'
53 { /* module or constructor */
55 begin: '\\b[A-Z][\\w\']*',
58 { /* don't color identifiers, but safely catch all identifiers with ' */
59 begin: '[a-z_]\\w*\'[\\w\']*' },
60 hljs
.inherit(hljs
.APOS_STRING_MODE
, {
64 hljs
.inherit(hljs
.QUOTE_STRING_MODE
, { illegal: null }),
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_]+)?)?)',
74 { begin: /[-=]>/ // relevance booster
84 hljs
.registerLanguage('sml', hljsGrammar
);