Struct ucglib::ast::MacroDef [−][src]
pub struct MacroDef { pub argdefs: Vec<Positioned<String>>, pub fields: FieldList, pub pos: Position, }
Encodes a macro expression in the UCG AST..
A macro is a pure function over a tuple. MacroDefs are not closures. They can not reference any values except what is defined in their arguments.
Fields
argdefs: Vec<Positioned<String>>
fields: FieldList
pos: Position
Methods
impl MacroDef
[src]
impl MacroDef
pub fn validate_symbols(&self) -> Result<(), HashSet<String>>
[src]
pub fn validate_symbols(&self) -> Result<(), HashSet<String>>
Performs typechecking of a ucg macro's arguments to ensure that they are valid for the expressions in the macro.
impl MacroDef
[src]
impl MacroDef
pub fn eval(
&self,
root: PathBuf,
env: Rc<Val>,
args: Vec<Rc<Val>>
) -> Result<Vec<(Positioned<String>, Rc<Val>)>, Box<Error>>
[src]
pub fn eval(
&self,
root: PathBuf,
env: Rc<Val>,
args: Vec<Rc<Val>>
) -> Result<Vec<(Positioned<String>, Rc<Val>)>, Box<Error>>
Expands a ucg Macro using the given arguments into a new Tuple.
Trait Implementations
impl PartialEq for MacroDef
[src]
impl PartialEq for MacroDef
fn eq(&self, other: &MacroDef) -> bool
[src]
fn eq(&self, other: &MacroDef) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &MacroDef) -> bool
[src]
fn ne(&self, other: &MacroDef) -> bool
This method tests for !=
.
impl Debug for MacroDef
[src]
impl Debug for MacroDef
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Clone for MacroDef
[src]
impl Clone for MacroDef