doughlang: Doc fixes

This commit is contained in:
2026-01-09 22:37:43 -05:00
parent a7ebf31878
commit 5d724af37b
5 changed files with 16 additions and 13 deletions

View File

@@ -2,7 +2,9 @@ use std::error::Error;
use doughlang::{ use doughlang::{
ast::{ ast::{
types::{Literal, Path}, visit::{Visit, Walk}, * types::{Literal, Path},
visit::{Visit, Walk},
*,
}, },
intern::interned::Interned, intern::interned::Interned,
lexer::Lexer, lexer::Lexer,

View File

@@ -23,7 +23,7 @@ pub trait AstTypes: Annotation {
/// A literal value /// A literal value
type Literal: Annotation; 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>; type MacroId: Annotation + Hash + AsRef<str>;
/// A (possibly interned) symbol or index /// A (possibly interned) symbol or index
@@ -31,12 +31,6 @@ pub trait AstTypes: Annotation {
/// A (possibly compound) symbol or index /// A (possibly compound) symbol or index
type Path: Annotation; 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. /// A value with an annotation.
@@ -279,9 +273,9 @@ impl<A: AstTypes> Expr<A> {
/// ```ignore /// ```ignore
/// let Pat (= Expr (else Expr)?)? /// let Pat (= Expr (else Expr)?)?
/// type Pat (= Expr)? /// type Pat (= Expr)?
/// fn Pat Expr /// fn Pat =? Expr
/// mod Pat Expr /// mod Pat =? Expr
/// impl Pat Expr /// impl Pat =? Expr
/// struct Pat /// struct Pat
/// enum Pat /// enum Pat
/// for Pat in Expr Expr (else Expr)? /// for Pat in Expr Expr (else Expr)?
@@ -295,6 +289,9 @@ pub struct Bind<A: AstTypes = DefaultTypes>(
pub Vec<Anno<Expr<A>, A>>, 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)] #[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum BindOp { pub enum BindOp {
/// A `let Pat (= Expr (else Expr)?)?` binding /// A `let Pat (= Expr (else Expr)?)?` binding
@@ -316,6 +313,7 @@ pub enum BindOp {
/// A `Pat => Expr` binding /// A `Pat => Expr` binding
Match, Match,
} }
/// Binding patterns for each kind of matchable value. /// Binding patterns for each kind of matchable value.
/// ///
/// This covers both bindings and type annotations in [Bind] expressions. /// This covers both bindings and type annotations in [Bind] expressions.

View File

@@ -72,7 +72,7 @@ pub trait Foldable<A: AstTypes, B: AstTypes>: Sized {
/// The return type of the associated [Fold] function /// The return type of the associated [Fold] function
type Out; 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>; 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, /// Destructures `self`, calling [`Foldable::fold_in`] on all foldable members,

View File

@@ -1,3 +1,5 @@
//! The default (as-parsed) implementation of the AST's customization points.
use std::fmt::Display; use std::fmt::Display;
use crate::{ast::AstTypes, fmt::FmtAdapter, intern::interned::Interned, span::Span}; use crate::{ast::AstTypes, fmt::FmtAdapter, intern::interned::Interned, span::Span};

View File

@@ -303,7 +303,7 @@ pub mod dropless_interner {
} }
impl<'a, T: Eq + Hash> DroplessInterner<'a, T> { 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
/// Panics if T [needs drop](std::mem::needs_drop) /// 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 /// Returns the [Interned] copy of the given value, if one already exists
/// ///
/// # Blocks /// # Blocks