doughlang: Doc fixes
This commit is contained in:
@@ -2,7 +2,9 @@ use std::error::Error;
|
||||
|
||||
use doughlang::{
|
||||
ast::{
|
||||
types::{Literal, Path}, visit::{Visit, Walk}, *
|
||||
types::{Literal, Path},
|
||||
visit::{Visit, Walk},
|
||||
*,
|
||||
},
|
||||
intern::interned::Interned,
|
||||
lexer::Lexer,
|
||||
|
||||
18
src/ast.rs
18
src/ast.rs
@@ -23,7 +23,7 @@ pub trait AstTypes: Annotation {
|
||||
/// A literal value
|
||||
type Literal: Annotation;
|
||||
|
||||
/// A (possibly interned) symbol or index which implements [AsRef<str>]
|
||||
/// A (possibly interned) symbol or index which implements [`AsRef<str>`]
|
||||
type MacroId: Annotation + Hash + AsRef<str>;
|
||||
|
||||
/// A (possibly interned) symbol or index
|
||||
@@ -31,12 +31,6 @@ pub trait AstTypes: Annotation {
|
||||
|
||||
/// A (possibly compound) symbol or index
|
||||
type Path: Annotation;
|
||||
|
||||
// /// An Operator in an [Expression](Expr)
|
||||
// type ExprOp: Annotation + Copy;
|
||||
|
||||
// /// An Operator within a [Pattern](Pat)
|
||||
// type PatOp: Annotation + Copy;
|
||||
}
|
||||
|
||||
/// A value with an annotation.
|
||||
@@ -279,9 +273,9 @@ impl<A: AstTypes> Expr<A> {
|
||||
/// ```ignore
|
||||
/// let Pat (= Expr (else Expr)?)?
|
||||
/// type Pat (= Expr)?
|
||||
/// fn Pat Expr
|
||||
/// mod Pat Expr
|
||||
/// impl Pat Expr
|
||||
/// fn Pat =? Expr
|
||||
/// mod Pat =? Expr
|
||||
/// impl Pat =? Expr
|
||||
/// struct Pat
|
||||
/// enum Pat
|
||||
/// for Pat in Expr Expr (else Expr)?
|
||||
@@ -295,6 +289,9 @@ pub struct Bind<A: AstTypes = DefaultTypes>(
|
||||
pub Vec<Anno<Expr<A>, A>>,
|
||||
);
|
||||
|
||||
/// The binding operation used by a [Bind].
|
||||
///
|
||||
/// See [Bind] for their syntactic representations
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||
pub enum BindOp {
|
||||
/// A `let Pat (= Expr (else Expr)?)?` binding
|
||||
@@ -316,6 +313,7 @@ pub enum BindOp {
|
||||
/// A `Pat => Expr` binding
|
||||
Match,
|
||||
}
|
||||
|
||||
/// Binding patterns for each kind of matchable value.
|
||||
///
|
||||
/// This covers both bindings and type annotations in [Bind] expressions.
|
||||
|
||||
@@ -72,7 +72,7 @@ pub trait Foldable<A: AstTypes, B: AstTypes>: Sized {
|
||||
/// The return type of the associated [Fold] function
|
||||
type Out;
|
||||
|
||||
/// Calls `Self`'s appropriate [Folder] function(s)
|
||||
/// Calls `Self`'s appropriate [Folder](Fold) function(s)
|
||||
fn fold_in<F: Fold<A, B> + ?Sized>(self, folder: &mut F) -> Result<Self::Out, F::Error>;
|
||||
|
||||
/// Destructures `self`, calling [`Foldable::fold_in`] on all foldable members,
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
//! The default (as-parsed) implementation of the AST's customization points.
|
||||
|
||||
use std::fmt::Display;
|
||||
|
||||
use crate::{ast::AstTypes, fmt::FmtAdapter, intern::interned::Interned, span::Span};
|
||||
|
||||
@@ -303,7 +303,7 @@ pub mod dropless_interner {
|
||||
}
|
||||
|
||||
impl<'a, T: Eq + Hash> DroplessInterner<'a, T> {
|
||||
/// Creates a new [DroplessInterner] backed by the provided [TypedArena]
|
||||
/// Creates a new [DroplessInterner] backed by the provided [`DroplessArena`]
|
||||
///
|
||||
/// # Panics
|
||||
/// Panics if T [needs drop](std::mem::needs_drop)
|
||||
@@ -335,6 +335,7 @@ pub mod dropless_interner {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/// Returns the [Interned] copy of the given value, if one already exists
|
||||
///
|
||||
/// # Blocks
|
||||
|
||||
Reference in New Issue
Block a user