summary refs log tree commit diff
path: root/src/libsyntax/ext/quote.rs
AgeCommit message (Collapse)AuthorLines
2014-09-29Fixed quote_method!() implementationVladimir Pouzanov-2/+6
Parser.parse_method now has a second argument, I assume ast::Inherited is the correct visibility in this case.
2014-09-16Fallout from renamingAaron Turon-1/+1
2014-09-14syntax: fix fallout from using ptr::P.Eduard Burtescu-39/+37
2014-09-08quote: Explicitly borrow the ExtCtxtKeegan McAllister-1/+3
Fixes #16992.
2014-08-27Implement generalized object and type parameter bounds (Fixes #16462)Niko Matsakis-19/+20
2014-08-13quote_expr macro: embed Ident using special encoding that preserves hygiene.Felix S. Klock II-3/+96
This adds support to `quote_expr!` and friends for round-trip hygienic preservation of Ident. Here are the pieces of the puzzle: * adding a method for encoding Ident for re-reading into token tree. * Support for reading such encoded Idents in the lexer. Note that one must peek ahead for MOD_SEP after scan_embedded_hygienic_ident. * To ensure that encoded Idents are only read when we are in the midst of expanding a `quote_expr` or similar, added a `read_embedded_ident` flag on `StringReader`. * pprust support for encoding Ident's as (uint,uint) pairs (for hygiene).
2014-08-05Fixes missing overflow lint for i64 #14269Falco Hirschenberger-4/+5
The `type_overflow` lint, doesn't catch the overflow for `i64` because the overflow happens earlier in the parse phase when the `u64` as biggest possible int gets casted to `i64` , without checking the for overflows. We can't lint in the parse phase, so a refactoring of the `LitInt` type was necessary. The types `LitInt`, `LitUint` and `LitIntUnsuffixed` where merged to one type `LitInt` which stores it's value as `u64`. An additional parameter was added which indicate the signedness of the type and the sign of the value.
2014-07-29syntax: add support for quoting armsErick Tryzelaar-0/+8
2014-07-29Fix a bug pretty printing `match { 5i } { _ => { } }`Erick Tryzelaar-0/+2
This also always puts a trailing comma on the last non-block expr.
2014-07-29syntax: allow quasiquoter to inline `Vec<Stmt>`sErick Tryzelaar-0/+2
2014-07-17syntax: Add ToTokens impl for MethodBen Gamari-0/+2
2014-07-17syntax: Add quote_method!Ben Gamari-0/+10
2014-07-16syntax: Generalize ToTokens impl for Vec<T>Ben Gamari-3/+4
It will now `flat_map` over the elements of a `Vec<T>` if `T: ToTokens`
2014-07-16syntax: Add ToTokens for Attribute_Ben Gamari-0/+7
2014-07-16syntax: Add ToTokens for Option<T>Ben Gamari-0/+9
2014-07-09ast: make Name its own typeCorey Richardson-7/+16
2014-07-09syntax: don't parse numeric literals in the lexerCorey Richardson-36/+5
This removes a bunch of token types. Tokens now store the original, unaltered numeric literal (that is still checked for correctness), which is parsed into an actual number later, as needed, when creating the AST. This can change how syntax extensions work, but otherwise poses no visible changes. [breaking-change]
2014-07-09syntax: don't process string/char/byte/binary litsCorey Richardson-2/+2
This shuffles things around a bit so that LIT_CHAR and co store an Ident which is the original, unaltered literal in the source. When creating the AST, unescape and postprocess them. This changes how syntax extensions can work, slightly, but otherwise poses no visible changes. To get a useful value out of one of these tokens, call `parse::{char_lit, byte_lit, bin_lit, str_lit}` [breaking-change]
2014-07-08std: Rename the `ToStr` trait to `ToString`, and `to_str` to `to_string`.Richo Healey-12/+12
[breaking-change]
2014-07-03Simplify creating a parser from a token treePiotr Jawniak-6/+1
Closes #15306
2014-06-25auto merge of #15160 : alexcrichton/rust/remove-f128, r=brsonbors-1/+0
The f128 type has very little support in the compiler and the feature is basically unusable today. Supporting half-baked features in the compiler can be detrimental to the long-term development of the compiler, and hence this feature is being removed.
2014-06-24Allow splicing more things in quotesKeegan McAllister-0/+16
2014-06-24Use macros to implement syntax::ext::quote::ToSourceKeegan McAllister-125/+74
This code deserves a bigger refactor, but here's a local improvement.
2014-06-24Remove the quad_precision_float feature gateAlex Crichton-1/+0
The f128 type has very little support in the compiler and the feature is basically unusable today. Supporting half-baked features in the compiler can be detrimental to the long-term development of the compiler, and hence this feature is being removed.
2014-06-17Add a b'x' byte literal of type u8.Simon Sapin-0/+6
2014-06-14Register new snapshotsAlex Crichton-9/+0
2014-06-13syntax: parse outer attributes in `quote_item!` calls.Huon Wilson-3/+2
Fixes #14857.
2014-06-13syntax: fix quote_pat! & unignore a quotation test.Huon Wilson-3/+1
2014-06-11rustc: Move the AST from @T to Gc<T>Alex Crichton-2/+2
2014-06-11syntax: Move the AST from @T to Gc<T>Alex Crichton-24/+28
2014-06-07Implement ToSource and ToToken for ast::ArgHanno Braun-0/+7
This makes ast::Arg usable in the quote_ macros. Please note that this commit doesn't include a regression test. There are tests that use the quote macros, but all of them are ignored. Due to that, there is no obvious (to me) way to test this. Since this change is absolutely trivial and only hooks up an additional type to existing infrastructure (which presumably is tested elsewhere), I concluded it's not worth the effort to follow up on this.
2014-06-04syntax: Make quasiquoter use absolute pathsklutzy-69/+54
As part of removing `pub use` glob, two extra import globs were injected to make `quote_expr!` work. However the globs caused `unused_import` warning in some places. Quasiquoter needed the globs since it generated idents (e.g. `TyU`) rather than absolute paths (`::syntax::ast::TyU`). This patch removes the extra globs and makes quasiquoter use absolute paths. Fixes #14618
2014-06-02syntax: Remove use of `pub use` globsklutzy-8/+20
`quote_expr!` now injects two more (priv) `use` globs. This may cause extra unused_imports warning.
2014-05-27std: Rename strbuf operations to stringRicho Healey-12/+12
[breaking-change]
2014-05-27std: Remove String's to_ownedRicho Healey-13/+13
2014-05-24core: rename strbuf::StrBuf to string::StringRicho Healey-35/+35
[breaking-change]
2014-05-23auto merge of #14360 : alexcrichton/rust/remove-deprecated, r=kballardbors-1/+0
These have all been deprecated for awhile now, so it's likely time to start removing them.
2014-05-23syntax: Clean out obsolete syntax parsingAlex Crichton-1/+0
All of these features have been obsolete since February 2014, where most have been obsolete since 2013. There shouldn't be any more need to keep around the parser hacks after this length of time.
2014-05-22libstd: Remove all uses of `~str` from `libstd`Patrick Walton-3/+3
2014-05-08libsyntax: Remove uses of `~str` from libsyntax, and fix falloutPatrick Walton-47/+55
2014-05-06librustc: Remove `~EXPR`, `~TYPE`, and `~PAT` from the language, exceptPatrick Walton-6/+12
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-02syntax: implement ToSource for more things in the quasiquoter.Huon Wilson-0/+23
The last few primitive types were missing.
2014-04-22add support for quadruple precision floating pointDaniel Micay-1/+2
This currently requires linking against a library like libquadmath (or libgcc), because compiler-rt barely has any support for this and most hardware does not yet have 128-bit precision floating point. For this reason, it's currently hidden behind a feature gate. When compiler-rt is updated to trunk, some tests can be added for constant evaluation since there will be support for the comparison operators. Closes #13381
2014-04-18Replace all ~"" with "".to_owned()Richo Healey-16/+16
2014-04-16syntax: unify all MacResult's into a single trait.Huon Wilson-12/+12
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-30Removed deprecated functions `map` and `flat_map` for vectors and slices.Marvin Löbel-3/+3
2014-03-20Removing imports of std::vec_ng::VecAlex Crichton-4/+0
It's now in the prelude.
2014-03-20rename std::vec_ng -> std::vecDaniel Micay-2/+2
Closes #12771
2014-03-01libsyntax: Fix errors arising from the automated `~[T]` conversionPatrick Walton-8/+14
2014-03-01libsyntax: Mechanically change `~[T]` to `Vec<T>`Patrick Walton-52/+52