about summary refs log tree commit diff
path: root/src/libsyntax/ext/tt/macro_rules.rs
AgeCommit message (Collapse)AuthorLines
2014-11-05Remove `Matcher`sPiotr Czarnecki-3/+7
2014-11-05Use `TokenTree`s in lhs of macrosPiotr Czarnecki-19/+26
2014-10-30Use common variants for open and close delimitersBrendan Zabarauskas-4/+1
This common representation for delimeters should make pattern matching easier. Having a separate `token::DelimToken` enum also allows us to enforce the invariant that the opening and closing delimiters must be the same in `ast::TtDelimited`, removing the need to ensure matched delimiters when working with token trees.
2014-10-29Rename fail! to panic!Steve Klabnik-1/+1
https://github.com/rust-lang/rfcs/pull/221 The current terminology of "task failure" often causes problems when writing or speaking about code. You often want to talk about the possibility of an operation that returns a Result "failing", but cannot because of the ambiguity with task failure. Instead, you have to speak of "the failing case" or "when the operation does not succeed" or other circumlocutions. Likewise, we use a "Failure" header in rustdoc to describe when operations may fail the task, but it would often be helpful to separate out a section describing the "Err-producing" case. We have been steadily moving away from task failure and toward Result as an error-handling mechanism, so we should optimize our terminology accordingly: Result-producing functions should be easy to describe. To update your code, rename any call to `fail!` to `panic!` instead. Assuming you have not created your own macro named `panic!`, this will work on UNIX based systems: grep -lZR 'fail!' . | xargs -0 -l sed -i -e 's/fail!/panic!/g' You can of course also do this by hand. [breaking-change]
2014-10-28Use PascalCase for token variantsBrendan Zabarauskas-8/+9
2014-10-26Add a KleeneOp enum for clarityBrendan Zabarauskas-2/+3
2014-10-26Reduce the size of the TokenTreeBrendan Zabarauskas-1/+4
2014-10-26Use standard capitalisation for TokenTree variantsBrendan Zabarauskas-2/+2
2014-10-26Rename TokenTree variants for clarityBrendan Zabarauskas-2/+2
This should be clearer, and fits in better with the `TTNonterminal` variant. Renames: - `TTTok` -> `TTToken` - `TTDelim` -> `TTDelimited` - `TTSeq` -> `TTSequence`
2014-10-26Add Span and separate open/close delims to TTDelimBrendan Zabarauskas-15/+5
This came up when working [on the gl-rs generator extension](https://github.com/bjz/gl-rs/blob/990383de801bd2e233159d5be07c9b5622827620/src/gl_generator/lib.rs#L135-L146). The new definition of `TTDelim` adds an associated `Span` that covers the whole token tree and enforces the invariant that a delimited sequence of token trees must have an opening and closing delimiter. A `get_span` method has also been added to `TokenTree` type to make it easier to implement better error messages for syntax extensions.
2014-10-19Remove a large amount of deprecated functionalityAlex Crichton-2/+2
Spring cleaning is here! In the Fall! This commit removes quite a large amount of deprecated functionality from the standard libraries. I tried to ensure that only old deprecated functionality was removed. This is removing lots and lots of deprecated features, so this is a breaking change. Please consult the deprecation messages of the deleted code to see how to migrate code forward if it still needs migration. [breaking-change]
2014-09-17librustc: Implement associated types behind a feature gate.Patrick Walton-1/+4
The implementation essentially desugars during type collection and AST type conversion time into the parameter scheme we have now. Only fully qualified names--e.g. `<T as Foo>::Bar`--are supported.
2014-09-14syntax: fix fallout from using ptr::P.Eduard Burtescu-15/+15
2014-08-27Implement generalized object and type parameter bounds (Fixes #16462)Niko Matsakis-20/+19
2014-07-13add make_method method to MacResult traitJohn Clements-1/+18
this allows macro results to be parsed as methods
2014-07-11rename one of the two confusing MacroExpandersJohn Clements-2/+2
There were two things named MacroExpander, which was confusing. I renamed one of them TTMacroExpander. [breaking change]
2014-07-09syntax: doc comments all the thingsCorey Richardson-4/+4
2014-07-08std: Rename the `ToStr` trait to `ToString`, and `to_str` to `to_string`.Richo Healey-3/+3
[breaking-change]
2014-06-13syntax: parse outer attributes in `quote_item!` calls.Huon Wilson-2/+1
Fixes #14857.
2014-06-11std: Remove i18n/l10n from format!Alex Crichton-2/+4
* The select/plural methods from format strings are removed * The # character no longer needs to be escaped * The \-based escapes have been removed * '{{' is now an escape for '{' * '}}' is now an escape for '}' Closes #14810 [breaking-change]
2014-06-11syntax: Move the AST from @T to Gc<T>Alex Crichton-4/+5
2014-06-06Change to_str().to_string() to just to_str()Adolfo OchagavĂ­a-1/+1
2014-05-30libsyntax: Fix snake_case errors.Kevin Butler-1/+1
A number of functions/methods have been moved or renamed to align better with rust standard conventions. syntax::ext::mtwt::xorPush => xor_push syntax::parse::parser::Parser => Parser::new [breaking-change]
2014-05-28Add patterns to MacResultKeegan McAllister-0/+5
2014-05-27std: Rename strbuf operations to stringRicho Healey-2/+2
[breaking-change]
2014-05-22libstd: Remove `~str` from all `libstd` modules except `fmt` and `str`.Patrick Walton-1/+1
2014-05-08libsyntax: Remove uses of `~str` from libsyntax, and fix falloutPatrick Walton-4/+4
2014-05-06librustc: Remove `~EXPR`, `~TYPE`, and `~PAT` from the language, exceptPatrick Walton-5/+5
for `~str`/`~[]`. Note that `~self` still remains, since I forgot to add support for `Box<self>` before the snapshot. How to update your code: * Instead of `~EXPR`, you should write `box EXPR`. * Instead of `~TYPE`, you should write `Box<Type>`. * Instead of `~PATTERN`, you should write `box PATTERN`. [breaking-change]
2014-05-02Replace most ~exprs with 'box'. #11779Brian Anderson-4/+4
2014-04-18Replace all ~"" with "".to_owned()Richo Healey-1/+1
2014-04-16syntax: unify all MacResult's into a single trait.Huon Wilson-17/+28
There's now one unified way to return things from a macro, instead of being able to choose the `AnyMacro` trait or the `MRItem`/`MRExpr` variants of the `MacResult` enum. This does simplify the logic handling the expansions, but the biggest value of this is it makes macros in (for example) type position easier to implement, as there's this single thing to modify. By my measurements (using `-Z time-passes` on libstd and librustc etc.), this appears to have little-to-no impact on expansion speed. There are presumably larger costs than the small number of extra allocations and virtual calls this adds (notably, all `macro_rules!`-defined macros have not changed in behaviour, since they had to use the `AnyMacro` trait anyway).
2014-03-28De-@ NamedMatch.Eduard Burtescu-6/+6
2014-03-28De-@ TokenTree.Eduard Burtescu-3/+4
2014-03-22syntax: Fix fallout of removing get()Alex Crichton-18/+12
2014-03-20Removing imports of std::vec_ng::VecAlex Crichton-1/+0
It's now in the prelude.
2014-03-20rename std::vec_ng -> std::vecDaniel Micay-1/+1
Closes #12771
2014-03-17De-@ codemap and diagnostic.Eduard Burtescu-5/+4
2014-03-17De-@ ParseSess uses.Eduard Burtescu-4/+4
2014-03-01libsyntax: Fix errors arising from the automated `~[T]` conversionPatrick Walton-6/+22
2014-03-01libsyntax: Mechanically change `~[T]` to `Vec<T>`Patrick Walton-8/+7
2014-02-14Refactored ast_map and friends, mainly to have Paths without storing them.Eduard Burtescu-6/+4
2014-02-07Removed @self and @Trait.Eduard Burtescu-7/+7
2014-02-02libsyntax: De-`@str` `MacroDef`Patrick Walton-2/+2
2014-02-02librustc: Fix merge fallout.Patrick Walton-3/+5
2014-01-25Simplify and rename macro APISteven Fackler-8/+6
Now that procedural macros can be implemented outside of the compiler, it's more important to have a reasonable API to work with. Here are the basic changes: * Rename SyntaxExpanderTTTrait to MacroExpander, SyntaxExpanderTT to BasicMacroExpander, etc. I think "procedural macro" is the right term for these now, right? The other option would be SynExtExpander or something like that. * Stop passing the SyntaxContext to extensions. This was only ever used by macro_rules, which doesn't even use it anymore. I can't think of a context in which an external extension would need it, and removal allows the API to be significantly simpler - no more SyntaxExpanderTTItemExpanderWithoutContext wrappers to worry about.
2014-01-21Remove unnecessary parentheses.Huon Wilson-1/+1
2014-01-13librustc: Remove `@` pointer patterns from the languagePatrick Walton-8/+8
2014-01-09libsyntax: Renamed types, traits and enum variants to CamelCase.Eduard Burtescu-37/+36
2014-01-05Use ~-objects instead of @-objects for syntax extsSteven Fackler-2/+2
This is necessary for #11151 to make sure dtors run before the libraries are unloaded.
2014-01-03libsyntax: De-`@mut` `StringReader`, `TtReader`, and `reader`Patrick Walton-10/+3