conlang: Docs!
This commit is contained in:
parent
3534be5fbc
commit
0c2b0002ce
@ -8,6 +8,7 @@
|
||||
//! - [Assign], [Modify], [Binary], and [Unary] expressions
|
||||
//! - [ModifyKind], [BinaryKind], and [UnaryKind] operators
|
||||
//! - [Ty] and [TyKind]: Type qualifiers
|
||||
//! - [Pattern]: Pattern matching operators
|
||||
//! - [Path]: Path expressions
|
||||
use cl_structures::{intern::interned::Interned, span::*};
|
||||
|
||||
@ -351,7 +352,7 @@ pub enum ExprKind {
|
||||
Quote(Quote),
|
||||
/// A local bind instruction, `let` [`Sym`] `=` [`Expr`]
|
||||
Let(Let),
|
||||
/// A [Match] expression, `match` [Expr] `{` ([MatchArm] `,`)* [MatchArm]? `}`
|
||||
/// A [Match] expression: `match` [Expr] `{` ([MatchArm] `,`)* [MatchArm]? `}`
|
||||
Match(Match),
|
||||
/// An [Assign]ment expression: [`Expr`] (`=` [`Expr`])\+
|
||||
Assign(Assign),
|
||||
@ -426,16 +427,17 @@ pub enum Pattern {
|
||||
Struct(Path, Vec<(Path, Option<Pattern>)>),
|
||||
}
|
||||
|
||||
/// A `match` expression: `match` `{` ([MatchArm] `,`)* [MatchArm]? `}`
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
|
||||
pub struct Match {
|
||||
pub scrutinee: Box<Expr>,
|
||||
pub arms: Vec<MatchArm>,
|
||||
}
|
||||
|
||||
/// A single arm of a [Match] expression: [`Pattern`] `=>` [`Expr`]
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
|
||||
pub struct MatchArm(pub Pattern, pub Expr);
|
||||
|
||||
|
||||
/// An [Assign]ment expression: [`Expr`] ([`ModifyKind`] [`Expr`])\+
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
|
||||
pub struct Assign {
|
||||
@ -518,6 +520,7 @@ pub enum UnaryKind {
|
||||
Tilde,
|
||||
}
|
||||
|
||||
/// A cast expression: [`Expr`] `as` [`Ty`]
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
|
||||
pub struct Cast {
|
||||
pub head: Box<ExprKind>,
|
||||
|
@ -8,6 +8,7 @@
|
||||
//! - [Assign], [Binary], and [Unary] expressions
|
||||
//! - [ModifyKind], [BinaryKind], and [UnaryKind] operators
|
||||
//! - [Ty] and [TyKind]: Type qualifiers
|
||||
//! - [Pattern]: Pattern matching operators
|
||||
//! - [Path]: Path expressions
|
||||
#![warn(clippy::all)]
|
||||
#![feature(decl_macro)]
|
||||
|
@ -44,7 +44,8 @@ builtins! {
|
||||
Ok(ConValue::Empty)
|
||||
}
|
||||
|
||||
/// Prints the [Debug](std::fmt::Debug) version of the input values
|
||||
/// Prints the [Debug](std::fmt::Debug) version of the input values,
|
||||
/// and passes them back as a tuple.
|
||||
pub fn dbg<_, args> () -> IResult<ConValue> {
|
||||
let mut out = stdout().lock();
|
||||
for arg in args {
|
||||
@ -53,6 +54,7 @@ builtins! {
|
||||
Ok(args.into())
|
||||
}
|
||||
|
||||
/// Prints the pretty [Debug](std::fmt::Debug) version of the input values.
|
||||
pub fn dbgp<_, args> () -> IResult<ConValue> {
|
||||
let mut out = stdout().lock();
|
||||
for arg in args {
|
||||
@ -279,6 +281,7 @@ builtins! {
|
||||
})
|
||||
}
|
||||
|
||||
/// Does the opposite of `&`
|
||||
pub fn deref(tail) -> IResult<ConValue> {
|
||||
Ok(match tail {
|
||||
ConValue::Ref(v) => Rc::as_ref(v).clone(),
|
||||
|
Loading…
x
Reference in New Issue
Block a user