[−][src]Struct passerine::compiler::rule::Rule
Fields
arg_pat: Spanned<ArgPat>
tree: Spanned<AST>
Implementations
impl Rule
[src]
pub fn new(arg_pat: Spanned<ArgPat>, tree: Spanned<AST>) -> Result<Rule, Syntax>
[src]
Builds a new rule, making sure the rule's signature is valid.
pub fn keywords(arg_pat: &Spanned<ArgPat>) -> Vec<String>
[src]
Returns all keywords, as strings, used by the macro, in order of usage. Does not filter for duplicates.
pub fn merge_safe(
base: &mut HashMap<String, Spanned<AST>>,
new: HashMap<String, Spanned<AST>>,
def: Span
) -> Result<(), Syntax>
[src]
base: &mut HashMap<String, Spanned<AST>>,
new: HashMap<String, Spanned<AST>>,
def: Span
) -> Result<(), Syntax>
Merges two maps of bindings. If there is a collision, i.e. a name bound in both bindings, An error highlighting the duplicate binding is returned.
pub fn bind(
arg_pat: &Spanned<ArgPat>,
reversed_form: &mut Vec<Spanned<AST>>
) -> Option<Result<HashMap<String, Spanned<AST>>, Syntax>>
[src]
arg_pat: &Spanned<ArgPat>,
reversed_form: &mut Vec<Spanned<AST>>
) -> Option<Result<HashMap<String, Spanned<AST>>, Syntax>>
Traverses a form, creating bindings for subsequent transformation.
Returns None
if the form does not match the argument pattern.
Some(Ok(_))
if it matches successfully,
and Some(Err(_))
if it matches but something is incorrect.
You must check that the passed &mut reversed_form
is empty
to gaurantee the match occured in full
Note that this function takes the form unwrapped and in reverse -
This is to make processing the bindings more efficient,
As this function works with the head of the form.
pub fn unique_identifier(
base: String,
bindings: &HashMap<String, Spanned<AST>>
) -> String
[src]
base: String,
bindings: &HashMap<String, Spanned<AST>>
) -> String
Turns a base identifier into a random identifier
of the format #_<base>_XXXXXXXX
,
Gauranteed not to exist in bindings.
pub fn resolve_symbol(
name: String,
span: Span,
bindings: &mut HashMap<String, Spanned<AST>>
) -> Spanned<AST>
[src]
name: String,
span: Span,
bindings: &mut HashMap<String, Spanned<AST>>
) -> Spanned<AST>
pub fn expand_pattern(
pattern: Spanned<ASTPattern>,
bindings: &mut HashMap<String, Spanned<AST>>
) -> Result<Spanned<ASTPattern>, Syntax>
[src]
pattern: Spanned<ASTPattern>,
bindings: &mut HashMap<String, Spanned<AST>>
) -> Result<Spanned<ASTPattern>, Syntax>
pub fn expand_arg_pat(
_arg_pat: Spanned<ArgPat>,
_bindings: &mut HashMap<String, Spanned<AST>>
) -> Result<Spanned<ArgPat>, Syntax>
[src]
_arg_pat: Spanned<ArgPat>,
_bindings: &mut HashMap<String, Spanned<AST>>
) -> Result<Spanned<ArgPat>, Syntax>
pub fn expand(
tree: Spanned<AST>,
bindings: &mut HashMap<String, Spanned<AST>>
) -> Result<Spanned<AST>, Syntax>
[src]
tree: Spanned<AST>,
bindings: &mut HashMap<String, Spanned<AST>>
) -> Result<Spanned<AST>, Syntax>
Takes a macro's tree and a set of bindings and produces a new hygenic tree.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Rule
impl !Send for Rule
impl !Sync for Rule
impl Unpin for Rule
impl !UnwindSafe for Rule
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,