Basic interface for configuration evaluation #
Equations
Instances For
Like evalTermWithInfo, but uses an existing ToExpr instance
for expectedType? and for constructing the expression.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Evaluates f e, and if that does throwUnsupportedExpr, evaluates f (← whnf e).
If either throw another exception, aborts immediately with that exception.
If both do throwUnsupportedExpr, then this generates an exception.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- item.isAnonymous = item.optionComps.isEmpty
Instances For
Equations
- item.root = match item.optionComps with | c :: tail => c | x => Lean.Syntax.missing
Instances For
Equations
- item.getRootStr = match item.root.getId with | pre.str s => s | x => ""
Instances For
Instances For
Equations
- item.prevRoot = match item.prevOptionComps with | c :: tail => c | x => Lean.Syntax.missing
Instances For
Gets the current name of the option after any shifting.
For example, if an option is named a.b.c.d and there is a handler
for a.b.*, then the handler receives a ConfigItem whose current option
name is c.d.
Equations
- item.getCurrOptionName = List.foldl Lean.Name.appendCore Lean.Name.anonymous (List.map (fun (x : Lean.Syntax) => x.getId) item.optionComps)
Instances For
Drops the first component of the optionName, returning the new config item.
The first component is stored at the front of prevOptionComps.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Instances For
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Interprets cfg as configuration item or list of configuration items.
Items are interpreted in a way that allows user-defined configurations. Nearly anything that looks like configuration items or lists of configuration items will be interpreted. We're expecting an item that has one of the following formats:
"(" ident/atom ":=" syntax ")""+" ident/atom"-" ident/atom
The specification:
- A null node is a list of configurations
- A one-argument node is considered to be a wrapper like
optConfigorconfigItem. - A node with at two arguments starting with a "+"/"-" atom and whose second
argument is an ident or atom is a
posConfigItem/negConfigItem - A node with at most five arguments starting with a "(" atom and whose second argument
is an ident or atom is a
valConfigItem. The fourth argument is the value, and it is allowed to have arbitary syntax (it does not need to be aTerm). - A bare atom is considered to be a
"+"option.
We trust that any atoms are valid as idents. The atom will be parsed using String.toName
to form the name. (Small optimization: if the name doesn't contain ., we use Name.mkSimple
to skip parsing. Atoms must not contain numerals or «» escapes.)
On interpretation error, onErr is called with the current configuration object and the offending
syntax item. It may process the item itself or otherwise throw an error. We leave it to onErr
to decide what to do for items containing Syntax.missing.
Like foldConfigM but takes an array of configurations or configuration items.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Default onErr handler. If the cfgItem contains .missing, we assume an error has already been
reported by the parser and return cfg. Otherwise, we throw an unsupported syntax exception.
If cfgType? is present, then it adds completion info when the identifier is missing.
Equations
- One or more equations did not get rendered due to their size.
- Lean.Elab.ConfigEval.EvalConfigItem.defaultOnErr cfg cfgItem cfgType? = (fun (__r : Unit) => if cfgItem.hasMissing = true then pure cfg else Lean.Elab.throwUnsupportedSyntax) ()
Instances For
Applies the configuration cfg to init using eval.set.
If logExceptions is true, then catches and logs exceptions.
The onErr callback is used for invalid configuration syntax.
Note: this should be run from within runConfigElab.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Applies the configuration cfg to init using eval.set.
If logExceptions is true, then catches and logs exceptions.
The onErr callback is used for invalid configuration syntax.
Note: this should be run from within runConfigElab.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Runs mx using a fresh meta and term state.
This should be used around any configuration elaboration.
Equations
Instances For
Calls EvalConfigItem.setConfig' from within runConfigElab.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Calls EvalConfigItem.setConfigs' from within runConfigElab.
Equations
- eval.setConfigs' init cfgs onErr logExceptions = if cfgs.isEmpty = true then pure init else Lean.Elab.ConfigEval.runConfigElab (eval.setConfigs init cfgs onErr logExceptions)