@exercism/codemirror-lang-lean 0.0.0-stage → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js ADDED
@@ -0,0 +1,867 @@
1
+ import { ExternalTokenizer, LRParser, LocalTokenGroup } from '@lezer/lr';
2
+ import { syntaxTree, LRLanguage, indentNodeProp, foldNodeProp, foldInside, LanguageSupport } from '@codemirror/language';
3
+ import { styleTags, tags } from '@lezer/highlight';
4
+ import { StateEffect, Prec, findClusterBreak, EditorSelection } from '@codemirror/state';
5
+ import { Decoration, EditorView, ViewPlugin, keymap, hoverTooltip } from '@codemirror/view';
6
+ import { AbbreviationProvider, AbbreviationRewriter, Range } from '@leanprover/unicode-input';
7
+
8
+ // This file was generated by lezer-generator. You probably shouldn't edit it.
9
+ const InterpPrefix = 1,
10
+ InterpKeyword = 2,
11
+ StdNamespace = 3,
12
+ StdTypeName = 4,
13
+ stdTypeNameDot = 5,
14
+ QualifiedType = 6;
15
+
16
+ // Mirrors `idRest` in syntax.grammar (letters/digits/underscore/'!?, plus
17
+ // the letterLike and subscript unicode ranges), so the boundary this finds
18
+ // exactly matches where the grammar's own Identifier token would stop —
19
+ // without it, "TreeSetX" could be mistaken for a boundary at "TreeSet".
20
+ function isIdRest(code) {
21
+ if (code === 0x5f)
22
+ return true; // _
23
+ if (code >= 0x41 && code <= 0x5a)
24
+ return true; // A-Z
25
+ if (code >= 0x61 && code <= 0x7a)
26
+ return true; // a-z
27
+ if (code >= 0x30 && code <= 0x39)
28
+ return true; // 0-9
29
+ if (code === 0x27 || code === 0x21 || code === 0x3f)
30
+ return true; // ' ! ?
31
+ if (code >= 0x3b1 && code <= 0x3ba)
32
+ return true; // lower greek
33
+ if (code >= 0x3bc && code <= 0x3c9)
34
+ return true;
35
+ if (code >= 0x391 && code <= 0x39f)
36
+ return true; // upper greek
37
+ if (code >= 0x3a1 && code <= 0x3a2)
38
+ return true;
39
+ if (code >= 0x3a4 && code <= 0x3a9)
40
+ return true;
41
+ if (code >= 0x3ca && code <= 0x3fb)
42
+ return true; // coptic
43
+ if (code >= 0x1f00 && code <= 0x1ffe)
44
+ return true; // polytonic greek
45
+ if (code >= 0x2100 && code <= 0x214f)
46
+ return true; // letterlike symbols
47
+ if (code >= 0x1d49c && code <= 0x1d59f)
48
+ return true; // script/double-struck/fraktur
49
+ if (code >= 0xc0 && code <= 0xd6)
50
+ return true; // latin-1 supplement
51
+ if (code >= 0xd8 && code <= 0xf6)
52
+ return true;
53
+ if (code >= 0xf8 && code <= 0xff)
54
+ return true;
55
+ if (code >= 0x100 && code <= 0x17f)
56
+ return true; // latin extended-A
57
+ if (code >= 0x2080 && code <= 0x2089)
58
+ return true; // subscript digits
59
+ if (code >= 0x2090 && code <= 0x209c)
60
+ return true;
61
+ if (code >= 0x1d62 && code <= 0x1d6a)
62
+ return true;
63
+ if (code === 0x2c7c)
64
+ return true;
65
+ return false;
66
+ }
67
+ // Reads the run of idRest characters starting at `offset` (via peek, so
68
+ // the stream position is never advanced), or null if it's empty.
69
+ function readBoundedSegment(input, offset) {
70
+ let text = "";
71
+ let i = offset;
72
+ for (;;) {
73
+ const code = input.peek(i);
74
+ if (isIdRest(code)) {
75
+ text += String.fromCharCode(code);
76
+ i++;
77
+ continue;
78
+ }
79
+ // The stream hands out UTF-16 code units, so the script, double-struck
80
+ // and fraktur letters, which lie beyond U+FFFF, arrive as two halves.
81
+ if (code >= 0xd800 && code <= 0xdbff) {
82
+ const low = input.peek(i + 1);
83
+ if (low >= 0xdc00 &&
84
+ low <= 0xdfff &&
85
+ isIdRest(((code - 0xd800) << 10) + (low - 0xdc00) + 0x10000)) {
86
+ text += String.fromCharCode(code, low);
87
+ i += 2;
88
+ continue;
89
+ }
90
+ }
91
+ break;
92
+ }
93
+ return text.length > 0 ? text : null;
94
+ }
95
+
96
+ const S = "s".charCodeAt(0);
97
+ const F = "f".charCodeAt(0);
98
+ const M = "m".charCodeAt(0);
99
+ const BANG = "!".charCodeAt(0);
100
+ const QUOTE = '"'.charCodeAt(0);
101
+ // `s!`/`f!`/`m!` string interpolation prefixes, kept as their own two-character
102
+ // token so they can be styled apart from the string that follows (see
103
+ // StringInterp in syntax.grammar). A declarative token here would hit the
104
+ // same hazard as fusing the prefix and quote used to sidestep: Lezer
105
+ // prefers the highest-precedence matching token over the longest one, so
106
+ // a plain "s!"/"f!" token would win over Identifier even when nothing
107
+ // valid follows (`s!oo`, bare `s!`, `def s! : Nat := 0`), producing dead
108
+ // ends instead of falling back to Identifier. Peeking at the quote here,
109
+ // without consuming it, keeps the token from ever matching unless the
110
+ // interpolation is real — no candidate is offered at all otherwise, so
111
+ // Identifier wins uncontested with no precedence contest to get wrong.
112
+ //
113
+ // Takes the term id as a parameter, rather than importing the generated
114
+ // `./syntax.grammar.terms` module directly, so this logic can be reused
115
+ // by test/grammar.test.ts's in-memory `buildParser`, which supplies its
116
+ // own term id from the builder's term table instead of that (build-only)
117
+ // generated module.
118
+ function makeInterpPrefixTokenizer(interpPrefixTerm) {
119
+ return new ExternalTokenizer((input) => {
120
+ if ((input.next == S || input.next == F || input.next == M) &&
121
+ input.peek(1) == BANG &&
122
+ input.peek(2) == QUOTE) {
123
+ input.acceptToken(interpPrefixTerm, 2);
124
+ }
125
+ });
126
+ }
127
+ // The keywords whose string argument is interpolated without a prefix, as
128
+ // in `panic! "no item at {i}"`: the ones the Lean 4 VS Code extension's
129
+ // grammar lists next to `s!` and `m!`.
130
+ const INTERP_KEYWORDS = new Set([
131
+ "dbg_trace", "panic!", "reportIssue!", "throwError",
132
+ ]);
133
+ const SPACE = " ".charCodeAt(0);
134
+ const TAB = "\t".charCodeAt(0);
135
+ // Offered only when the keyword is a whole word and a quote follows it on
136
+ // the same line, so that the interpolated string the grammar then requires
137
+ // (see keywordInterp in syntax.grammar) is always there. Anywhere else the
138
+ // word falls back to the ordinary Keyword.
139
+ function makeInterpKeywordTokenizer(interpKeywordTerm) {
140
+ return new ExternalTokenizer((input) => {
141
+ const word = readBoundedSegment(input, 0);
142
+ if (!word || !INTERP_KEYWORDS.has(word))
143
+ return;
144
+ let after = word.length;
145
+ while (input.peek(after) == SPACE || input.peek(after) == TAB)
146
+ after++;
147
+ if (input.peek(after) == QUOTE) {
148
+ input.acceptToken(interpKeywordTerm, word.length);
149
+ }
150
+ });
151
+ }
152
+
153
+ const interpPrefixToken = makeInterpPrefixTokenizer(InterpPrefix);
154
+ const interpKeywordToken = makeInterpKeywordTokenizer(InterpKeyword);
155
+
156
+ // The single source of truth for Lean's curated built-in type names, used
157
+ // by the Std.<Type> external tokenizers (see std-namespace.ts). Kept in
158
+ // sync with the TypeName rule in syntax.grammar by hand, the same way
159
+ // qualifiedTypeStart already is — see the comment there.
160
+ const TYPE_NAMES = new Set([
161
+ "Add", "And", "Array", "BEq", "BitVec", "Bool", "ByteArray", "Char",
162
+ "Decidable", "DecidableEq", "DecidableRel", "DHashMap", "Div", "DTreeMap",
163
+ "Empty", "Eq", "Except", "ExceptT", "Expr", "ExtDHashMap", "ExtHashMap",
164
+ "ExtHashSet", "False", "Fin", "Float", "Float32", "FloatArray", "Format",
165
+ "GE", "GT", "HAppend", "HEq", "HashMap", "HashSet", "Hashable", "IO", "Id",
166
+ "Iff", "Inhabited", "Int", "Int8", "Int16", "Int32", "Int64", "LE", "LT",
167
+ "LawfulBEq", "List", "MacroM", "MProd", "Mod", "Mul", "Mutex", "Nat", "Ne",
168
+ "Neg", "Nonempty", "Not", "Option", "OptionT", "Or", "Ord", "Ordering",
169
+ "PEmpty", "PlainDate", "PlainDateTime", "PlainTime", "PLift", "PProd",
170
+ "PSigma", "PSum", "PUnit", "Pow", "Prod", "Quot", "Quotient", "Range",
171
+ "ReaderM", "ReaderT", "Ref", "Repr", "Sigma", "ST", "StateM", "StateT",
172
+ "String", "Sub", "Subarray", "Subtype", "Sum", "Syntax", "Task", "Thunk",
173
+ "ToString", "TreeMap", "TreeSet", "True", "TSyntax", "UInt8", "UInt16",
174
+ "UInt32", "UInt64", "ULift", "USize", "Unit", "Vector",
175
+ ]);
176
+ // Types that live in a namespace under `Std`, such as
177
+ // `Std.Time.PlainDateTime`, keyed by that namespace. Apart from the three
178
+ // `Plain…` types, which are also in the list above, they are recognised
179
+ // only after "Std.<namespace>." (see std-namespace.ts): a bare `Duration`
180
+ // or `Timestamp` stays plain, because exercises define their own types
181
+ // with names like these. The names are the date, time and duration types
182
+ // listed in the module documentation of Lean's `Std.Time`.
183
+ const STD_NAMESPACE_TYPES = new Map([
184
+ [
185
+ "Time",
186
+ new Set([
187
+ "DateTime", "Duration", "PlainDate", "PlainDateTime", "PlainTime",
188
+ "TimeZone", "Timestamp", "WallTime", "Weekday", "ZonedDateTime",
189
+ ]),
190
+ ],
191
+ ]);
192
+
193
+ const DOT$1 = ".".charCodeAt(0);
194
+ // `Std.<Type>`, and likewise `Lean.<Type>` (the node keeps the name
195
+ // StdNamespace for both) — `Std` and the curated type name after it get their own
196
+ // nodes (and colors), the type name taking a following "." along
197
+ // (`TreeSet.`), while anything further (`Std.TreeSet.empty`'s `empty`) is
198
+ // left alone as a plain Identifier. Splitting the
199
+ // literal "Std." off is easy, but the type name can't just be the
200
+ // existing (dot-chaining) Identifier/TypeName token reused at that
201
+ // position: Identifier's own regex would keep going through the next
202
+ // dot too (`TreeSet.empty` as one run), so specialize would compare the
203
+ // whole "TreeSet.empty" against the curated list, fail, and leave it
204
+ // entirely unstyled. Two purpose-built external tokenizers fix this:
205
+ // stdNamespaceToken consumes only "Std." — and only when the segment
206
+ // right after it (checked by peeking, not consuming) is an exact,
207
+ // bounded curated name, so anything else ("Std.foo", bare "Std", as in
208
+ // `open Std`) offers no token at all and falls back to plain Identifier
209
+ // with no dead end — while stdTypeNameToken, valid only as the required
210
+ // continuation right after StdNamespace (see StdQualifiedType in the
211
+ // grammar, not reachable from anywhere else `atom` is), matches just
212
+ // that one bounded segment and the "." after it, if there is one, without
213
+ // letting what follows that dot extend it.
214
+ // The namespaces whose types are split off this way: `Std.HashMap`, and
215
+ // `Lean.TSyntax` or `Lean.MacroM` in a macro. Returns the length of the
216
+ // one at the start of the input with its dot ("Std." is 4), or 0.
217
+ const ROOT_NAMESPACES = ["Std", "Lean"];
218
+ function rootNamespaceLength(input) {
219
+ for (const root of ROOT_NAMESPACES) {
220
+ let i = 0;
221
+ while (i < root.length && input.peek(i) == root.charCodeAt(i))
222
+ i++;
223
+ if (i == root.length && input.peek(i) == DOT$1)
224
+ return i + 1;
225
+ }
226
+ return 0;
227
+ }
228
+ function makeStdNamespaceTokenizer(stdNamespaceTerm) {
229
+ return new ExternalTokenizer((input) => {
230
+ const root = rootNamespaceLength(input);
231
+ if (!root)
232
+ return;
233
+ const seg = readBoundedSegment(input, root);
234
+ if (!seg)
235
+ return;
236
+ if (TYPE_NAMES.has(seg)) {
237
+ input.acceptToken(stdNamespaceTerm, root);
238
+ return;
239
+ }
240
+ // `Std.Time.PlainDateTime`: the namespace under `Std` joins the
241
+ // token ("Std.Time."), under the same condition as above, that a
242
+ // type known to live there follows. `Std.Time` on its own, as in
243
+ // `import Std.Time`, stays a plain Identifier like `open Std` does.
244
+ const nested = root == 4 ? STD_NAMESPACE_TYPES.get(seg) : undefined;
245
+ const afterNested = root + seg.length + 1;
246
+ if (nested && input.peek(afterNested - 1) == DOT$1) {
247
+ const type = readBoundedSegment(input, afterNested);
248
+ if (type && nested.has(type)) {
249
+ input.acceptToken(stdNamespaceTerm, afterNested);
250
+ }
251
+ }
252
+ });
253
+ }
254
+ function makeStdTypeNameTokenizer(stdTypeNameTerm, stdTypeNameDotTerm) {
255
+ return new ExternalTokenizer((input) => {
256
+ // Only reachable right after StdNamespace, which has already checked
257
+ // that this segment belongs to the namespace it consumed, so a name
258
+ // from either list is enough here.
259
+ const seg = readBoundedSegment(input, 0);
260
+ if (seg && (TYPE_NAMES.has(seg) || isNestedStdType(seg))) {
261
+ // Take a following "." too, as QualifiedType does for `IO.`, so that
262
+ // `Std.TreeMap.empty` splits the same way `IO.println` does. With
263
+ // the dot it is a term of its own (under the same node name), which
264
+ // is what lets `def Std.HashMap.foo` find its name.
265
+ const dot = input.peek(seg.length) == DOT$1 ? 1 : 0;
266
+ input.acceptToken(dot ? stdTypeNameDotTerm : stdTypeNameTerm, seg.length + dot);
267
+ }
268
+ });
269
+ }
270
+ function isNestedStdType(name) {
271
+ for (const types of STD_NAMESPACE_TYPES.values()) {
272
+ if (types.has(name))
273
+ return true;
274
+ }
275
+ return false;
276
+ }
277
+
278
+ const stdNamespaceToken = makeStdNamespaceTokenizer(StdNamespace);
279
+ const stdTypeNameToken = makeStdTypeNameTokenizer(StdTypeName, stdTypeNameDot);
280
+
281
+ const DOT = ".".charCodeAt(0);
282
+ // `IO.println`, `Nat.succ` — only the curated type name and the dot after
283
+ // it (`IO.`, `Nat.`) get their own node/color; the segment after that is
284
+ // left alone as a plain Identifier, the same way Std.TreeSet.empty leaves
285
+ // `empty` plain after `TreeSet.` (see std-namespace.ts, which this
286
+ // mirrors). Reusing Identifier/TypeName for just the "IO" part doesn't
287
+ // work here either:
288
+ // Identifier's own regex keeps going through the dot (matching
289
+ // "IO.println" as one run), so specialize would compare that whole run
290
+ // against the curated list, fail, and leave it entirely unstyled — hence
291
+ // a dedicated external tokenizer that stops right after the dot.
292
+ //
293
+ // Unlike StdNamespace, this doesn't need to verify what follows the dot:
294
+ // "IO." isn't required to be part of anything (no wrapping grammar rule
295
+ // depends on a continuation existing), so it's a well-formed token on its
296
+ // own even with nothing, or nothing valid, after it — matching how a
297
+ // curated type name is already highlighted standalone (as TypeName) with
298
+ // no such requirement either.
299
+ function makeQualifiedTypeTokenizer(qualifiedTypeTerm) {
300
+ return new ExternalTokenizer((input) => {
301
+ const seg = readBoundedSegment(input, 0);
302
+ if (seg && TYPE_NAMES.has(seg) && input.peek(seg.length) == DOT) {
303
+ input.acceptToken(qualifiedTypeTerm, seg.length + 1);
304
+ }
305
+ });
306
+ }
307
+
308
+ const qualifiedTypeToken = makeQualifiedTypeTokenizer(QualifiedType);
309
+
310
+ // This file was generated by lezer-generator. You probably shouldn't edit it.
311
+ const spec_Identifier = {__proto__:null,add_decl_doc:154, binder_predicate:156, builtin_dsimproc:158, builtin_dsimproc_decl:160, builtin_grind_propagator:162, builtin_initialize:164, builtin_simproc:166, builtin_simproc_decl:168, coinductive_fixpoint:170, declare_config_elab:172, declare_syntax_cat:174, dsimproc:176, dsimproc_decl:178, elab:180, elab_rules:182, end:184, example:186, export:188, extends:190, grind_pattern:192, grind_propagator:194, hiding:196, import:198, include:200, inductive_fixpoint:202, infix:204, infixl:206, infixr:208, initialize:210, macro:212, macro_rules:214, module:216, mutual:218, namespace:220, notation:222, omit:224, opaque:226, open:228, postfix:230, prefix:232, prelude:234, recommended_spelling:236, register_builtin_option:238, register_error_explanation:240, register_label_attr:242, register_linter_set:244, register_option:246, register_parser_alias:248, register_simp_attr:250, register_tactic_tag:252, renaming:254, reprove:256, run_cmd:258, run_elab:260, run_meta:262, seal:264, section:266, set_option:268, show_panel_widgets:270, simproc:272, simproc_decl:274, syntax:276, tactic_alt:278, tactic_extension:280, tactic_tag:282, universe:284, unseal:286, variable:288, at:292, bif:294, by:296, "by?":298, calc:300, decreasing_by:302, else:304, exists:306, forall:308, from:310, fun:312, generalizing:314, have:316, haveI:318, if:320, in:322, include_str:324, leading_parser:326, let:328, letI:330, let_expr:332, match:334, match_expr:336, matches:338, max_prec:340, mod_cast:342, nat_lit:344, no_index:346, nofun:348, nomatch:350, "panic!":352, partial_fixpoint:354, "println!":356, rec:358, "reportIssue!":360, show:362, show_term:364, suffices:366, termination_by:368, "termination_by?":370, then:372, this:374, trailing_parser:376, "unreachable!":378, using:380, where:382, with:384, "assert!":388, break:390, catch:392, continue:394, dbg_trace:396, do:398, finally:400, for:402, logNamedError:404, logNamedErrorAt:406, logNamedWarning:408, logNamedWarningAt:410, mut:412, repeat:414, return:416, throwError:418, throwErrorAt:420, throwNamedError:422, throwNamedErrorAt:424, try:426, unless:428, until:430, while:432, ac_rfl:436, all_goals:438, any_goals:440, apply:442, "apply?":444, assumption:446, assumption_mod_cast:448, by_cases:450, congr:452, constructor:454, contradiction:456, conv:458, decide:460, dsimp:462, exact:464, "exact?":466, exact_mod_cast:468, exfalso:470, funext:472, generalize:474, grind:476, guard_expr:478, guard_hyp:480, guard_target:482, induction:484, infer_instance:486, injection:488, injections:490, intro:492, intros:494, native_decide:496, norm_cast:498, norm_cast_add_elim:500, obtain:502, omega:504, push_cast:506, rcases:508, refine:510, rename_i:512, revert:514, rfl:516, rintro:518, rotate_left:520, rotate_right:522, rw:524, rwa:526, simp:528, simp_all:530, simp_arith:532, simpa:534, specialize:536, subst:538, subst_vars:540, symm:542, trivial:544, unfold:546, abbrev:550, axiom:552, class:554, coinductive:556, def:558, inductive:560, instance:562, structure:564, theorem:566, deriving:570, attribute:574, local:576, meta:578, noncomputable:580, nonrec:582, partial:584, private:586, protected:588, public:590, scoped:592, unsafe:594, sorry:602, admit:604, Type:608, Prop:610, Sort:612, Add:614, And:616, Array:618, BEq:620, BitVec:622, Bool:624, ByteArray:626, Char:628, Decidable:630, DecidableEq:632, DecidableRel:634, DHashMap:636, Div:638, DTreeMap:640, Empty:642, Eq:644, Except:646, ExceptT:648, Expr:650, ExtDHashMap:652, ExtHashMap:654, ExtHashSet:656, False:658, Fin:660, Float:662, Float32:664, FloatArray:666, Format:668, GE:670, GT:672, HAppend:674, HEq:676, HashMap:678, HashSet:680, Hashable:682, IO:684, Id:686, Iff:688, Inhabited:690, Int:692, Int8:694, Int16:696, Int32:698, Int64:700, LE:702, LT:704, LawfulBEq:706, List:708, MacroM:710, MProd:712, Mod:714, Mul:716, Mutex:718, Nat:720, Ne:722, Neg:724, Nonempty:726, Not:728, Option:730, OptionT:732, Or:734, Ord:736, Ordering:738, PEmpty:740, PlainDate:742, PlainDateTime:744, PlainTime:746, PLift:748, PProd:750, PSigma:752, PSum:754, PUnit:756, Pow:758, Prod:760, Quot:762, Quotient:764, Range:766, ReaderM:768, ReaderT:770, Ref:772, Repr:774, Sigma:776, ST:778, StateM:780, StateT:782, String:784, Sub:786, Subarray:788, Subtype:790, Sum:792, Syntax:794, Task:796, Thunk:798, ToString:800, TreeMap:802, TreeSet:804, True:806, TSyntax:808, UInt8:810, UInt16:812, UInt32:814, UInt64:816, ULift:818, USize:820, Unit:822, Vector:824, true:826, false:828};
312
+ const spec_HashCommand = {__proto__:null,"#exit":606};
313
+ const parser = LRParser.deserialize({
314
+ version: 14,
315
+ states: "-UQYQ!XOOO8]Q!XO'#CgO8dQ!XO'#CjO8kQ!XO'#CmO8rQ!XO'#CoO8yO!bO'#CqO8yO!bO'#CsO8yO!bO'#CtOOQg'#Dq'#DqOOQg'#Cu'#CuO9UQxO'#CyO9^Q!XO'#IYO!!pQ!XO'#IdO!:SQ!XO'#IfO##fQ!XO'#DQOOQg'#DW'#DWO##mO#tO'#D_O##xOpO'#DaOOQg'#Dy'#DyOOQg'#Dp'#DpOOQg'#Di'#DiQYQ!XOOOOQg'#Dz'#DzOOQg'#Fc'#FcOOQg'#Ge'#GeOOQg'#G}'#G}OOQg'#Cw'#CwOOQg'#C{'#C{OOQg'#C}'#C}OOQg'#DR'#DROOQg'#DZ'#DZOOQg'#D['#D[OOQg'#D]'#D]O##}QpO'#DyOOQg,59R,59RO#$SQ!XO,59ROOQg,59U,59UO#$ZQ!XO,59UOOQg,59X,59XO#$bQ!XO,59XOOQg,59Z,59ZO#$iQ!XO,59ZO8yO!bO'#CrOOOO'#Dj'#DjO#$pO!bO'#DsOOQg'#Ds'#DsOOQg,59],59]OOQg,59_,59_OOQg,59`,59`OOQg,59e,59eOOQg,59f,59fOOQg'#Cx'#CxOOQg,5>t,5>tO#${Q!XO,5>tOOQg,5?O,5?OOOQg'#C|'#C|O#<_Q!XO'#DOOOQg,5?Q,5?QOOQg,59l,59lO#<fQ!XO,59lOOOO'#Dl'#DlO#<mO#tO,59yOOQg,59y,59yO#<xO&jO,59{OOQg-E7g-E7gO#=WO&jO'#DSOOQg,5:e,5:eOOQg1G.m1G.mOOQg1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XP(XP(XPPPPPPP+U+x,R,]PPP,c'[P,uPPPPP'[-RPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP-RPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP-RPPPPPPPPPPPPPPPPPPPPPPP-RPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP(XPPPPPPPPP(XP(XqcOPQRS^esuwy!Y!]!n!r!zqWOPQRS^esuwy!Y!]!n!r!zZ{TUVz|qbOPQRS^esuwy!Y!]!n!r!zqZOPQRS^esuwy!Y!]!n!r!zQ!UZR!l!VpbOPQRS^esuwy!Y!]!n!r!zR!UZpbOPQRS^esuwy!Y!]!n!r!zR!VZq[OPQRS^esuwy!Y!]!n!r!zR!W[q]OPQRS^esuwy!Y!]!n!r!zR!Z]R!dqX!s!a!c!t!vQeOQsPQuQQwRQySQ!]^`!besuwy!]!n!zQ!n!YR!z!rW|TUVzR!j|Q!t!aQ!v!cT!{!t!vQ!_`R!p!_qdOPQRS^esuwy!Y!]!n!r!zQ!OTQ!PUQ!QVR!izqXOPQRS^esuwy!Y!]!n!r!z",
318
+ nodeNames: "⚠ InterpPrefix InterpKeyword StdNamespace StdTypeName StdTypeName QualifiedType LineComment Program ) ( Parens ] [ Brackets } { Braces ⟩ Anonymous ⟨ BlockComment NestedComment DocComment ModuleDoc Keyword Identifier Keyword DefinitionName StdQualifiedType StdQualifiedType Keyword Keyword Keyword Attribute @[ Attribute Modifier InterpolatedString InterpEscape InterpBraces InterpBraceStart Incomplete HashCommand SymbolKeyword Sort TypeName BooleanLiteral NameLiteral String Escape StringInterp RawString Char CharEscape Scientific Number Operator Unknown",
319
+ maxTerm: 416,
320
+ nodeProps: [
321
+ ["openedBy", 9,"(",12,"[ @[",15,"{",18,"⟨"],
322
+ ["closedBy", 10,")",-2,13,35,"]",16,"}",20,"⟩"]
323
+ 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o%p+y&a&b+y$IS$Nn+y%#t%&Y+y%&Y%+t+y%+t%1`+y%:b%GS+y%GU%Gl+y%MW&*^+y&*^&/x+y~!>eOd~![~~!>lOb~![~~!>qP![~;=`<%l'w~!>yR![~;=`;@r'w;@r;FbNX;Fb<%l'w",
327
+ tokenizers: [interpPrefixToken, interpKeywordToken, stdNamespaceToken, stdTypeNameToken, qualifiedTypeToken, 3, new LocalTokenGroup("p~RQ}!OX!P!Qd~[P!P!Q_~dO!j~~gP}!Oj~oO!i~~", 31, 70), new LocalTokenGroup("x~RQrsX#O#P^~^O*Q~~aRO;'Sj;'S;=`o;=`Oj~oO!S~~tP!S~;=`<%lj~", 39, 415), new LocalTokenGroup("!Q~RRrs[#O#Pa#o#pz~aO'h~~dRO;'Sm;'S;=`r;=`Om~rOw~~wPw~;=`<%lm~!POy~~", 47, 299)],
328
+ topRules: {"Program":[0,8]},
329
+ specialized: [{term: 26, get: (value) => spec_Identifier[value] || -1},{term: 43, get: (value) => spec_HashCommand[value] || -1}],
330
+ tokenPrec: 5591
331
+ });
332
+
333
+ // The tokens that open a bracket pair. `InterpBraceStart` is the `{` of an
334
+ // interpolation in `s!"…"`, and `@[` opens an attribute list.
335
+ const opening = new Set(["(", "[", "@[", "{", "⟨", "InterpBraceStart"]);
336
+ // A line that starts with a focus dot, as in the Lean 4 VS Code extension's
337
+ // only `onEnterRules` entry.
338
+ const focusDot = /^\s*[·.]\s/;
339
+ /// Indentation for a new line, as in the Lean 4 VS Code extension: it starts
340
+ /// where the line before it starts, one level deeper when that line ends
341
+ /// with an opening bracket or begins with a focus dot.
342
+ ///
343
+ /// Lean's layout carries meaning and is the author's to decide, so this
344
+ /// only answers for a line that is being broken (Enter). Asked about a line
345
+ /// that already exists, it returns `null`, which leaves the line alone.
346
+ function leanIndent(context) {
347
+ const { pos } = context;
348
+ if (context.simulatedBreak !== pos)
349
+ return null;
350
+ // Read the line from the document itself: with the double break that
351
+ // Enter simulates between a pair of brackets, the context reports the
352
+ // text before the break as empty.
353
+ const line = context.state.doc.lineAt(pos);
354
+ const before = line.text.slice(0, pos - line.from);
355
+ const indent = context.countColumn(before, before.search(/\S|$/));
356
+ if (focusDot.test(before))
357
+ return indent + context.unit;
358
+ const text = before.trimEnd();
359
+ if (text === "")
360
+ return indent;
361
+ const last = syntaxTree(context.state).resolveInner(line.from + text.length, -1);
362
+ return opening.has(last.name) ? indent + context.unit : indent;
363
+ }
364
+
365
+ /******************************************************************************
366
+ Copyright (c) Microsoft Corporation.
367
+
368
+ Permission to use, copy, modify, and/or distribute this software for any
369
+ purpose with or without fee is hereby granted.
370
+
371
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
372
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
373
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
374
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
375
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
376
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
377
+ PERFORMANCE OF THIS SOFTWARE.
378
+ ***************************************************************************** */
379
+ /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
380
+
381
+
382
+ function __awaiter(thisArg, _arguments, P, generator) {
383
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
384
+ return new (P || (P = Promise))(function (resolve, reject) {
385
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
386
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
387
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
388
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
389
+ });
390
+ }
391
+
392
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
393
+ var e = new Error(message);
394
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
395
+ };
396
+
397
+ function resolveConfig(config) {
398
+ var _a, _b, _c, _d;
399
+ return {
400
+ abbreviationCharacter: (_a = config.leader) !== null && _a !== void 0 ? _a : "\\",
401
+ customTranslations: (_b = config.customTranslations) !== null && _b !== void 0 ? _b : {},
402
+ eagerReplacementEnabled: (_c = config.eagerReplacement) !== null && _c !== void 0 ? _c : true,
403
+ inStringLiterals: (_d = config.inStringLiterals) !== null && _d !== void 0 ? _d : false,
404
+ };
405
+ }
406
+ const stringLiteralNodes = new Set([
407
+ "String",
408
+ "RawString",
409
+ "StringInterp",
410
+ "InterpolatedString",
411
+ "Char",
412
+ "CharEscape",
413
+ ]);
414
+ // Whether `pos` is inside the quotes of a string or character literal.
415
+ function insideStringLiteral(state, pos) {
416
+ var _a;
417
+ const tree = syntaxTree(state);
418
+ // A character literal that is still being typed is not a literal to the
419
+ // parser yet: all there is before the cursor is a lone `'` operator, or
420
+ // that and the backslash of an escape (the second leader of `'\\'`).
421
+ // (`x'` is an identifier, so a leader after it still starts an
422
+ // abbreviation.)
423
+ const before = state.sliceDoc(Math.max(0, pos - 2), pos);
424
+ const quote = before.endsWith("'") ? pos - 1 : before === "'\\" ? pos - 2 : -1;
425
+ if (quote >= 0) {
426
+ const node = tree.resolveInner(quote + 1, -1);
427
+ if (node.name === "Operator" && node.from === quote)
428
+ return true;
429
+ }
430
+ const inner = tree.resolveInner(pos, -1);
431
+ for (let node = inner; node; node = node.parent) {
432
+ // Strictly inside the node, or at the end of one that isn't closed yet
433
+ // (a string without its closing quote runs to the end of the document).
434
+ const inside = node.from < pos && (pos < node.to || !!((_a = node.lastChild) === null || _a === void 0 ? void 0 : _a.type.isError));
435
+ if (!inside)
436
+ continue;
437
+ // The braces of an `s!"…{…}…"` interpolation hold ordinary code.
438
+ if (node.name === "InterpBraces")
439
+ return false;
440
+ if (stringLiteralNodes.has(node.name))
441
+ return true;
442
+ }
443
+ return false;
444
+ }
445
+ // Dispatched when the set of tracked abbreviations changed without the
446
+ // document changing, so that the underline is redrawn.
447
+ const trackingChanged = StateEffect.define();
448
+ /// Connects one editor to the abbreviation engine. The host must call
449
+ /// `applyChanges` for every transaction as it is applied, and `afterUpdate`
450
+ /// once the new state is in place.
451
+ class AbbreviationSession {
452
+ constructor(host, config = {}, provider) {
453
+ this.host = host;
454
+ // Replacements run one after the other: each one may dispatch, which
455
+ // reports further changes while it is still in progress.
456
+ this.queue = Promise.resolve();
457
+ // How many of them have not finished yet.
458
+ this.unfinished = 0;
459
+ this.failed = false;
460
+ this.destroyed = false;
461
+ this.config = resolveConfig(config);
462
+ this.rewriter = new AbbreviationRewriter(this.config, provider !== null && provider !== void 0 ? provider : new AbbreviationProvider(this.config), this);
463
+ }
464
+ /// The abbreviations being typed, leader included, as document ranges.
465
+ get tracked() {
466
+ const ranges = [];
467
+ for (const { range } of this.rewriter.getTrackedAbbreviations())
468
+ ranges.push({ from: range.offset, to: range.offset + range.length });
469
+ return ranges.sort((a, b) => a.from - b.from);
470
+ }
471
+ /// Report a transaction's changes. Never dispatches, so it is safe to
472
+ /// call while the editor is updating.
473
+ applyChanges(startState, changes) {
474
+ if (changes.empty)
475
+ return;
476
+ const { abbreviationCharacter: leader, inStringLiterals } = this.config;
477
+ const input = [];
478
+ changes.iterChanges((fromA, toA, _fromB, _toB, inserted) => {
479
+ let newText = inserted.toString();
480
+ // The engine starts tracking when the inserted text is the leader.
481
+ // Where that must not happen, report text of the same length that
482
+ // isn't the leader, so that the positions it keeps stay correct.
483
+ if (newText === leader &&
484
+ !inStringLiterals &&
485
+ insideStringLiteral(startState, fromA))
486
+ newText = "\0".repeat(newText.length);
487
+ input.push({ range: new Range(fromA, toA - fromA), newText });
488
+ });
489
+ try {
490
+ this.rewriter.changeInput(input);
491
+ }
492
+ catch (_a) {
493
+ this.rewriter.resetTrackedAbbreviations();
494
+ }
495
+ }
496
+ /// Let the engine react to the update that was just applied: replace what
497
+ /// the change finished, and what the cursor has left. Resolves once the
498
+ /// editor is up to date.
499
+ afterUpdate(docChanged, selectionSet) {
500
+ if (!docChanged && !selectionSet)
501
+ return this.queue;
502
+ if (this.rewriter.getTrackedAbbreviations().size === 0)
503
+ return this.queue;
504
+ return this.enqueue(() => __awaiter(this, void 0, void 0, function* () {
505
+ if (docChanged)
506
+ yield this.rewriter.triggerAbbreviationReplacement();
507
+ yield this.rewriter.changeSelections(this.collectSelections());
508
+ }));
509
+ }
510
+ /// Replace every abbreviation being typed, finished or not. This is VS
511
+ /// Code's `lean4.input.convert`, which it binds to Tab.
512
+ ///
513
+ /// The document is changed before this returns (unless a replacement is
514
+ /// still in progress), so that whatever runs next sees the symbols: the
515
+ /// rest of a key binding, or a host that reads the document when a button
516
+ /// is pressed. Only a cursor that the abbreviation places is moved later.
517
+ convertAll() {
518
+ return this.enqueue(() => this.rewriter.replaceAllTrackedAbbreviations(), true);
519
+ }
520
+ destroy() {
521
+ this.destroyed = true;
522
+ this.rewriter.resetTrackedAbbreviations();
523
+ }
524
+ enqueue(step, immediately = false) {
525
+ const idle = this.unfinished === 0;
526
+ this.unfinished++;
527
+ const run = () => this.execute(step).then(() => void this.unfinished--);
528
+ if (immediately && idle) {
529
+ // The queue has to name this step before it starts, for anything that
530
+ // is enqueued while it runs.
531
+ let finished;
532
+ const running = new Promise((resolve) => (finished = resolve));
533
+ this.queue = running;
534
+ void run().then(finished);
535
+ return running;
536
+ }
537
+ return (this.queue = this.queue.then(run));
538
+ }
539
+ // Runs one step, and never rejects.
540
+ execute(step) {
541
+ return __awaiter(this, void 0, void 0, function* () {
542
+ if (this.destroyed)
543
+ return;
544
+ try {
545
+ yield step();
546
+ }
547
+ catch (_a) {
548
+ this.failed = true;
549
+ }
550
+ if (this.failed && !this.destroyed) {
551
+ // Whatever went wrong, typing must keep working: forget what was
552
+ // being tracked and start afresh at the next leader.
553
+ this.failed = false;
554
+ const wasTracking = this.rewriter.getTrackedAbbreviations().size > 0;
555
+ this.rewriter.resetTrackedAbbreviations();
556
+ if (wasTracking)
557
+ this.host.dispatch({ effects: trackingChanged.of(null) });
558
+ }
559
+ });
560
+ }
561
+ // AbbreviationTextSource, the engine's view of the editor.
562
+ replaceAbbreviations(changes) {
563
+ try {
564
+ const { state } = this.host;
565
+ if (state.readOnly)
566
+ throw new Error("The editor is read-only");
567
+ if (changes.length === 0) {
568
+ // Nothing to replace (the abbreviation matched nothing), but it is
569
+ // no longer tracked, so its underline has to go.
570
+ this.host.dispatch({ effects: trackingChanged.of(null) });
571
+ return Promise.resolve(true);
572
+ }
573
+ const changeSet = state.changes(changes.map(({ range, newText }) => ({
574
+ from: range.offset,
575
+ to: range.offset + range.length,
576
+ insert: newText,
577
+ })));
578
+ this.host.dispatch({
579
+ changes: changeSet,
580
+ // A cursor inside an abbreviation ends up after its symbol.
581
+ selection: state.selection.map(changeSet, 1),
582
+ // Not "input.type": the replacement then is an undo step of its
583
+ // own, so that one undo brings back the abbreviation as typed.
584
+ userEvent: "input.abbreviation",
585
+ });
586
+ return Promise.resolve(true);
587
+ }
588
+ catch (_a) {
589
+ this.failed = true;
590
+ return Promise.resolve(false);
591
+ }
592
+ }
593
+ selectionMoveMode() {
594
+ // As in VS Code: only a cursor that sits right behind a replaced
595
+ // abbreviation moves, to where the abbreviation says the cursor goes
596
+ // (between the brackets of `\<>`, for instance).
597
+ return { kind: "OnlyMoveCursorSelections", updateUnchangedSelections: false };
598
+ }
599
+ collectSelections() {
600
+ return this.host.state.selection.ranges.map((range) => new Range(range.from, range.to - range.from));
601
+ }
602
+ setSelections(selections) {
603
+ const { state } = this.host;
604
+ const current = state.selection;
605
+ if (selections.length === 0 || selections.length !== current.ranges.length)
606
+ return;
607
+ const length = state.doc.length;
608
+ let moved = false;
609
+ const ranges = selections.map((selection, i) => {
610
+ const from = Math.min(selection.offset, length);
611
+ const to = Math.min(selection.offset + selection.length, length);
612
+ const before = current.ranges[i];
613
+ if (before.from === from && before.to === to)
614
+ return before;
615
+ moved = true;
616
+ return EditorSelection.range(from, to);
617
+ });
618
+ if (moved)
619
+ this.host.dispatch({
620
+ selection: EditorSelection.create(ranges, current.mainIndex),
621
+ });
622
+ }
623
+ }
624
+ // The session of each editor that has the extension, for the command below.
625
+ const sessions = new WeakMap();
626
+ // VS Code underlines the abbreviation being typed.
627
+ const trackedMark = Decoration.mark({ class: "cm-lean-abbreviation" });
628
+ const abbreviationTheme = EditorView.baseTheme({
629
+ ".cm-lean-abbreviation": { textDecoration: "underline" },
630
+ ".cm-lean-abbreviation-hint": { padding: "3px 8px" },
631
+ ".cm-lean-abbreviation-hint code": { fontFamily: "monospace" },
632
+ });
633
+ /// The hint for the symbol that starts at `pos`, if the table has one. This
634
+ /// is what the VS Code extension shows on hover, from the same table.
635
+ ///
636
+ /// Characters every keyboard has give no hint (the table has `\\` for `\`),
637
+ /// and neither does a symbol in a string or character literal, unless
638
+ /// abbreviations work there.
639
+ function abbreviationHintAt(state, pos, config = {}, provider = new AbbreviationProvider(resolveConfig(config))) {
640
+ const line = state.doc.lineAt(pos);
641
+ const leader = provider.config.abbreviationCharacter;
642
+ const symbols = provider.findSymbolsIn(line.text.slice(pos - line.from));
643
+ for (const symbol of symbols) {
644
+ if (!/[^\x00-\x7f]/.test(symbol))
645
+ continue;
646
+ const abbreviations = provider.collectAllAbbreviations(symbol);
647
+ if (abbreviations.length === 0)
648
+ continue;
649
+ if (!config.inStringLiterals && insideStringLiteral(state, pos))
650
+ return null;
651
+ return {
652
+ from: pos,
653
+ to: pos + symbol.length,
654
+ symbol,
655
+ abbreviations: abbreviations.map((abbreviation) => leader + abbreviation),
656
+ pairs: provider
657
+ .findAutoClosingAbbreviations(symbol)
658
+ .map(([abbreviation, closing]) => ({
659
+ abbreviation: leader + abbreviation,
660
+ closing,
661
+ })),
662
+ };
663
+ }
664
+ return null;
665
+ }
666
+ // "Type ⟨ using \< or \langle. ⟨ can be auto-closed with ⟩ using \<>."
667
+ function renderHint(hint) {
668
+ const dom = document.createElement("div");
669
+ dom.className = "cm-lean-abbreviation-hint";
670
+ const code = (text) => {
671
+ dom.appendChild(document.createElement("code")).textContent = text;
672
+ };
673
+ dom.append(`Type ${hint.symbol} using `);
674
+ hint.abbreviations.forEach((abbreviation, index) => {
675
+ if (index > 0)
676
+ dom.append(" or ");
677
+ code(abbreviation);
678
+ });
679
+ if (hint.pairs.length > 0) {
680
+ dom.append(`. ${hint.symbol} can be auto-closed with `);
681
+ hint.pairs.forEach(({ abbreviation, closing }, index) => {
682
+ if (index > 0)
683
+ dom.append(" or ");
684
+ dom.append(`${closing} using `);
685
+ code(abbreviation);
686
+ });
687
+ dom.append(".");
688
+ }
689
+ return dom;
690
+ }
691
+ class AbbreviationPlugin {
692
+ constructor(view, config, provider) {
693
+ this.view = view;
694
+ this.decorations = Decoration.none;
695
+ this.session = new AbbreviationSession(view, config, provider);
696
+ sessions.set(view, this.session);
697
+ }
698
+ update(update) {
699
+ for (const tr of update.transactions)
700
+ this.session.applyChanges(tr.startState, tr.changes);
701
+ const length = update.state.doc.length;
702
+ this.decorations = Decoration.set(this.session.tracked
703
+ .filter(({ from, to }) => from < to && to <= length)
704
+ .map(({ from, to }) => trackedMark.range(from, to)));
705
+ }
706
+ destroy() {
707
+ this.session.destroy();
708
+ if (sessions.get(this.view) === this.session)
709
+ sessions.delete(this.view);
710
+ }
711
+ }
712
+ /// Replace the abbreviations being typed with their symbols right away.
713
+ /// Returns false, leaving the key to other bindings, when there are none.
714
+ const convertLeanAbbreviations = (view) => {
715
+ const session = sessions.get(view);
716
+ if (!session || session.tracked.length === 0)
717
+ return false;
718
+ void session.convertAll();
719
+ return true;
720
+ };
721
+ // The same, but never claims the key: what the key normally does happens
722
+ // next, on the document with the symbols in it.
723
+ const convertFirst = (view) => {
724
+ convertLeanAbbreviations(view);
725
+ return false;
726
+ };
727
+ /// Lean's `\`-abbreviations, as an extension. `lean()` includes it.
728
+ function leanUnicodeInput(config = {}) {
729
+ // The table is the same for every editor this extension ends up in.
730
+ const provider = new AbbreviationProvider(resolveConfig(config));
731
+ const plugin = ViewPlugin.define((view) => new AbbreviationPlugin(view, config, provider), { decorations: (instance) => instance.decorations });
732
+ return [
733
+ plugin,
734
+ // Listeners run once the update is complete, which is when the engine
735
+ // may dispatch its replacements.
736
+ EditorView.updateListener.of((update) => {
737
+ var _a;
738
+ const session = (_a = update.view.plugin(plugin)) === null || _a === void 0 ? void 0 : _a.session;
739
+ if (!session)
740
+ return;
741
+ void session.afterUpdate(update.docChanged, update.selectionSet);
742
+ }),
743
+ // VS Code replaces everything when the editor is switched away from.
744
+ // Here that is when focus moves elsewhere on the page, and it is done
745
+ // in the event itself: pressing a button is what takes the focus away,
746
+ // and the button's action must find the symbols in the document.
747
+ // Switching to another window is not leaving the editor.
748
+ EditorView.domEventHandlers({
749
+ blur(_event, view) {
750
+ if (view.dom.ownerDocument.hasFocus())
751
+ convertLeanAbbreviations(view);
752
+ return false;
753
+ },
754
+ }),
755
+ Prec.highest(keymap.of([
756
+ // Only takes Tab while an abbreviation is being typed. Highest
757
+ // precedence, because the editor's own Tab binding would otherwise
758
+ // indent instead.
759
+ { key: "Tab", run: convertLeanAbbreviations },
760
+ // A new line is indented by what is in front of it. Replace first,
761
+ // so that `\<` counts as the opening bracket it is about to become.
762
+ { key: "Enter", run: convertFirst, shift: convertFirst },
763
+ { key: "Mod-Enter", run: convertFirst },
764
+ ])),
765
+ config.hover === false
766
+ ? []
767
+ : hoverTooltip((view, pos, side) => {
768
+ // `pos` is the position nearest the pointer. The character under
769
+ // the pointer starts there, or ends there when the pointer is to
770
+ // its left.
771
+ const line = view.state.doc.lineAt(pos);
772
+ const start = side < 0
773
+ ? line.from + findClusterBreak(line.text, pos - line.from, false)
774
+ : pos;
775
+ const hint = abbreviationHintAt(view.state, start, config, provider);
776
+ if (!hint)
777
+ return null;
778
+ return {
779
+ pos: hint.from,
780
+ end: hint.to,
781
+ above: true,
782
+ create: () => ({ dom: renderHint(hint) }),
783
+ };
784
+ }),
785
+ abbreviationTheme,
786
+ ];
787
+ }
788
+
789
+ const leanLanguage = LRLanguage.define({
790
+ name: "lean",
791
+ parser: parser.configure({
792
+ props: [
793
+ styleTags({
794
+ // Modifiers (`private`, `partial`, …) are a node of their own but
795
+ // share the keyword tag: that is how VS Code's stock themes show
796
+ // them, and `t.modifier` would give them the colour of a type name
797
+ // in Exercism's dark theme (One Dark), where types should stand out.
798
+ "Keyword SymbolKeyword InterpKeyword Modifier": tags.keyword,
799
+ // The name a declaration introduces, as in `def add`. Not every
800
+ // such name is a function (`structure Point`), but the Lean 4 VS
801
+ // Code extension's grammar calls them all `entity.name.function`.
802
+ "DefinitionName/Identifier": tags.function(tags.definition(tags.variableName)),
803
+ // `@[simp]` and the list of `attribute [simp]`, as one unit: the
804
+ // `!` keeps what is inside from being styled on its own.
805
+ "Attribute!": tags.meta,
806
+ Incomplete: tags.invalid,
807
+ HashCommand: tags.meta,
808
+ "Sort TypeName StdTypeName": tags.typeName,
809
+ "QualifiedType StdNamespace": tags.namespace,
810
+ BooleanLiteral: tags.bool,
811
+ Identifier: tags.variableName,
812
+ NameLiteral: tags.atom,
813
+ "String RawString StringInterp InterpolatedString": tags.string,
814
+ "InterpPrefix InterpBraceStart": tags.meta,
815
+ Char: tags.character,
816
+ "Escape CharEscape InterpEscape": tags.escape,
817
+ Number: tags.number,
818
+ Scientific: tags.float,
819
+ LineComment: tags.lineComment,
820
+ "BlockComment NestedComment": tags.blockComment,
821
+ "DocComment ModuleDoc": tags.docComment,
822
+ "Operator [ ]": tags.operator,
823
+ "( )": tags.paren,
824
+ "{ }": tags.brace,
825
+ "⟨ ⟩": tags.bracket,
826
+ // InterpBraces closes with the same "}" token ordinary Braces
827
+ // does (see the grammar comment on InterpBraces for why), so this
828
+ // more specific, parent-scoped rule is what makes it read as part
829
+ // of the interpolation instead of an ordinary brace — it takes
830
+ // priority over the generic "{ }" rule above for this one case.
831
+ "InterpBraces/}": tags.meta,
832
+ }),
833
+ // One rule for every node, so that neither the bracket-aligning
834
+ // default for delimited nodes nor the column-0 default for the top
835
+ // node applies. See `leanIndent`.
836
+ indentNodeProp.add(() => leanIndent),
837
+ foldNodeProp.add({
838
+ "Parens Brackets Braces Anonymous": foldInside,
839
+ "BlockComment DocComment ModuleDoc": foldInside,
840
+ }),
841
+ ],
842
+ }),
843
+ languageData: {
844
+ commentTokens: {
845
+ line: "--",
846
+ block: { open: "/-", close: "-/" },
847
+ },
848
+ closeBrackets: {
849
+ brackets: ["(", "[", "{", "⟨", '"'],
850
+ // A quote typed right after a word is not closed, unless the word is
851
+ // one of these. `!` counts as part of a word here, see `wordChars`.
852
+ stringPrefixes: ["s!", "f!", "m!", "r"],
853
+ },
854
+ // `x'`, `get!` and `find?` are names, so a double click, word motion and
855
+ // whole-word search take each as one word. The Lean 4 VS Code extension
856
+ // does this with its `wordPattern`.
857
+ wordChars: "'!?",
858
+ },
859
+ });
860
+ function lean(config = {}) {
861
+ const { unicodeInput = true } = config;
862
+ return new LanguageSupport(leanLanguage, unicodeInput === false
863
+ ? []
864
+ : [leanUnicodeInput(unicodeInput === true ? {} : unicodeInput)]);
865
+ }
866
+
867
+ export { abbreviationHintAt, convertLeanAbbreviations, lean, leanLanguage, leanUnicodeInput };