Skip to content

Commit cd31811

Browse files
committed
front: add "Expression" style as secret option
1 parent 8bc8808 commit cd31811

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

src/wasm.rs

+12-5
Original file line numberDiff line numberDiff line change
@@ -193,10 +193,14 @@ impl PredicateStyleJs {
193193
left: &RuleSetJs,
194194
right: &RuleSetJs,
195195
) -> Option<PredicateStyleJs> {
196-
let ty = TypeOfInterest::from_str(name).ok()?;
197-
let left = left.as_ruleset();
198-
let right = right.as_ruleset();
199-
let style = PredicateStyle::sequent_with_minimal_state(ty, left, right);
196+
let style = if name == "Expression" {
197+
PredicateStyle::Expression
198+
} else {
199+
let ty = TypeOfInterest::from_str(name).ok()?;
200+
let left = left.as_ruleset();
201+
let right = right.as_ruleset();
202+
PredicateStyle::sequent_with_minimal_state(ty, left, right)
203+
};
200204
Some(PredicateStyleJs(style))
201205
}
202206

@@ -208,7 +212,10 @@ impl PredicateStyleJs {
208212
let mut out = String::new();
209213
match self.0 {
210214
PredicateStyle::Expression => {
211-
todo!("explain expression style")
215+
let _ = write!(
216+
&mut out,
217+
"Track the user-observable type along with the expression being matched on"
218+
);
212219
}
213220
PredicateStyle::Sequent {
214221
ty: type_of_interest,

web/src/components/Solver.jsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ export function Help({show, setShow, style}) {
9898
</>
9999
}
100100

101-
const availableStyles = ['UserVisible', 'InMemory'];
101+
const availableStyles = ['UserVisible', 'InMemory', 'Expression'];
102102

103103
export function MainNavBar({compare, setCompare, style, setStyleName, styleMap}) {
104104
const navigate = useNavigate()
@@ -408,7 +408,7 @@ export default function Solver() {
408408
const [optionsRight, setOptionsRight] = useStateInParams(sp, 'opts2', RuleSetJs.from_bundle_name('rfc3627', 'rfc3627'), RuleSetJs.decode, (o) => o.encode());
409409
const [inputQuery, setInputQuery] = useStateInParams(sp, 'q', "[&x]: &mut [&T]");
410410
const [mode, setMode] = useStateInParams(sp, 'mode', 'typechecker', validateIn(['typechecker', 'rules', 'compare']));
411-
const [styleName, setStyleName] = useStateInParams(sp, 'style', 'UserVisible', validateIn(['UserVisible', 'InMemory', 'Sequent', 'SequentBindingMode']));
411+
const [styleName, setStyleName] = useStateInParams(sp, 'style', 'UserVisible', validateIn(['UserVisible', 'InMemory', 'Expression', 'Sequent', 'SequentBindingMode']));
412412

413413
// Map from style name to predicate style. Takes into account the selected
414414
// options to hide parts of the predicate we don't care about.

0 commit comments

Comments
 (0)