-
Notifications
You must be signed in to change notification settings - Fork 63
Probectors #1998
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dataframe-projector
Are you sure you want to change the base?
Probectors #1998
Changes from all commits
5ad0a15
704e9f4
adfd919
571591b
ed5b9af
b0cf6c9
c88cde2
05bb739
6b96eb3
429bed6
26ea407
15eeaee
35c3f01
391a300
43c8f93
a101ce4
47db3e5
b8997ab
f3aa2ee
08c02a7
3fbcf40
3ac7269
6b6b949
d20c1fa
bff8aae
cf29da8
ae6da67
125a225
52c5863
79c01d0
6e3cb4a
5281a1d
b4250c9
38d099e
c9eeaa0
84fca98
2a2ecdc
6eed8bd
9f4035d
4233ac9
5468402
5a7f3b5
4ccaaa5
a72cfb2
3d5a82f
5312efb
7bb9657
bdb03df
07b4e59
d35a384
06eb01b
2e4dbaf
84ea718
2c2de90
1c30135
55841b9
616fd3c
97949f1
f9bf5f8
34b6f2e
e9ebe54
9c93072
b270920
3bc417c
6c93e95
6fce622
93462d8
8d0567c
69e9be5
92bddf1
2e52488
ee2f5bf
52147a3
8b43d5a
b2acebd
ba7870b
9f9075a
a0438b8
db04bff
aff6787
144cb72
6383832
8f32034
62955e2
fe67545
47f1e7a
b703642
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -184,37 +184,90 @@ let go = | |||||||||||
| | Some(z) => Ok(z) | ||||||||||||
| | None => Error(Cant_project) | ||||||||||||
| } | ||||||||||||
| | SetSyntax(idx, seg) => | ||||||||||||
| Ok( | ||||||||||||
| update( | ||||||||||||
| p => | ||||||||||||
| { | ||||||||||||
| ...p, | ||||||||||||
| syntax: Segment.parenthesize(seg), | ||||||||||||
| }, | ||||||||||||
| projector_idx_to_id(idx), | ||||||||||||
| z, | ||||||||||||
| ), | ||||||||||||
| ) | ||||||||||||
| | SetSyntax(idx, kind, seg) => | ||||||||||||
| let id = idx_to_id(kind, idx); | ||||||||||||
| // Ensure seg is parenthesized unless it already is | ||||||||||||
| let parenthesized_piece = | ||||||||||||
| Segment.unparenthesize(seg) |> Segment.parenthesize; | ||||||||||||
| if (ProjectorCore.Kind.is_refractor(kind)) { | ||||||||||||
| let parenthesized_seg = [parenthesized_piece]; | ||||||||||||
| // Check for existing refractors (automatic ephemeral or manual) that control this projector | ||||||||||||
| let original_id = id; | ||||||||||||
| let ephemeral_model = | ||||||||||||
| Id.Map.find_opt(original_id, z.refractors.autos.ephemerals) | ||||||||||||
| |> Option.map((pr: Refractors.entry) => pr.model); | ||||||||||||
| let manual_refractor_model = | ||||||||||||
| List.assoc_opt(original_id, z.refractors.manuals) | ||||||||||||
| |> Option.map((pr: Refractors.entry) => pr.model); | ||||||||||||
| switch (manual_refractor_model, ephemeral_model) { | ||||||||||||
| | (Some(refractor_model), _) => | ||||||||||||
| // Manual refractor exists: update the selection to this projector's term range, | ||||||||||||
| // replace with new syntax, and create a new refractor probe monitoring the updated term | ||||||||||||
| let new_id = | ||||||||||||
| MakeTerm.from_zip_for_sem( | ||||||||||||
| Zipper.unzip(~direction=Right, parenthesized_seg), | ||||||||||||
| ). | ||||||||||||
| term | ||||||||||||
| |> Language.Exp.rep_id; | ||||||||||||
|
|
||||||||||||
| let new_z = { | ||||||||||||
| open OptUtil.Syntax; | ||||||||||||
| let* (l, r) = TermData.extremes_shards(id, term_data); | ||||||||||||
| let+ z = Select.shard_range(l, r, z); | ||||||||||||
| let z = Zipper.replace_selection(Right, parenthesized_seg, z); | ||||||||||||
| ZipperBase.add_manual(~model=refractor_model, new_id, kind, z); | ||||||||||||
| }; | ||||||||||||
|
|
||||||||||||
| switch (new_z) { | ||||||||||||
| | Some(z) => Ok(z) | ||||||||||||
| | None => Error(Cant_project) | ||||||||||||
| }; | ||||||||||||
| | (_, Some(_)) => | ||||||||||||
| // Ephemeral refractor exists: update selection and replace syntax, | ||||||||||||
| // but don't create new refractor as this is handled automatically | ||||||||||||
|
|
||||||||||||
| let new_z = { | ||||||||||||
| open OptUtil.Syntax; | ||||||||||||
| let* (l, r) = TermData.extremes_shards(id, term_data); | ||||||||||||
| let+ z = Select.shard_range(l, r, z); | ||||||||||||
| let z = Zipper.replace_selection(Right, parenthesized_seg, z); | ||||||||||||
| z; | ||||||||||||
| }; | ||||||||||||
|
|
||||||||||||
| switch (new_z) { | ||||||||||||
| | Some(z) => Ok(z) | ||||||||||||
| | None => Error(Cant_project) | ||||||||||||
| }; | ||||||||||||
| | (None, None) => assert(false) | ||||||||||||
|
||||||||||||
| | (None, None) => assert(false) | |
| | (None, None) => | |
| // Invariant violation: refractor-kind projector without manual or ephemeral refractor. | |
| // Fail gracefully instead of crashing. | |
| Error(Cant_project) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -74,6 +74,7 @@ module M: Projector = { | |
|
|
||
| switch ( | ||
| info.utility.lift_syntax( | ||
| ~inline=true, | ||
| fun | ||
| | Exp(any) => | ||
| Exp({ | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.