about summary refs log tree commit diff
path: root/src/libsyntax/ext/format.rs
AgeCommit message (Collapse)AuthorLines
2013-11-08Generalize AST and ty::Generics to accept multiple lifetimes.Niko Matsakis-3/+4
2013-10-31Implement a concat!() format extensionAlex Crichton-2/+4
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-15Build a few extra features into format! parsingAlex Crichton-4/+17
* Allow named parameters to specify width/precision * Intepret the format string '0$' as "width is the 0th argument" instead of thinking the lone '0' was the sign-aware-zero-padding flag. To get both you'd need to put '00$' which makes more sense if you want both to happen. Closes #9669
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-01Migrate users of 'loop' to 'continue'Alex Crichton-3/+3
Closes #9467
2013-10-01Change the format! statics to be all-capsAlex Crichton-12/+16
This lets them get past the non_uppercase_statics lint mode (if it's turned on) Closes #9631
2013-09-30syntax: Remove usage of fmt!Alex Crichton-29/+29
2013-09-27Remove the notion of an "unknown format"Alex Crichton-11/+8
As mentioned in #9456, the format! syntax extension would previously consider an empty format as a 'Unknown' format which could then also get coerced into a different style of format on another argument. This is unusual behavior because `{}` is a very common format and if you have `{0} {0:?}` you wouldn't expect them both to be coereced to the `Poly` formatter. This commit removes this coercion, but still retains the requirement that each argument has exactly one format specified for it (an empty format now counts as well). Perhaps at a later date we can add support for multiple formats of one argument, but this puts us in at least a backwards-compatible situation if we decide to do that.
2013-09-20Implement a web backend for rustdoc_ngAlex Crichton-1/+1
This large commit implements and `html` output option for rustdoc_ng. The executable has been altered to be invoked as "rustdoc_ng html <crate>" and it will dump everything into the local "doc" directory. JSON can still be generated by changing 'html' to 'json'. This also fixes a number of bugs in rustdoc_ng relating to comment stripping, along with some other various issues that I found along the way. The `make doc` command has been altered to generate the new documentation into the `doc/ng/$(CRATE)` directories.
2013-09-18Allow trailing commas in format!Alex Crichton-0/+1
This is more consistent with other parts of the language and it also makes it easier to use in situations where format string is massive.
2013-09-15Reduce the amount of complexity in format!Alex Crichton-0/+756
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!