Module syntex_syntax::ext::mtwt [] [src]

Machinery for hygienic macros, as described in the MTWT[1] paper.

[1] Matthew Flatt, Ryan Culpepper, David Darais, and Robert Bruce Findler. 2012. Macros that work together: Compile-time bindings, partial expansion, and definition contexts. J. Funct. Program. 22, 2 (March 2012), 181-216. DOI=10.1017/S0956796812000093 http://dx.doi.org/10.1017/S0956796812000093

Reexports

pub use self::SyntaxContext_::*;

Structs

SCTable

The SCTable contains a table of SyntaxContext_'s. It represents a flattened tree structure, to avoid having managed pointers everywhere (that caused an ICE). the mark_memo and rename_memo fields are side-tables that ensure that adding the same mark to the same context gives you back the same context as before. This shouldn't change the semantics--everything here is immutable--but it should cut down on memory use a lot; applying a mark to a tree containing 50 identifiers would otherwise generate 50 new contexts

Enums

SyntaxContext_

Functions

apply_mark

Extend a syntax context with a given mark

apply_rename

Extend a syntax context with a given rename

apply_renames

Apply a list of renamings to a context

clear_tables

Clear the tables from TLD to reclaim memory.

display_sctable

Print out an SCTable for debugging

marksof

Compute the marks associated with a syntax context.

outer_mark

Return the outer mark for a context with a mark at the outside. FAILS when outside is not a mark.

reset_tables

Reset the tables to their initial state

resolve

Resolve a syntax object to a name, per MTWT.

with_sctable

Fetch the SCTable from TLS, create one if it doesn't yet exist.

Type Definitions

RenameList

A list of ident->name renamings