Added support for SML (#2537)
This commit is contained in:
parent
3b4f14caf0
commit
cb75d9e265
File diff suppressed because one or more lines are too long
|
@ -1053,6 +1053,14 @@
|
|||
"require": "markup-templating",
|
||||
"owner": "Golmote"
|
||||
},
|
||||
"sml": {
|
||||
"title": "SML",
|
||||
"alias": "smlnj",
|
||||
"aliasTitles": {
|
||||
"smlnj": "SML/NJ"
|
||||
},
|
||||
"owner": "RunDevelopment"
|
||||
},
|
||||
"solidity": {
|
||||
"title": "Solidity (Ethereum)",
|
||||
"alias": "sol",
|
||||
|
|
|
@ -0,0 +1,68 @@
|
|||
// https://smlfamily.github.io/sml97-defn.pdf
|
||||
// https://people.mpi-sws.org/~rossberg/sml.html
|
||||
(function (Prism) {
|
||||
|
||||
var keywords = /\b(?:abstype|and|andalso|as|case|datatype|do|else|end|eqtype|exception|fn|fun|functor|handle|if|in|include|infix|infixr|let|local|nonfix|of|op|open|orelse|raise|rec|sharing|sig|signature|struct|structure|then|type|val|where|while|with|withtype)\b/i;
|
||||
|
||||
Prism.languages.sml = {
|
||||
// allow one level of nesting
|
||||
'comment': /\(\*(?:[^*(]|\*(?!\))|\((?!\*)|\(\*(?:[^*(]|\*(?!\))|\((?!\*))*\*\))*\*\)/,
|
||||
'string': {
|
||||
pattern: /#?"(?:[^"\\]|\\.)*"/,
|
||||
greedy: true
|
||||
},
|
||||
|
||||
'class-name': [
|
||||
{
|
||||
// This is only an approximation since the real grammar is context-free
|
||||
//
|
||||
// Why the main loop so complex?
|
||||
// The main loop is approximately the same as /(?:\s*(?:[*,]|->)\s*<TERMINAL>)*/ which is, obviously, a lot
|
||||
// simpler. The difference is that if a comma is the last iteration of the loop, then the terminal must be
|
||||
// followed by a long identifier.
|
||||
pattern: RegExp(
|
||||
/((?:^|[^:]):\s*)<TERMINAL>(?:\s*(?:(?:\*|->)\s*<TERMINAL>|,\s*<TERMINAL>(?:(?=<NOT-LAST>)|(?!<NOT-LAST>)\s+<LONG-ID>)))*/.source
|
||||
.replace(/<NOT-LAST>/g, function () { return /\s*(?:[*,]|->)/.source; })
|
||||
.replace(/<TERMINAL>/g, function () {
|
||||
return /(?:'[\w']*|<LONG-ID>|\((?:[^()]|\([^()]*\))*\)|\{(?:[^{}]|\{[^{}]*\})*\})(?:\s+<LONG-ID>)*/.source;
|
||||
})
|
||||
.replace(/<LONG-ID>/g, function () { return /(?!<KEYWORD>)[a-z\d_][\w'.]*/.source; })
|
||||
.replace(/<KEYWORD>/g, function () { return keywords.source; }),
|
||||
'i'
|
||||
),
|
||||
lookbehind: true,
|
||||
greedy: true,
|
||||
inside: null // see below
|
||||
},
|
||||
{
|
||||
pattern: /((?:^|[^\w'])(?:datatype|exception|functor|signature|structure|type)\s+)[a-z_][\w'.]*/i,
|
||||
lookbehind: true
|
||||
}
|
||||
],
|
||||
'function': {
|
||||
pattern: /((?:^|[^\w'])fun\s+)[a-z_][\w'.]*/i,
|
||||
lookbehind: true
|
||||
},
|
||||
|
||||
'keyword': keywords,
|
||||
'variable': {
|
||||
pattern: /(^|[^\w'])'[\w']*/,
|
||||
lookbehind: true,
|
||||
},
|
||||
|
||||
'number': /~?\b(?:\d+(?:\.\d+)?(?:e~?\d+)?|0x[\da-f]+)\b/i,
|
||||
'word': {
|
||||
pattern: /\b0w(?:\d+|x[\da-f]+)\b/i,
|
||||
alias: 'constant'
|
||||
},
|
||||
|
||||
'boolean': /\b(?:false|true)\b/i,
|
||||
'operator': /\.\.\.|:[>=:]|=>?|->|[<>]=?|[!+\-*/^#|@~]/,
|
||||
'punctuation': /[(){}\[\].:,;]/
|
||||
};
|
||||
|
||||
Prism.languages.sml['class-name'][0].inside = Prism.languages.sml;
|
||||
|
||||
Prism.languages.smlnj = Prism.languages.sml;
|
||||
|
||||
}(Prism));
|
|
@ -0,0 +1 @@
|
|||
!function(e){var n=/\b(?:abstype|and|andalso|as|case|datatype|do|else|end|eqtype|exception|fn|fun|functor|handle|if|in|include|infix|infixr|let|local|nonfix|of|op|open|orelse|raise|rec|sharing|sig|signature|struct|structure|then|type|val|where|while|with|withtype)\b/i;e.languages.sml={comment:/\(\*(?:[^*(]|\*(?!\))|\((?!\*)|\(\*(?:[^*(]|\*(?!\))|\((?!\*))*\*\))*\*\)/,string:{pattern:/#?"(?:[^"\\]|\\.)*"/,greedy:!0},"class-name":[{pattern:RegExp("((?:^|[^:]):\\s*)<TERMINAL>(?:\\s*(?:(?:\\*|->)\\s*<TERMINAL>|,\\s*<TERMINAL>(?:(?=<NOT-LAST>)|(?!<NOT-LAST>)\\s+<LONG-ID>)))*".replace(/<NOT-LAST>/g,function(){return"\\s*(?:[*,]|->)"}).replace(/<TERMINAL>/g,function(){return"(?:'[\\w']*|<LONG-ID>|\\((?:[^()]|\\([^()]*\\))*\\)|\\{(?:[^{}]|\\{[^{}]*\\})*\\})(?:\\s+<LONG-ID>)*"}).replace(/<LONG-ID>/g,function(){return"(?!<KEYWORD>)[a-z\\d_][\\w'.]*"}).replace(/<KEYWORD>/g,function(){return n.source}),"i"),lookbehind:!0,greedy:!0,inside:null},{pattern:/((?:^|[^\w'])(?:datatype|exception|functor|signature|structure|type)\s+)[a-z_][\w'.]*/i,lookbehind:!0}],function:{pattern:/((?:^|[^\w'])fun\s+)[a-z_][\w'.]*/i,lookbehind:!0},keyword:n,variable:{pattern:/(^|[^\w'])'[\w']*/,lookbehind:!0},number:/~?\b(?:\d+(?:\.\d+)?(?:e~?\d+)?|0x[\da-f]+)\b/i,word:{pattern:/\b0w(?:\d+|x[\da-f]+)\b/i,alias:"constant"},boolean:/\b(?:false|true)\b/i,operator:/\.\.\.|:[>=:]|=>?|->|[<>]=?|[!+\-*/^#|@~]/,punctuation:/[(){}\[\].:,;]/},e.languages.sml["class-name"][0].inside=e.languages.sml,e.languages.smlnj=e.languages.sml}(Prism);
|
|
@ -0,0 +1,43 @@
|
|||
<h2>Full example</h2>
|
||||
<pre><code>(* source: https://github.com/HarrisonGrodin/ml-numbers/blob/ba35c763092052e391871edf224f17474c6231b1/src/Rational.sml *)
|
||||
|
||||
structure Rational :> RATIONAL =
|
||||
struct
|
||||
type t = int * int (* (a,b) invariant: a,b coprime; b nonnegative *)
|
||||
|
||||
local
|
||||
val rec gcd = fn
|
||||
(m,0) => m
|
||||
| (m,n) => gcd (n, m mod n)
|
||||
in
|
||||
infix 8 //
|
||||
val op // = fn (x,y) => (
|
||||
let
|
||||
val gcd = gcd (x,y)
|
||||
in
|
||||
(x div gcd, y div gcd)
|
||||
end
|
||||
)
|
||||
end
|
||||
|
||||
val show = Fn.id
|
||||
|
||||
val zero = (0,1)
|
||||
val one = (1,1)
|
||||
|
||||
val eq : t * t -> bool = (op =)
|
||||
val compare = fn ((a,b),(x,y)) => Int.compare (a * y, b * x)
|
||||
val toString = fn (x,y) => Int.toString x ^ " // " ^ Int.toString y
|
||||
val percent =
|
||||
Fn.curry (Fn.flip (op ^)) "%"
|
||||
o Int.toString
|
||||
o (fn (a,b) => (100 * a) div b)
|
||||
|
||||
val op + = fn ((a,b),(x,y)) => (a * y + b * x) // (b * y)
|
||||
val ~ = fn (a,b) => (~a,b)
|
||||
val op - = fn (r1,r2) => r1 + ~r2
|
||||
|
||||
val op * = fn ((a,b),(x,y)) => (a * x) // (b * y)
|
||||
val inv = Fn.flip (op //)
|
||||
val op / = fn (r1,r2) => r1 * inv r2
|
||||
end</code></pre>
|
|
@ -207,6 +207,7 @@
|
|||
"rb": "ruby",
|
||||
"sh-session": "shell-session",
|
||||
"shellsession": "shell-session",
|
||||
"smlnj": "sml",
|
||||
"sol": "solidity",
|
||||
"sln": "solution-file",
|
||||
"rq": "sparql",
|
||||
|
|
|
@ -1 +1 @@
|
|||
!function(){if("undefined"!=typeof self&&self.Prism&&self.document&&document.createElement){var l={javascript:"clike",actionscript:"javascript",arduino:"cpp",aspnet:["markup","csharp"],birb:"clike",bison:"c",c:"clike",csharp:"clike",cpp:"c",coffeescript:"javascript",crystal:"ruby","css-extras":"css",d:"clike",dart:"clike",django:"markup-templating",ejs:["javascript","markup-templating"],etlua:["lua","markup-templating"],erb:["ruby","markup-templating"],fsharp:"clike","firestore-security-rules":"clike",flow:"javascript",ftl:"markup-templating",gml:"clike",glsl:"c",go:"clike",groovy:"clike",haml:"ruby",handlebars:"markup-templating",haxe:"clike",hlsl:"c",java:"clike",javadoc:["markup","java","javadoclike"],jolie:"clike",jsdoc:["javascript","javadoclike","typescript"],"js-extras":"javascript",json5:"json",jsonp:"json","js-templates":"javascript",kotlin:"clike",latte:["clike","markup-templating","php"],less:"css",lilypond:"scheme",markdown:"markup","markup-templating":"markup",mongodb:"javascript",n4js:"javascript",nginx:"clike",objectivec:"c",opencl:"c",parser:"markup",php:["clike","markup-templating"],phpdoc:["php","javadoclike"],"php-extras":"php",plsql:"sql",processing:"clike",protobuf:"clike",pug:["markup","javascript"],purebasic:"clike",purescript:"haskell",qml:"javascript",qore:"clike",racket:"scheme",jsx:["markup","javascript"],tsx:["jsx","typescript"],reason:"clike",ruby:"clike",sass:"css",scss:"css",scala:"java","shell-session":"bash",smarty:"markup-templating",solidity:"clike",soy:"markup-templating",sparql:"turtle",sqf:"clike",swift:"clike","t4-cs":["t4-templating","csharp"],"t4-vb":["t4-templating","vbnet"],tap:"yaml",tt2:["clike","markup-templating"],textile:"markup",twig:"markup",typescript:"javascript",vala:"clike",vbnet:"basic",velocity:"markup",wiki:"markup",xeora:"markup","xml-doc":"markup",xquery:"markup"},n={html:"markup",xml:"markup",svg:"markup",mathml:"markup",ssml:"markup",atom:"markup",rss:"markup",js:"javascript",g4:"antlr4",adoc:"asciidoc",shell:"bash",shortcode:"bbcode",rbnf:"bnf",oscript:"bsl",cs:"csharp",dotnet:"csharp",coffee:"coffeescript",conc:"concurnas",jinja2:"django","dns-zone":"dns-zone-file",dockerfile:"docker",eta:"ejs",xlsx:"excel-formula",xls:"excel-formula",gamemakerlanguage:"gml",hs:"haskell",gitignore:"ignore",hgignore:"ignore",npmignore:"ignore",webmanifest:"json",kt:"kotlin",kts:"kotlin",tex:"latex",context:"latex",ly:"lilypond",emacs:"lisp",elisp:"lisp","emacs-lisp":"lisp",md:"markdown",moon:"moonscript",n4jsd:"n4js",nani:"naniscript",objc:"objectivec",objectpascal:"pascal",px:"pcaxis",pcode:"peoplecode",pq:"powerquery",mscript:"powerquery",pbfasm:"purebasic",purs:"purescript",py:"python",rkt:"racket",rpy:"renpy",robot:"robotframework",rb:"ruby","sh-session":"shell-session",shellsession:"shell-session",sol:"solidity",sln:"solution-file",rq:"sparql",t4:"t4-cs",trig:"turtle",ts:"typescript",tsconfig:"typoscript",uscript:"unrealscript",uc:"unrealscript",vb:"visual-basic",vba:"visual-basic",xeoracube:"xeora",yml:"yaml"},p={},e="components/",a=Prism.util.currentScript();if(a){var r=/\bplugins\/autoloader\/prism-autoloader\.(?:min\.)?js(?:\?[^\r\n/]*)?$/i,s=/(^|\/)[\w-]+\.(?:min\.)?js(?:\?[^\r\n/]*)?$/i,t=a.getAttribute("data-autoloader-path");if(null!=t)e=t.trim().replace(/\/?$/,"/");else{var i=a.src;r.test(i)?e=i.replace(r,"components/"):s.test(i)&&(e=i.replace(s,"$1components/"))}}var o=Prism.plugins.autoloader={languages_path:e,use_minified:!0,loadLanguages:m};Prism.hooks.add("complete",function(e){var a=e.element,r=e.language;if(a&&r&&"none"!==r){var s=function(e){var a=(e.getAttribute("data-dependencies")||"").trim();if(!a){var r=e.parentElement;r&&"pre"===r.tagName.toLowerCase()&&(a=(r.getAttribute("data-dependencies")||"").trim())}return a?a.split(/\s*,\s*/g):[]}(a);s.push(r),s.every(u)||m(s,function(){Prism.highlightElement(a)})}})}function u(e){if(0<=e.indexOf("!"))return!1;if((e=n[e]||e)in Prism.languages)return!0;var a=p[e];return a&&!a.error&&!1===a.loading}function m(e,a,r){"string"==typeof e&&(e=[e]);var s=e.length,t=0,i=!1;function c(){i||++t===s&&a&&a(e)}0!==s?e.forEach(function(e){!function(a,r,s){var t=0<=a.indexOf("!");function e(){var e=p[a];e||(e=p[a]={callbacks:[]}),e.callbacks.push({success:r,error:s}),!t&&u(a)?k(a,"success"):!t&&e.error?k(a,"error"):!t&&e.loading||(e.loading=!0,e.error=!1,function(e,a,r){var s=document.createElement("script");s.src=e,s.async=!0,s.onload=function(){document.body.removeChild(s),a&&a()},s.onerror=function(){document.body.removeChild(s),r&&r()},document.body.appendChild(s)}(function(e){return o.languages_path+"prism-"+e+(o.use_minified?".min":"")+".js"}(a),function(){e.loading=!1,k(a,"success")},function(){e.loading=!1,e.error=!0,k(a,"error")}))}a=a.replace("!",""),a=n[a]||a;var i=l[a];i&&i.length?m(i,e,s):e()}(e,c,function(){i||(i=!0,r&&r(e))})}):a&&setTimeout(a,0)}function k(e,a){if(p[e]){for(var r=p[e].callbacks,s=0,t=r.length;s<t;s++){var i=r[s][a];i&&setTimeout(i,0)}r.length=0}}}();
|
||||
!function(){if("undefined"!=typeof self&&self.Prism&&self.document&&document.createElement){var l={javascript:"clike",actionscript:"javascript",arduino:"cpp",aspnet:["markup","csharp"],birb:"clike",bison:"c",c:"clike",csharp:"clike",cpp:"c",coffeescript:"javascript",crystal:"ruby","css-extras":"css",d:"clike",dart:"clike",django:"markup-templating",ejs:["javascript","markup-templating"],etlua:["lua","markup-templating"],erb:["ruby","markup-templating"],fsharp:"clike","firestore-security-rules":"clike",flow:"javascript",ftl:"markup-templating",gml:"clike",glsl:"c",go:"clike",groovy:"clike",haml:"ruby",handlebars:"markup-templating",haxe:"clike",hlsl:"c",java:"clike",javadoc:["markup","java","javadoclike"],jolie:"clike",jsdoc:["javascript","javadoclike","typescript"],"js-extras":"javascript",json5:"json",jsonp:"json","js-templates":"javascript",kotlin:"clike",latte:["clike","markup-templating","php"],less:"css",lilypond:"scheme",markdown:"markup","markup-templating":"markup",mongodb:"javascript",n4js:"javascript",nginx:"clike",objectivec:"c",opencl:"c",parser:"markup",php:["clike","markup-templating"],phpdoc:["php","javadoclike"],"php-extras":"php",plsql:"sql",processing:"clike",protobuf:"clike",pug:["markup","javascript"],purebasic:"clike",purescript:"haskell",qml:"javascript",qore:"clike",racket:"scheme",jsx:["markup","javascript"],tsx:["jsx","typescript"],reason:"clike",ruby:"clike",sass:"css",scss:"css",scala:"java","shell-session":"bash",smarty:"markup-templating",solidity:"clike",soy:"markup-templating",sparql:"turtle",sqf:"clike",swift:"clike","t4-cs":["t4-templating","csharp"],"t4-vb":["t4-templating","vbnet"],tap:"yaml",tt2:["clike","markup-templating"],textile:"markup",twig:"markup",typescript:"javascript",vala:"clike",vbnet:"basic",velocity:"markup",wiki:"markup",xeora:"markup","xml-doc":"markup",xquery:"markup"},n={html:"markup",xml:"markup",svg:"markup",mathml:"markup",ssml:"markup",atom:"markup",rss:"markup",js:"javascript",g4:"antlr4",adoc:"asciidoc",shell:"bash",shortcode:"bbcode",rbnf:"bnf",oscript:"bsl",cs:"csharp",dotnet:"csharp",coffee:"coffeescript",conc:"concurnas",jinja2:"django","dns-zone":"dns-zone-file",dockerfile:"docker",eta:"ejs",xlsx:"excel-formula",xls:"excel-formula",gamemakerlanguage:"gml",hs:"haskell",gitignore:"ignore",hgignore:"ignore",npmignore:"ignore",webmanifest:"json",kt:"kotlin",kts:"kotlin",tex:"latex",context:"latex",ly:"lilypond",emacs:"lisp",elisp:"lisp","emacs-lisp":"lisp",md:"markdown",moon:"moonscript",n4jsd:"n4js",nani:"naniscript",objc:"objectivec",objectpascal:"pascal",px:"pcaxis",pcode:"peoplecode",pq:"powerquery",mscript:"powerquery",pbfasm:"purebasic",purs:"purescript",py:"python",rkt:"racket",rpy:"renpy",robot:"robotframework",rb:"ruby","sh-session":"shell-session",shellsession:"shell-session",smlnj:"sml",sol:"solidity",sln:"solution-file",rq:"sparql",t4:"t4-cs",trig:"turtle",ts:"typescript",tsconfig:"typoscript",uscript:"unrealscript",uc:"unrealscript",vb:"visual-basic",vba:"visual-basic",xeoracube:"xeora",yml:"yaml"},p={},e="components/",a=Prism.util.currentScript();if(a){var r=/\bplugins\/autoloader\/prism-autoloader\.(?:min\.)?js(?:\?[^\r\n/]*)?$/i,s=/(^|\/)[\w-]+\.(?:min\.)?js(?:\?[^\r\n/]*)?$/i,t=a.getAttribute("data-autoloader-path");if(null!=t)e=t.trim().replace(/\/?$/,"/");else{var i=a.src;r.test(i)?e=i.replace(r,"components/"):s.test(i)&&(e=i.replace(s,"$1components/"))}}var o=Prism.plugins.autoloader={languages_path:e,use_minified:!0,loadLanguages:m};Prism.hooks.add("complete",function(e){var a=e.element,r=e.language;if(a&&r&&"none"!==r){var s=function(e){var a=(e.getAttribute("data-dependencies")||"").trim();if(!a){var r=e.parentElement;r&&"pre"===r.tagName.toLowerCase()&&(a=(r.getAttribute("data-dependencies")||"").trim())}return a?a.split(/\s*,\s*/g):[]}(a);s.push(r),s.every(u)||m(s,function(){Prism.highlightElement(a)})}})}function u(e){if(0<=e.indexOf("!"))return!1;if((e=n[e]||e)in Prism.languages)return!0;var a=p[e];return a&&!a.error&&!1===a.loading}function m(e,a,r){"string"==typeof e&&(e=[e]);var s=e.length,t=0,i=!1;function c(){i||++t===s&&a&&a(e)}0!==s?e.forEach(function(e){!function(a,r,s){var t=0<=a.indexOf("!");function e(){var e=p[a];e||(e=p[a]={callbacks:[]}),e.callbacks.push({success:r,error:s}),!t&&u(a)?k(a,"success"):!t&&e.error?k(a,"error"):!t&&e.loading||(e.loading=!0,e.error=!1,function(e,a,r){var s=document.createElement("script");s.src=e,s.async=!0,s.onload=function(){document.body.removeChild(s),a&&a()},s.onerror=function(){document.body.removeChild(s),r&&r()},document.body.appendChild(s)}(function(e){return o.languages_path+"prism-"+e+(o.use_minified?".min":"")+".js"}(a),function(){e.loading=!1,k(a,"success")},function(){e.loading=!1,e.error=!0,k(a,"error")}))}a=a.replace("!",""),a=n[a]||a;var i=l[a];i&&i.length?m(i,e,s):e()}(e,c,function(){i||(i=!0,r&&r(e))})}):a&&setTimeout(a,0)}function k(e,a){if(p[e]){for(var r=p[e].callbacks,s=0,t=r.length;s<t;s++){var i=r[s][a];i&&setTimeout(i,0)}r.length=0}}}();
|
|
@ -169,6 +169,8 @@
|
|||
"shell-session": "Shell session",
|
||||
"sh-session": "Shell session",
|
||||
"shellsession": "Shell session",
|
||||
"sml": "SML",
|
||||
"smlnj": "SML/NJ",
|
||||
"solidity": "Solidity (Ethereum)",
|
||||
"sol": "Solidity (Ethereum)",
|
||||
"solution-file": "Solution file",
|
||||
|
|
|
@ -1 +1 @@
|
|||
!function(){if("undefined"!=typeof self&&self.Prism&&self.document)if(Prism.plugins.toolbar){var i={html:"HTML",xml:"XML",svg:"SVG",mathml:"MathML",ssml:"SSML",rss:"RSS",css:"CSS",clike:"C-like",js:"JavaScript",abap:"ABAP",abnf:"ABNF",al:"AL",antlr4:"ANTLR4",g4:"ANTLR4",apacheconf:"Apache Configuration",apl:"APL",aql:"AQL",arff:"ARFF",asciidoc:"AsciiDoc",adoc:"AsciiDoc",aspnet:"ASP.NET (C#)",asm6502:"6502 Assembly",autohotkey:"AutoHotkey",autoit:"AutoIt",basic:"BASIC",bbcode:"BBcode",bnf:"BNF",rbnf:"RBNF",bsl:"BSL (1C:Enterprise)",oscript:"OneScript",csharp:"C#",cs:"C#",dotnet:"C#",cpp:"C++",cil:"CIL",cmake:"CMake",coffee:"CoffeeScript",conc:"Concurnas",csp:"Content-Security-Policy","css-extras":"CSS Extras",dax:"DAX",django:"Django/Jinja2",jinja2:"Django/Jinja2","dns-zone-file":"DNS zone file","dns-zone":"DNS zone file",dockerfile:"Docker",ebnf:"EBNF",editorconfig:"EditorConfig",ejs:"EJS",etlua:"Embedded Lua templating",erb:"ERB","excel-formula":"Excel Formula",xlsx:"Excel Formula",xls:"Excel Formula",fsharp:"F#","firestore-security-rules":"Firestore security rules",ftl:"FreeMarker Template Language",gml:"GameMaker Language",gamemakerlanguage:"GameMaker Language",gcode:"G-code",gdscript:"GDScript",gedcom:"GEDCOM",glsl:"GLSL",graphql:"GraphQL",hs:"Haskell",hcl:"HCL",hlsl:"HLSL",http:"HTTP",hpkp:"HTTP Public-Key-Pins",hsts:"HTTP Strict-Transport-Security",ichigojam:"IchigoJam",ignore:".ignore",gitignore:".gitignore",hgignore:".hgignore",npmignore:".npmignore",inform7:"Inform 7",javadoc:"JavaDoc",javadoclike:"JavaDoc-like",javastacktrace:"Java stack trace",jq:"JQ",jsdoc:"JSDoc","js-extras":"JS Extras",json:"JSON",webmanifest:"Web App Manifest",json5:"JSON5",jsonp:"JSONP",jsstacktrace:"JS stack trace","js-templates":"JS Templates",kts:"Kotlin Script",kt:"Kotlin",latex:"LaTeX",tex:"TeX",context:"ConTeXt",lilypond:"LilyPond",ly:"LilyPond",emacs:"Lisp",elisp:"Lisp","emacs-lisp":"Lisp",llvm:"LLVM IR",lolcode:"LOLCODE",md:"Markdown","markup-templating":"Markup templating",matlab:"MATLAB",mel:"MEL",mongodb:"MongoDB",moon:"MoonScript",n1ql:"N1QL",n4js:"N4JS",n4jsd:"N4JS","nand2tetris-hdl":"Nand To Tetris HDL",naniscript:"Naninovel Script",nani:"Naninovel Script",nasm:"NASM",neon:"NEON",nginx:"nginx",nsis:"NSIS",objectivec:"Objective-C",objc:"Objective-C",ocaml:"OCaml",opencl:"OpenCL",parigp:"PARI/GP",objectpascal:"Object Pascal",pcaxis:"PC-Axis",px:"PC-Axis",peoplecode:"PeopleCode",pcode:"PeopleCode",php:"PHP",phpdoc:"PHPDoc","php-extras":"PHP Extras",plsql:"PL/SQL",powerquery:"PowerQuery",pq:"PowerQuery",mscript:"PowerQuery",powershell:"PowerShell",properties:".properties",protobuf:"Protocol Buffers",purebasic:"PureBasic",pbfasm:"PureBasic",purs:"PureScript",py:"Python",q:"Q (kdb+ database)",qml:"QML",rkt:"Racket",jsx:"React JSX",tsx:"React TSX",renpy:"Ren'py",rpy:"Ren'py",rest:"reST (reStructuredText)",robotframework:"Robot Framework",robot:"Robot Framework",rb:"Ruby",sas:"SAS",sass:"Sass (Sass)",scss:"Sass (Scss)","shell-session":"Shell session","sh-session":"Shell session",shellsession:"Shell session",solidity:"Solidity (Ethereum)",sol:"Solidity (Ethereum)","solution-file":"Solution file",sln:"Solution file",soy:"Soy (Closure Template)",sparql:"SPARQL",rq:"SPARQL","splunk-spl":"Splunk SPL",sqf:"SQF: Status Quo Function (Arma 3)",sql:"SQL",iecst:"Structured Text (IEC 61131-3)","t4-templating":"T4 templating","t4-cs":"T4 Text Templates (C#)",t4:"T4 Text Templates (C#)","t4-vb":"T4 Text Templates (VB)",tap:"TAP",tt2:"Template Toolkit 2",toml:"TOML",trig:"TriG",ts:"TypeScript",tsconfig:"TSConfig",uscript:"UnrealScript",uc:"UnrealScript",vbnet:"VB.Net",vhdl:"VHDL",vim:"vim","visual-basic":"Visual Basic",vba:"VBA",vb:"Visual Basic",wasm:"WebAssembly",wiki:"Wiki markup",xeoracube:"XeoraCube","xml-doc":"XML doc (.net)",xojo:"Xojo (REALbasic)",xquery:"XQuery",yaml:"YAML",yml:"YAML",yang:"YANG"};Prism.plugins.toolbar.registerButton("show-language",function(e){var a=e.element.parentNode;if(a&&/pre/i.test(a.nodeName)){var s,t=a.getAttribute("data-language")||i[e.language]||((s=e.language)?(s.substring(0,1).toUpperCase()+s.substring(1)).replace(/s(?=cript)/,"S"):s);if(t){var o=document.createElement("span");return o.textContent=t,o}}})}else console.warn("Show Languages plugin loaded before Toolbar plugin.")}();
|
||||
!function(){if("undefined"!=typeof self&&self.Prism&&self.document)if(Prism.plugins.toolbar){var i={html:"HTML",xml:"XML",svg:"SVG",mathml:"MathML",ssml:"SSML",rss:"RSS",css:"CSS",clike:"C-like",js:"JavaScript",abap:"ABAP",abnf:"ABNF",al:"AL",antlr4:"ANTLR4",g4:"ANTLR4",apacheconf:"Apache Configuration",apl:"APL",aql:"AQL",arff:"ARFF",asciidoc:"AsciiDoc",adoc:"AsciiDoc",aspnet:"ASP.NET (C#)",asm6502:"6502 Assembly",autohotkey:"AutoHotkey",autoit:"AutoIt",basic:"BASIC",bbcode:"BBcode",bnf:"BNF",rbnf:"RBNF",bsl:"BSL (1C:Enterprise)",oscript:"OneScript",csharp:"C#",cs:"C#",dotnet:"C#",cpp:"C++",cil:"CIL",cmake:"CMake",coffee:"CoffeeScript",conc:"Concurnas",csp:"Content-Security-Policy","css-extras":"CSS Extras",dax:"DAX",django:"Django/Jinja2",jinja2:"Django/Jinja2","dns-zone-file":"DNS zone file","dns-zone":"DNS zone file",dockerfile:"Docker",ebnf:"EBNF",editorconfig:"EditorConfig",ejs:"EJS",etlua:"Embedded Lua templating",erb:"ERB","excel-formula":"Excel Formula",xlsx:"Excel Formula",xls:"Excel Formula",fsharp:"F#","firestore-security-rules":"Firestore security rules",ftl:"FreeMarker Template Language",gml:"GameMaker Language",gamemakerlanguage:"GameMaker Language",gcode:"G-code",gdscript:"GDScript",gedcom:"GEDCOM",glsl:"GLSL",graphql:"GraphQL",hs:"Haskell",hcl:"HCL",hlsl:"HLSL",http:"HTTP",hpkp:"HTTP Public-Key-Pins",hsts:"HTTP Strict-Transport-Security",ichigojam:"IchigoJam",ignore:".ignore",gitignore:".gitignore",hgignore:".hgignore",npmignore:".npmignore",inform7:"Inform 7",javadoc:"JavaDoc",javadoclike:"JavaDoc-like",javastacktrace:"Java stack trace",jq:"JQ",jsdoc:"JSDoc","js-extras":"JS Extras",json:"JSON",webmanifest:"Web App Manifest",json5:"JSON5",jsonp:"JSONP",jsstacktrace:"JS stack trace","js-templates":"JS Templates",kts:"Kotlin Script",kt:"Kotlin",latex:"LaTeX",tex:"TeX",context:"ConTeXt",lilypond:"LilyPond",ly:"LilyPond",emacs:"Lisp",elisp:"Lisp","emacs-lisp":"Lisp",llvm:"LLVM IR",lolcode:"LOLCODE",md:"Markdown","markup-templating":"Markup templating",matlab:"MATLAB",mel:"MEL",mongodb:"MongoDB",moon:"MoonScript",n1ql:"N1QL",n4js:"N4JS",n4jsd:"N4JS","nand2tetris-hdl":"Nand To Tetris HDL",naniscript:"Naninovel Script",nani:"Naninovel Script",nasm:"NASM",neon:"NEON",nginx:"nginx",nsis:"NSIS",objectivec:"Objective-C",objc:"Objective-C",ocaml:"OCaml",opencl:"OpenCL",parigp:"PARI/GP",objectpascal:"Object Pascal",pcaxis:"PC-Axis",px:"PC-Axis",peoplecode:"PeopleCode",pcode:"PeopleCode",php:"PHP",phpdoc:"PHPDoc","php-extras":"PHP Extras",plsql:"PL/SQL",powerquery:"PowerQuery",pq:"PowerQuery",mscript:"PowerQuery",powershell:"PowerShell",properties:".properties",protobuf:"Protocol Buffers",purebasic:"PureBasic",pbfasm:"PureBasic",purs:"PureScript",py:"Python",q:"Q (kdb+ database)",qml:"QML",rkt:"Racket",jsx:"React JSX",tsx:"React TSX",renpy:"Ren'py",rpy:"Ren'py",rest:"reST (reStructuredText)",robotframework:"Robot Framework",robot:"Robot Framework",rb:"Ruby",sas:"SAS",sass:"Sass (Sass)",scss:"Sass (Scss)","shell-session":"Shell session","sh-session":"Shell session",shellsession:"Shell session",sml:"SML",smlnj:"SML/NJ",solidity:"Solidity (Ethereum)",sol:"Solidity (Ethereum)","solution-file":"Solution file",sln:"Solution file",soy:"Soy (Closure Template)",sparql:"SPARQL",rq:"SPARQL","splunk-spl":"Splunk SPL",sqf:"SQF: Status Quo Function (Arma 3)",sql:"SQL",iecst:"Structured Text (IEC 61131-3)","t4-templating":"T4 templating","t4-cs":"T4 Text Templates (C#)",t4:"T4 Text Templates (C#)","t4-vb":"T4 Text Templates (VB)",tap:"TAP",tt2:"Template Toolkit 2",toml:"TOML",trig:"TriG",ts:"TypeScript",tsconfig:"TSConfig",uscript:"UnrealScript",uc:"UnrealScript",vbnet:"VB.Net",vhdl:"VHDL",vim:"vim","visual-basic":"Visual Basic",vba:"VBA",vb:"Visual Basic",wasm:"WebAssembly",wiki:"Wiki markup",xeoracube:"XeoraCube","xml-doc":"XML doc (.net)",xojo:"Xojo (REALbasic)",xquery:"XQuery",yaml:"YAML",yml:"YAML",yang:"YANG"};Prism.plugins.toolbar.registerButton("show-language",function(e){var s=e.element.parentNode;if(s&&/pre/i.test(s.nodeName)){var a,t=s.getAttribute("data-language")||i[e.language]||((a=e.language)?(a.substring(0,1).toUpperCase()+a.substring(1)).replace(/s(?=cript)/,"S"):a);if(t){var o=document.createElement("span");return o.textContent=t,o}}})}else console.warn("Show Languages plugin loaded before Toolbar plugin.")}();
|
|
@ -0,0 +1,9 @@
|
|||
true
|
||||
false
|
||||
|
||||
----------------------------------------------------
|
||||
|
||||
[
|
||||
["boolean", "true"],
|
||||
["boolean", "false"]
|
||||
]
|
|
@ -0,0 +1,216 @@
|
|||
val FOO: (string list) * 'a * 'a -> (svalue,'a) token
|
||||
val FOO: (string) * 'a * 'a -> (svalue,'a) token
|
||||
val FOO: (int) * 'a * 'a -> (svalue,'a) token
|
||||
val FOO: (string list) * 'a * 'a -> (svalue,'a) token
|
||||
val FOO: 'a * 'a -> (svalue,'a) token
|
||||
|
||||
datatype spec_ast = SPEC of {head : string list,
|
||||
decls : decl_ast list,
|
||||
rules : rule_ast list,
|
||||
tail : string list}
|
||||
|
||||
type out_state = {
|
||||
tout : real,
|
||||
dtout : real,
|
||||
dtime : real,
|
||||
strm : TextIO.outstream
|
||||
}
|
||||
val outState = ref (NONE : out_state option)
|
||||
|
||||
val systemLines: string -> string list
|
||||
val systemCleanLines: string -> string list
|
||||
val systemStanzas: string -> string list list
|
||||
|
||||
----------------------------------------------------
|
||||
|
||||
[
|
||||
["keyword", "val"],
|
||||
" FOO",
|
||||
["punctuation", ":"],
|
||||
["class-name", [
|
||||
["punctuation", "("],
|
||||
"string list",
|
||||
["punctuation", ")"],
|
||||
["operator", "*"],
|
||||
["variable", "'a"],
|
||||
["operator", "*"],
|
||||
["variable", "'a"],
|
||||
["operator", "->"],
|
||||
["punctuation", "("],
|
||||
"svalue",
|
||||
["punctuation", ","],
|
||||
["variable", "'a"],
|
||||
["punctuation", ")"],
|
||||
" token"
|
||||
]],
|
||||
["keyword", "val"],
|
||||
" FOO",
|
||||
["punctuation", ":"],
|
||||
["class-name", [
|
||||
["punctuation", "("],
|
||||
"string",
|
||||
["punctuation", ")"],
|
||||
["operator", "*"],
|
||||
["variable", "'a"],
|
||||
["operator", "*"],
|
||||
["variable", "'a"],
|
||||
["operator", "->"],
|
||||
["punctuation", "("],
|
||||
"svalue",
|
||||
["punctuation", ","],
|
||||
["variable", "'a"],
|
||||
["punctuation", ")"],
|
||||
" token"
|
||||
]],
|
||||
["keyword", "val"],
|
||||
" FOO",
|
||||
["punctuation", ":"],
|
||||
["class-name", [
|
||||
["punctuation", "("],
|
||||
"int",
|
||||
["punctuation", ")"],
|
||||
["operator", "*"],
|
||||
["variable", "'a"],
|
||||
["operator", "*"],
|
||||
["variable", "'a"],
|
||||
["operator", "->"],
|
||||
["punctuation", "("],
|
||||
"svalue",
|
||||
["punctuation", ","],
|
||||
["variable", "'a"],
|
||||
["punctuation", ")"],
|
||||
" token"
|
||||
]],
|
||||
["keyword", "val"],
|
||||
" FOO",
|
||||
["punctuation", ":"],
|
||||
["class-name", [
|
||||
["punctuation", "("],
|
||||
"string list",
|
||||
["punctuation", ")"],
|
||||
["operator", "*"],
|
||||
["variable", "'a"],
|
||||
["operator", "*"],
|
||||
["variable", "'a"],
|
||||
["operator", "->"],
|
||||
["punctuation", "("],
|
||||
"svalue",
|
||||
["punctuation", ","],
|
||||
["variable", "'a"],
|
||||
["punctuation", ")"],
|
||||
" token"
|
||||
]],
|
||||
["keyword", "val"],
|
||||
" FOO",
|
||||
["punctuation", ":"],
|
||||
["class-name", [
|
||||
["variable", "'a"],
|
||||
["operator", "*"],
|
||||
["variable", "'a"],
|
||||
["operator", "->"],
|
||||
["punctuation", "("],
|
||||
"svalue",
|
||||
["punctuation", ","],
|
||||
["variable", "'a"],
|
||||
["punctuation", ")"],
|
||||
" token"
|
||||
]],
|
||||
|
||||
["keyword", "datatype"],
|
||||
["class-name", "spec_ast"],
|
||||
["operator", "="],
|
||||
" SPEC ",
|
||||
["keyword", "of"],
|
||||
["punctuation", "{"],
|
||||
"head ",
|
||||
["punctuation", ":"],
|
||||
["class-name", [
|
||||
"string list"
|
||||
]],
|
||||
["punctuation", ","],
|
||||
"\n decls ",
|
||||
["punctuation", ":"],
|
||||
["class-name", [
|
||||
"decl_ast list"
|
||||
]],
|
||||
["punctuation", ","],
|
||||
"\n rules ",
|
||||
["punctuation", ":"],
|
||||
["class-name", [
|
||||
"rule_ast list"
|
||||
]],
|
||||
["punctuation", ","],
|
||||
"\n tail ",
|
||||
["punctuation", ":"],
|
||||
["class-name", [
|
||||
"string list"
|
||||
]],
|
||||
["punctuation", "}"],
|
||||
|
||||
["keyword", "type"],
|
||||
["class-name", "out_state"],
|
||||
["operator", "="],
|
||||
["punctuation", "{"],
|
||||
"\ntout ",
|
||||
["punctuation", ":"],
|
||||
["class-name", [
|
||||
"real"
|
||||
]],
|
||||
["punctuation", ","],
|
||||
"\ndtout ",
|
||||
["punctuation", ":"],
|
||||
["class-name", [
|
||||
"real"
|
||||
]],
|
||||
["punctuation", ","],
|
||||
"\ndtime ",
|
||||
["punctuation", ":"],
|
||||
["class-name", [
|
||||
"real"
|
||||
]],
|
||||
["punctuation", ","],
|
||||
"\nstrm ",
|
||||
["punctuation", ":"],
|
||||
["class-name", [
|
||||
"TextIO",
|
||||
["punctuation", "."],
|
||||
"outstream"
|
||||
]],
|
||||
["punctuation", "}"],
|
||||
["keyword", "val"],
|
||||
" outState ",
|
||||
["operator", "="],
|
||||
" ref ",
|
||||
["punctuation", "("],
|
||||
"NONE ",
|
||||
["punctuation", ":"],
|
||||
["class-name", [
|
||||
"out_state option"
|
||||
]],
|
||||
["punctuation", ")"],
|
||||
|
||||
["keyword", "val"],
|
||||
" systemLines",
|
||||
["punctuation", ":"],
|
||||
["class-name", [
|
||||
"string ",
|
||||
["operator", "->"],
|
||||
" string list"
|
||||
]],
|
||||
["keyword", "val"],
|
||||
" systemCleanLines",
|
||||
["punctuation", ":"],
|
||||
["class-name", [
|
||||
"string ",
|
||||
["operator", "->"],
|
||||
" string list"
|
||||
]],
|
||||
["keyword", "val"],
|
||||
" systemStanzas",
|
||||
["punctuation", ":"],
|
||||
["class-name", [
|
||||
"string ",
|
||||
["operator", "->"],
|
||||
" string list list"
|
||||
]]
|
||||
]
|
|
@ -0,0 +1,11 @@
|
|||
(* comment *)
|
||||
(*
|
||||
(* nested comment *)
|
||||
*)
|
||||
|
||||
----------------------------------------------------
|
||||
|
||||
[
|
||||
["comment", "(* comment *)"],
|
||||
["comment", "(*\n (* nested comment *)\n*)"]
|
||||
]
|
|
@ -0,0 +1,13 @@
|
|||
fun foo x = x * 2
|
||||
|
||||
----------------------------------------------------
|
||||
|
||||
[
|
||||
["keyword", "fun"],
|
||||
["function", "foo"],
|
||||
" x ",
|
||||
["operator", "="],
|
||||
" x ",
|
||||
["operator", "*"],
|
||||
["number", "2"]
|
||||
]
|
|
@ -0,0 +1,94 @@
|
|||
abstype
|
||||
and
|
||||
andalso
|
||||
as
|
||||
case
|
||||
datatype;
|
||||
do
|
||||
else
|
||||
end
|
||||
eqtype
|
||||
exception;
|
||||
fn
|
||||
fun;
|
||||
functor;
|
||||
handle
|
||||
if
|
||||
in
|
||||
include
|
||||
infix
|
||||
infixr
|
||||
let
|
||||
local
|
||||
nonfix
|
||||
of
|
||||
op
|
||||
open
|
||||
orelse
|
||||
raise
|
||||
rec
|
||||
sharing
|
||||
sig
|
||||
signature;
|
||||
struct
|
||||
structure;
|
||||
then
|
||||
type;
|
||||
val
|
||||
where
|
||||
while
|
||||
with
|
||||
withtype
|
||||
|
||||
----------------------------------------------------
|
||||
|
||||
[
|
||||
["keyword", "abstype"],
|
||||
["keyword", "and"],
|
||||
["keyword", "andalso"],
|
||||
["keyword", "as"],
|
||||
["keyword", "case"],
|
||||
["keyword", "datatype"],
|
||||
["punctuation", ";"],
|
||||
["keyword", "do"],
|
||||
["keyword", "else"],
|
||||
["keyword", "end"],
|
||||
["keyword", "eqtype"],
|
||||
["keyword", "exception"],
|
||||
["punctuation", ";"],
|
||||
["keyword", "fn"],
|
||||
["keyword", "fun"],
|
||||
["punctuation", ";"],
|
||||
["keyword", "functor"],
|
||||
["punctuation", ";"],
|
||||
["keyword", "handle"],
|
||||
["keyword", "if"],
|
||||
["keyword", "in"],
|
||||
["keyword", "include"],
|
||||
["keyword", "infix"],
|
||||
["keyword", "infixr"],
|
||||
["keyword", "let"],
|
||||
["keyword", "local"],
|
||||
["keyword", "nonfix"],
|
||||
["keyword", "of"],
|
||||
["keyword", "op"],
|
||||
["keyword", "open"],
|
||||
["keyword", "orelse"],
|
||||
["keyword", "raise"],
|
||||
["keyword", "rec"],
|
||||
["keyword", "sharing"],
|
||||
["keyword", "sig"],
|
||||
["keyword", "signature"],
|
||||
["punctuation", ";"],
|
||||
["keyword", "struct"],
|
||||
["keyword", "structure"],
|
||||
["punctuation", ";"],
|
||||
["keyword", "then"],
|
||||
["keyword", "type"],
|
||||
["punctuation", ";"],
|
||||
["keyword", "val"],
|
||||
["keyword", "where"],
|
||||
["keyword", "while"],
|
||||
["keyword", "with"],
|
||||
["keyword", "withtype"]
|
||||
]
|
|
@ -0,0 +1,21 @@
|
|||
123
|
||||
~123
|
||||
123.456
|
||||
~123.456
|
||||
123e~3
|
||||
|
||||
0xFF
|
||||
~0xFF
|
||||
|
||||
----------------------------------------------------
|
||||
|
||||
[
|
||||
["number", "123"],
|
||||
["number", "~123"],
|
||||
["number", "123.456"],
|
||||
["number", "~123.456"],
|
||||
["number", "123e~3"],
|
||||
|
||||
["number", "0xFF"],
|
||||
["number", "~0xFF"]
|
||||
]
|
|
@ -0,0 +1,33 @@
|
|||
...
|
||||
:: :> :=
|
||||
= <> < <= > >=
|
||||
=> ->
|
||||
! + - * / ^ # | @ ~
|
||||
|
||||
----------------------------------------------------
|
||||
|
||||
[
|
||||
["operator", "..."],
|
||||
["operator", "::"],
|
||||
["operator", ":>"],
|
||||
["operator", ":="],
|
||||
["operator", "="],
|
||||
["operator", "<"],
|
||||
["operator", ">"],
|
||||
["operator", "<"],
|
||||
["operator", "<="],
|
||||
["operator", ">"],
|
||||
["operator", ">="],
|
||||
["operator", "=>"],
|
||||
["operator", "->"],
|
||||
["operator", "!"],
|
||||
["operator", "+"],
|
||||
["operator", "-"],
|
||||
["operator", "*"],
|
||||
["operator", "/"],
|
||||
["operator", "^"],
|
||||
["operator", "#"],
|
||||
["operator", "|"],
|
||||
["operator", "@"],
|
||||
["operator", "~"]
|
||||
]
|
|
@ -0,0 +1,14 @@
|
|||
""
|
||||
"foo"
|
||||
"\tfoo
|
||||
bar"
|
||||
#"f"
|
||||
|
||||
----------------------------------------------------
|
||||
|
||||
[
|
||||
["string", "\"\""],
|
||||
["string", "\"foo\""],
|
||||
["string", "\"\\tfoo\r\nbar\""],
|
||||
["string", "#\"f\""]
|
||||
]
|
|
@ -0,0 +1,7 @@
|
|||
0w123
|
||||
|
||||
----------------------------------------------------
|
||||
|
||||
[
|
||||
["word", "0w123"]
|
||||
]
|
Loading…
Reference in New Issue