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]
pub fn validate_symbols(&self) -> Result<(), HashSet<String>>[src]
Performs typechecking of a ucg macro's arguments to ensure that they are valid for the expressions in the macro.
impl MacroDef[src]
pub fn eval(
&self,
args: Vec<Rc<Val>>
) -> Result<Vec<(Positioned<String>, Rc<Val>)>, Box<Error>>[src]
&self,
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]
fn eq(&self, __arg_0: &MacroDef) -> bool[src]
This method tests for self and other values to be equal, and is used by ==. Read more
fn ne(&self, __arg_0: &MacroDef) -> bool[src]
This method tests for !=.
impl Debug for MacroDef[src]
fn fmt(&self, __arg_0: &mut Formatter) -> Result[src]
Formats the value using the given formatter. Read more