143 releases (20 stable)
new 2025.5.0 | May 1, 2025 |
---|---|
2025.4.26-nightly… | Apr 26, 2025 |
2025.3.25-nightly… | Mar 25, 2025 |
2025.2.9 | Feb 9, 2025 |
2024.11.28 | Nov 28, 2024 |
#688 in Procedural macros
1,054 downloads per month
170KB
4.5K
SLoC
A few rules:
- The variables are only valid till the function execution.
- Storage of LeadLang variable data (except the moved ones) requires cloning.
- You shouldn't store the mutable or immutable reference of a variable.
Got to define function
Simple LeadLang Package
use interpreter::{generate, module, pkg_name};
use lead_lang_macros::{define, methods};
use interpreter::BufValue;
module! {
Module1,
pkg_name! { "Module" },
methods! {
foo
}
}
generate! {
Module1
}
#[define((
desc: "Prints a variable",
notes: Some("Optional Note"),
params: [
// "my-custom-regex, see example below",
r"\$[a-z0-9_]*" // This is a regex of a lead variable
],
returns: Some("%null"), // %null means that it returns nothing
usage: [
(
desc: "Prints $hello",
code: "print $hello"
)
]
root: Some("MyNewRT"), // This is a method on a RuntimeValue
))]
fn foo(var: &BufValue) {
println!("{}", var.display());
}
Dependencies
~5–27MB
~376K SLoC