Skip to content

Commit 2326c74

Browse files
committed
finished defining lean simple mode
1 parent ea69c94 commit 2326c74

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

mode/lean/lean.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,18 @@
1414
{ regex: /\b0x[0-9a-f]+\b/i, token: "number" },
1515
{ regex: /\b-?\d+(?:\.\d+)?(?:e[-+]?\d+)?\b/i, token: "number" },
1616
{ 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" },
17+
{ regex: /\b(?:show|have|from|suffices|nomatch|set_option|initialize|builtin_initialize|example|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|if|then|else|calc|match|with|for|in|unless|try|catch|finally|return|continue|break|global|local|scoped|partial|unsafe|private|protected|noncomputable|true|false)\b/, token: "keyword" },
18+
{ regex: /#(print|check|eval|reduce|check_failure)\b/, token: "operator" },
1919
{ regex: /\+|\*|-|\/|:=|>>>|<<<|\^\^\^|&&&|\|\|\||\+\+|\^|%|~~~|<|<=|>|>=|==|=/, token: "operator" },
2020
{ 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"] }
21+
{ regex: /\b(?:sorry|admit)\b/, token: "error" },
22+
{ regex: /(\b(inductive|coinductive|structure|theorem|axiom|abbrev|lemma|def|instance|class|constant))(\s+)/, token: "keyword", push: "definition" },
23+
{ regex: /"[^"]*"|'[^']'/, token: "string" },
24+
{ regex: /@\[[^\]\n]*\]/, token: "keyword" },
25+
{ regex: /\`[^(\s]*/, token: "operator" }
26+
],
27+
definition: [
28+
{ regex: /(\w+)/, token: "attribute", pop: true }
2429
]
2530
})
2631
});

0 commit comments

Comments
 (0)