summary refs log tree commit diff
path: root/src/libsyntax/ext/base.rs
AgeCommit message (Collapse)AuthorLines
2014-01-05Use ~-objects instead of @-objects for syntax extsSteven Fackler-6/+6
This is necessary for #11151 to make sure dtors run before the libraries are unloaded.
2014-01-03librustc: De-`@mut` the parse sessionPatrick Walton-3/+3
2014-01-03auto merge of #11228 : sfackler/rust/syntaxenv, r=pcwaltonbors-178/+88
I'd really like to be able to do something like ```rust struct MapChain<'next, K, V> { info: BlockInfo, map: HashMap<K, V>, next: Option<&'next mut MapChain<'next, K, V> } ``` but I can't get the lifetimes to work out.
2014-01-02libsyntax: De-`@mut` `token` in the parserPatrick Walton-1/+1
2014-01-02libsyntax: Make the parser mutablePatrick Walton-3/+3
2014-01-01syntax::diagnostic: Remove unnecessary traitsklutzy-1/+0
This removes trait `handler` and `span_handler`, and renames `HandlerT` to `Handler`, `CodemapT` to `SpanHandler`.
2013-12-30Rewrite SyntaxEnvSteven Fackler-178/+88
I'd really like to be able to do something like struct MapChain<'next, K, V> { info: BlockInfo, map: HashMap<K, V>, next: Option<&'next mut MapChain<'next, K, V> } but I can't get the lifetimes to work out.
2013-12-29Remove @muts from ExtCtxtSteven Fackler-20/+20
2013-12-29Start passing around &mut ExtCtxtSteven Fackler-8/+8
2013-12-29Make ast_fold take &mut selfSteven Fackler-2/+2
2013-12-28Stop passing duplicate parameters in expandSteven Fackler-3/+2
2013-12-28Remove unecessary extern "Rust" specifiersSteven Fackler-17/+8
2013-12-28Stop using @ExtCtxtSteven Fackler-15/+15
2013-12-11Make 'self lifetime illegal.Erik Price-1/+1
Also remove all instances of 'self within the codebase. This fixes #10889.
2013-12-08Remove dead codesKiet Tran-9/+1
2013-11-28Register new snapshotsAlex Crichton-3/+3
2013-11-26Support multiple item macrosSteven Fackler-1/+2
Closes #4375
2013-11-26rustc: Add lint for obsolete attributesklutzy-7/+1
This also moves `#[auto_{en,de}code]` checker from syntax to lint.
2013-11-19libsyntax: Change all uses of `&fn` to `||`.Patrick Walton-8/+15
2013-10-31Implement a concat!() format extensionAlex Crichton-0/+20
This extension can be used to concatenate string literals at compile time. C has this useful ability when placing string literals lexically next to one another, but this needs to be handled at the syntax extension level to recursively expand macros. The major use case for this is something like: macro_rules! mylog( ($fmt:expr $($arg:tt)*) => { error2!(concat!(file!(), ":", line!(), " - ", $fmt) $($arg)*); }) Where the mylog macro will automatically prepend the filename/line number to the beginning of every log message.
2013-10-22Drop the '2' suffix from logging macrosAlex Crichton-3/+3
Who doesn't like a massive renaming?
2013-10-18Remove the fmt! syntax extensionAlex Crichton-1/+1
It lived a good life, but its time has come. The groundwork is set for the official transition after the next snapshot (removal of XXX2 macros)
2013-10-09option: rewrite the API to use compositionDaniel Micay-1/+1
2013-10-08add new enum ast::StrStyle as field to ast::lit_strBenjamin Herr-2/+2
For the benefit of the pretty printer we want to keep track of how string literals in the ast were originally represented in the source code. This commit changes parser functions so they don't extract strings from the token stream without at least also returning what style of string literal it was. This is stored in the resulting ast node for string literals, obviously, for the package id in `extern mod = r"package id"` view items, for the inline asm in `asm!()` invocations. For `asm!()`'s other arguments or for `extern "Rust" fn()` items, I just the style of string, because it seemed disproportionally cumbersome to thread that information through the string processing that happens with those string literals, given the limited advantage raw string literals would provide in these positions. The other syntax extensions don't seem to store passed string literals in the ast, so they also discard the style of strings they parse.
2013-10-08add token::LIT_STR_RAW(ident, num of # symbols)Benjamin Herr-1/+2
Treat it as a synonym for LIT_STR for now.
2013-09-30syntax: Remove usage of fmt!Alex Crichton-6/+6
2013-09-30Prevent leakage of fmt! into the compilerAlex Crichton-1/+1
We're not outright removing fmt! just yet, but this prevents it from leaking into the compiler further (it's still turned on by default for all other code).
2013-09-23test: Fix rustdoc and tests.Patrick Walton-1/+2
2013-09-23libsyntax: Remove some more `@fn`s from the macro expanderPatrick Walton-79/+159
2013-09-15Reduce the amount of complexity in format!Alex Crichton-7/+1
This renames the syntax-extension file to format from ifmt, and it also reduces the amount of complexity inside by defining all other macros in terms of format_args!
2013-09-12Implement a format_args!() macroAlex Crichton-0/+2
The purpose of this macro is to further reduce the number of allocations which occur when dealing with formatting strings. This macro will perform all of the static analysis necessary to validate that a format string is safe, and then it will wrap up the "format string" into an opaque struct which can then be passed around. Two safe functions are added (write/format) which take this opaque argument structure, unwrap it, and then call the unsafe version of write/format (in an unsafe block). Other than these two functions, it is not intended for anyone to ever look inside this opaque struct. The macro looks a bit odd, but mostly because of rvalue lifetimes this is the only way for it to be safe that I know of. Example use-cases of this are: * third-party libraries can use the default formatting syntax without any forced allocations * the fail!() macro can avoid allocating the format string * the logging macros can avoid allocation any strings
2013-09-10Delay assignment of node ids until after expansion. Ensures that each AST nodeNiko Matsakis-3/+0
has a unique id. Fixes numerous bugs in macro expansion and deriving. Add two representative tests. Fixes #7971 Fixes #6304 Fixes #8367 Fixes #8754 Fixes #8852 Fixes #2543 Fixes #7654
2013-09-06quote_* macros no longer need to be capturingJohn Clements-6/+7
This is actually almost a problem, because those were my poster-child macros for "here's how to implement a capturing macro." Following this change, there will be no macros that use capturing; this will probably make life unpleasant for the first person that wants to implement a capturing macro. I should probably create a dummy_capturing macro, just to show how it works.
2013-09-06WIP: adding mark-cancelling for macro_rulesJohn Clements-2/+1
2013-09-06remove unneeded imports, clean up unused var warningsJohn Clements-2/+2
2013-09-06capturing macros now implementedJohn Clements-32/+60
2013-09-06separate ItemDecorator from ItemDecoratorJohn Clements-2/+2
2013-09-06removed unneccessary SyntaxExpander structsJohn Clements-16/+5
2013-09-03Modernized a few more types in syntax::astMarvin Löbel-6/+6
2013-09-02Renamed syntax::ast::ident -> IdentMarvin Löbel-7/+7
2013-09-01Modernized a few type names in rustc and syntaxMarvin Löbel-17/+17
2013-08-27librustc: Add support for type parameters in the middle of paths.Patrick Walton-17/+3
For example, `foo::<T>::bar::<U>`. This doesn't enforce that the type parameters are in the right positions, however.
2013-08-24Settle on the format/write/print family of namesAlex Crichton-4/+6
2013-08-24Implement a wrapper macro around fprintf -- ifmtfAlex Crichton-1/+3
2013-08-10Merge branch 'enum-method-privacy' of ↵Erick Tryzelaar-10/+10
https://github.com/michaelwoerister/rust into rollup Conflicts: src/libsyntax/opt_vec.rs
2013-08-09auto merge of #8362 : sfackler/rust/env, r=alexcrichtonbors-6/+8
env! aborts compilation of the specified environment variable is not defined and takes an optional second argument containing a custom error message. option_env! creates an Option<&'static str> containing the value of the environment variable. There are no run-pass tests that check the behavior when the environment variable is defined since the test framework doesn't support setting environment variables at compile time as opposed to runtime. However, both env! and option_env! are used inside of rustc itself, which should act as a sufficient test. Fixes #2248.
2013-08-08env! syntax extension changesSteven Fackler-6/+8
env! aborts compilation of the specified environment variable is not defined and takes an optional second argument containing a custom error message. option_env! creates an Option<&'static str> containing the value of the environment variable. There are no run-pass tests that check the behavior when the environment variable is defined since the test framework doesn't support setting environment variables at compile time as opposed to runtime. However, both env! and option_env! are used inside of rustc itself, which should act as a sufficient test. Close #2248
2013-08-08auto merge of #8245 : alexcrichton/rust/fmt2, r=graydonbors-0/+2
This is a reopening of #8182, although this removes any abuse of the compiler internals. Now it's just a pure syntax extension (hard coded what the attribute names are).
2013-08-07Add initial support for a new formatting syntaxAlex Crichton-0/+2
The new macro is available under the name ifmt! (only an intermediate name)
2013-08-07core: option.map_consume -> option.map_moveErick Tryzelaar-1/+1