pub enum SurfaceDecl {
Notation {
pattern: String,
template: String,
precedence: Option<u32>,
assoc: Assoc,
operator_form: Option<OperatorForm>,
},
Macro {
pattern: String,
template: String,
},
OpenSection(Option<String>),
CloseSection(Option<String>),
OpenNamespace(Name),
}Expand description
A declaration that extends the SURFACE rather than the context. Emitted by the command parser, applied by the REPL — so the one place a parser extension can land is the surface environment.
Variants§
Notation
Notation "a ⊕ b" := ((myOp a) b). and the fixity spellings, which are the same thing with
the shape and associativity given by the command word instead of by the pattern.
Fields
operator_form: Option<OperatorForm>For Infixl/Infixr/Prefix/Postfix, the operator’s own spelling: the pattern is
just the token and the holes are implied.
Macro
Macro "twiceIt $e" := … / MacroRules "nested![$x, $xs]" := ….
OpenSection(Option<String>)
Section First. — or a bare Section., which is Lean’s ANONYMOUS section
(section with no name), the ordinary way to scope a local without inventing a label for
it. None is that form.
CloseSection(Option<String>)
End First. — and, when the innermost open scope is a NAMESPACE of that name, the close of
that namespace instead. Lean spells both with one keyword and decides by what is open;
deciding it here rather than in the parser is what lets the parser stay text-only.
None is the bare End. that closes an anonymous section. It closes ONLY an anonymous
one: lean 4.14.0 answers namespace N … end with invalid 'end', name is missing (expected N), and a bare End that silently closed a named scope would leave every later
declaration somewhere nobody wrote.
OpenNamespace(Name)
Namespace Outer.Inner. — a namespace declarations are written INTO and short names resolve
against. Nothing is declared: like every other surface declaration this changes how a name
is spelled and read, never what exists.
Trait Implementations§
Source§impl Clone for SurfaceDecl
impl Clone for SurfaceDecl
Source§fn clone(&self) -> SurfaceDecl
fn clone(&self) -> SurfaceDecl
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for SurfaceDecl
impl RefUnwindSafe for SurfaceDecl
impl Send for SurfaceDecl
impl Sync for SurfaceDecl
impl Unpin for SurfaceDecl
impl UnsafeUnpin for SurfaceDecl
impl UnwindSafe for SurfaceDecl
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.