|
6 | 6 | else
|
7 | 7 | mod(CodeMirror)
|
8 | 8 | })(function(CodeMirror) {
|
9 |
| - // TODO |
| 9 | + "use strict" |
| 10 | + CodeMirror.defineSimpleMode("lean", { |
| 11 | + start: [ |
| 12 | + { regex: /\b0b[01]+\b/i, token: "number" }, |
| 13 | + { regex: /\b0o[0-7]+\b/i, token: "number" }, |
| 14 | + { regex: /\b0x[0-9a-f]+\b/i, token: "number" }, |
| 15 | + { regex: /\b-?\d+(?:\.\d+)?(?:e[-+]?\d+)?\b/i, token: "number" }, |
| 16 | + { regex: /(?:\/-[\s\S]*?-\/)|(?:--.*$)/m, token: "comment" }, |
| 17 | + { regex: /\b(?:theorem|show|have|from|suffices|nomatch|def|class|structure|instance|set_option|initialize|builtin_initialize|example|inductive|coinductive|axiom|constant|universe|universes|variable|variables|import|open|export|theory|prelude|renaming|hiding|exposing|do|by|let|extends|mutual|mut|where|rec|syntax|macro_rules|macro|deriving|fun|section|namespace|end|infix|infixl|infixr|postfix|prefix|notation|abbrev|if|then|else|calc|match|with|for|in|unless|try|catch|finally|return|continue|break|global|local|scoped|partial|unsafe|private|protected|noncomputable)\b/, token: "keyword" }, |
| 18 | + { regex: /#(print|check|eval|reduce|check_failure)/, token: "operator" }, |
| 19 | + { regex: /\+|\*|-|\/|:=|>>>|<<<|\^\^\^|&&&|\|\|\||\+\+|\^|%|~~~|<|<=|>|>=|==|=/, token: "operator" }, |
| 20 | + { regex: /[()\[\]{},:]/, token: "meta" }, |
| 21 | + { regex: /\b(?:true|false)\b/, token: "attribute" }, |
| 22 | + { regex: /\b(?:sorry|admit)\b/, token: "operator" }, |
| 23 | + // { regex: /(\b(?:inductive|coinductive|structure|theorem|axiom|abbrev|lemma|def|instance|class|constant))(\s+)(\w+)/, token: ["keyword", null, "function"] } |
| 24 | + ] |
| 25 | + }) |
10 | 26 | });
|
0 commit comments