summary refs log tree commit diff
path: root/src/libsyntax_ext/format.rs
AgeCommit message (Collapse)AuthorLines
2016-07-29syntax_ext: format: fix ICE with bad named argumentsWang Xuerui-1/+3
2016-07-14syntax_ext: format: better code documentationWang Xuerui-12/+46
2016-07-14syntax_ext: format: de-duplicate argument objectsWang Xuerui-12/+31
2016-07-14syntax_ext: format: process counts uniquely and separatelyWang Xuerui-11/+62
2016-07-14syntax_ext: format: allow multiple formats for one argumentWang Xuerui-69/+57
This commit removed the restriction of only allowing one type per argument. This is achieved by adding mappings between macro arguments and format placeholders, then taking the mapping into consideration when emitting the Arguments expression. syntax_ext: format: fix implicit positional arguments syntax_ext: format: don't panic if no args given for implicit positional args Check the list lengths before use. Fixes regression of `compile-fail/macro-backtrace-println.rs`. syntax_ext: format: also map CountIsParam indices to expanded args syntax_ext: format: fix ICE in case of malformed format args
2016-07-14syntax_ext: format: rename variants of ArgumentType for clarityWang Xuerui-7/+7
2016-07-14syntax_ext: format: resolve named arguments earlyWang Xuerui-85/+62
Converts named argument references into indices, right after verification as suggested by @alexcrichton. This drastically simplifies the whole process!
2016-07-14syntax_ext: format: separate verification and translation of piecesWang Xuerui-5/+11
2016-07-14format: remove all implicit ref handling outside of libfmt_macrosWang Xuerui-17/+12
format: beautifully get rid of ArgumentNext and CountIsNextParam Now that CountIsNextParam and ArgumentNext are resolved during parse, the need for handling them outside of libfmt_macros is obviated. Note: *one* instance of implicit reference handling still remains, and that's for implementing `all_args_simple`. It's trivial enough though, so in this case it may be tolerable.
2016-07-03prefer `if let` to match with `None => {}` arm in some placesZack M. Davis-17/+11
This is a spiritual succesor to #34268/8531d581, in which we replaced a number of matches of None to the unit value with `if let` conditionals where it was judged that this made for clearer/simpler code (as would be recommended by Manishearth/rust-clippy's `single_match` lint). The same rationale applies to matches of None to the empty block.
2016-06-26Rollup merge of #34436 - jseyfried:no_block_expr, r=eddybJeffrey Seyfried-1/+1
To allow these braced macro invocation, this PR removes the optional expression from `ast::Block` and instead uses a `StmtKind::Expr` at the end of the statement list. Currently, braced macro invocations in blocks can expand into statements (and items) except when they are last in a block, in which case they can only expand into expressions. For example, ```rust macro_rules! make_stmt { () => { let x = 0; } } fn f() { make_stmt! {} //< This is OK... let x = 0; //< ... unless this line is commented out. } ``` Fixes #34418.
2016-06-26Rollup merge of #34316 - jseyfried:refactor_ast_stmt, r=eddybJeffrey Seyfried-5/+6
Refactor away `ast::Decl`, refactor `ast::Stmt`, and rename `ast::ExprKind::Again` to `ast::ExprKind::Continue`.
2016-06-26Rollup merge of #34385 - cgswords:tstream, r=nrcJeffrey Seyfried-2/+3
syntax-[breaking-change] cc #31645 (Only breaking because ast::TokenTree is now tokenstream::TokenTree.) This pull request refactors TokenTrees into their own file as src/libsyntax/tokenstream.rs, moving them out of src/libsyntax/ast.rs, in order to prepare for an accompanying TokenStream implementation (per RFC 1566).
2016-06-23Remove field `expr` of `ast::Block`Jeffrey Seyfried-3/+4
2016-06-23Move errors from libsyntax to its own crateJonathan Turner-1/+2
2016-06-21Refactored tokentrees into their own files in preparation for tokenstreams. ↵cgswords-2/+3
Modified tests to point to the new file now.
2016-06-17Fix falloutJeffrey Seyfried-5/+7
2016-05-16syntax_ext: format: remove reference to methods in commentWang Xuerui-1/+1
2016-05-16syntax_ext: format: nest_level's are no moreWang Xuerui-20/+4
`nest_level` is long dead since cac7a2053aba7be214d5e58e13867089638a8f50 (PR #14831), so is `check_positional_ok()`. Let's bid them farewell.
2016-04-24syntax: Merge keywords and remaining special idents in one listVadim Petrochenkov-4/+3
Simplify the macro used for generation of keywords Make `Keyword::ident` private
2016-04-24syntax: Make static/super/self/Self keywords + special ident cleanupVadim Petrochenkov-2/+2
2016-04-24syntax: Get rid of token::IdentStyleVadim Petrochenkov-1/+1
2016-02-11Remove some unnecessary indirection from AST structuresVadim Petrochenkov-1/+1
2016-02-11[breaking-change] don't glob export ast::Mutablity variantsOliver 'ker' Schneider-3/+3
2016-02-11[breaking-change] don't glob export ast::Item_ variantsOliver 'ker' Schneider-1/+1
2016-02-11[breaking-change] don't pub export ast::Stmt_ variantsOliver Schneider-1/+1
2016-02-11[breaking-change] don't pub export ast::Lit_ variantsOliver Schneider-1/+1
2016-02-11[breaking-change] don't pub export ast::Ty_ variantsOliver Schneider-1/+1
2016-02-11[breaking-change] don't glob export ast::Expr_ variantsOliver Schneider-1/+1
2016-02-11[breaking-change] don't glob export ast::Decl_ variantsOliver Schneider-1/+1
2016-01-22Extended save-analysis to support generated code, alterned some spans in ↵Daniel Campbell-3/+3
format_args! and derive to maintain compatability
2015-12-31Cut out a bunch of Result and panictry! boilerplate from libsyntax.Nick Cameron-2/+2
[breaking-change] if you use any of the changed functions, you'll need to remove a try! or panictry!
2015-12-30use structured errorsNick Cameron-4/+5
2015-12-15Move built-in syntax extensions to a separate crateSeo Sanghyeon-0/+716