about summary refs log tree commit diff
path: root/src/libsyntax/parse/token.rs
AgeCommit message (Collapse)AuthorLines
2018-04-06Get rid of `SpannedIdent`Vadim Petrochenkov-3/+3
2018-04-03expand macro invocations in `extern {}` blocksAustin Bonander-0/+2
2018-03-28Make LazyTokenStream thread-safeJohn Kåre Alsaker-15/+6
2018-03-27Fix pretty-printing for raw identifiersVadim Petrochenkov-1/+8
2018-03-22Clean up raw identifier handling when recovering tokens from AST.Lymia Aluysia-1/+1
2018-03-18Return a is_raw parameter from Token::ident rather than having separate methods.Lymia Aluysia-30/+15
2018-03-18Initial implementation of RFC 2151, Raw IdentifiersLymia Aluysia-29/+79
2018-03-18Auto merge of #48917 - petrochenkov:import, r=oli-obkbors-0/+1
syntax: Make imports in AST closer to the source and cleanup their parsing This is a continuation of https://github.com/rust-lang/rust/pull/45846 in some sense.
2018-03-17AST: Keep distinction between `path` and `::path` in imports and visibilitiesVadim Petrochenkov-0/+1
Add the root segment for name resolution purposes only
2018-03-17syntax: Make `_` an identifierVadim Petrochenkov-5/+4
2018-03-02Replace Rc with Lrc for shared dataJohn Kåre Alsaker-3/+3
2018-01-30The `static` keyword can now begin expressionsJohn Kåre Alsaker-0/+1
2018-01-03Support `extern` in pathsVadim Petrochenkov-0/+1
2017-12-30refactor lifetime out of is_lifetimeMatt Peterson-6/+14
2017-12-28Fix testsMatt Peterson-2/+10
2017-12-28Resurrecting #33135Michael Hewson-0/+2
Started rebasing @sgrif's PR #33135 off of current master. (Well, actually merging it into a new branch based off current master.) The following files still need to be fixed or at least reviewed: - `src/libsyntax/ext/tt/macro_parser.rs`: calls `Parser::parse_lifetime`, which doesn't exist anymore - `src/libsyntax/parse/parser.rs`: @sgrif added an error message to `Parser::parse_lifetime`. Code has since been refactored, so I just took it out for now. - `src/libsyntax/ext/tt/transcribe.rs`: This code has been refactored bigtime. Not sure whether @sgrif's changes here are still necessary. Took it out for this commit.
2017-12-14Use PathBuf instead of String where applicableOliver Schneider-4/+3
2017-12-09Use Try syntax for Option in place of macros or matchMatt Brubeck-4/+1
2017-11-21Support `::crate` in pathsVadim Petrochenkov-0/+1
2017-11-06Using `...` in expressions is now an errorBadel2-1/+1
2017-10-25Improve recovery after unexpected tokens parsing sequenceThomas Karpiniec-0/+10
2017-10-14Implement `dyn Trait` syntaxVadim Petrochenkov-0/+6
2017-09-22Add support for `..=` syntaxAlex Burka-15/+20
Add ..= to the parser Add ..= to libproc_macro Add ..= to ICH Highlight ..= in rustdoc Update impl Debug for RangeInclusive to ..= Replace `...` to `..=` in range docs Make the dotdoteq warning point to the ... Add warning for ... in expressions Updated more tests to the ..= syntax Updated even more tests to the ..= syntax Updated the inclusive_range entry in unstable book
2017-09-18rustc: Forbid interpolated tokens in the HIRAlex Crichton-0/+85
Right now the HIR contains raw `syntax::ast::Attribute` structure but nowadays these can contain arbitrary tokens. One variant of the `Token` enum is an "interpolated" token which basically means to shove all the tokens for a nonterminal in this position. A "nonterminal" in this case is roughly analagous to a macro argument: macro_rules! foo { ($a:expr) => { // $a is a nonterminal as an expression } } Currently nonterminals contain namely items and expressions, and this poses a problem for incremental compilation! With incremental we want a stable hash of all HIR items, but this means we may transitively need a stable hash *of the entire AST*, which is certainly not stable w/ node ids and whatnot. Hence today there's a "bug" where the "stable hash" of an AST is just the raw hash value of the AST, and this only arises with interpolated nonterminals. The downside of this approach, however, is that a bunch of errors get spewed out during compilation about how this isn't a great idea. This PR is focused at fixing these warnings, basically deleting them from the compiler. The implementation here is to alter attributes as they're lowered from the AST to HIR, expanding all nonterminals in-place as we see them. This code for expanding a nonterminal to a token stream already exists for the `proc_macro` crate, so we basically just reuse the same implementation there. After this PR it's considered a bug to have an `Interpolated` token and hence the stable hash implementation simply uses `bug!` in this location. Closes #40946
2017-07-28Generator literal supportJohn Kåre Alsaker-0/+1
2017-07-05Merge remote-tracking branch 'origin/master' into proc_macro_apiAlex Crichton-10/+20
2017-06-29Change some terminology around keywords and reserved identifierspetrochenkov-9/+18
2017-06-29Make `$crate` a keywordVadim Petrochenkov-1/+2
2017-06-26Address review comments.Jeffrey Seyfried-12/+32
2017-06-26Add `LazyTokenStream`.Jeffrey Seyfried-6/+47
2017-06-26Implement `quote!` and other `proc_macro` API.Jeffrey Seyfried-0/+63
2017-06-26Simplify `hygiene::Mark` application, andJeffrey Seyfried-3/+0
remove variant `Token::SubstNt` in favor of `quoted::TokenTree::MetaVar`.
2017-05-12Fix some clippy warnings in libsyntaxAndre Bogus-21/+25
This is mostly removing stray ampersands, needless returns and lifetimes.
2017-04-15move NtVis enum variant to stave off comment rotAlex Burka-1/+1
2017-04-15Implementation of the `vis` macro matcher.Daniel Keep-0/+2
2017-03-30Improve `Path` spans.Jeffrey Seyfried-24/+24
2017-03-21Refactor parsing of trait object typesVadim Petrochenkov-15/+29
2017-03-19Auto merge of #40346 - jseyfried:path_and_tokenstream_attr, r=nrcbors-2/+2
`TokenStream`-based attributes, paths in attribute and derive macro invocations This PR - refactors `Attribute` to use `Path` and `TokenStream` instead of `MetaItem`. - supports macro invocation paths for attribute procedural macros. - e.g. `#[::foo::attr_macro] struct S;`, `#[cfg_attr(all(), foo::attr_macro)] struct S;` - supports macro invocation paths for derive procedural macros. - e.g. `#[derive(foo::Bar, super::Baz)] struct S;` - supports arbitrary tokens as arguments to attribute procedural macros. - e.g. `#[foo::attr_macro arbitrary + tokens] struct S;` - supports using arbitrary tokens in "inert attributes" with derive procedural macros. - e.g. `#[derive(Foo)] struct S(#[inert arbitrary + tokens] i32);` where `#[proc_macro_derive(Foo, attributes(inert))]` r? @nrc
2017-03-14Refactor `Attribute` to use `Path` and `TokenStream` instead of `MetaItem`.Jeffrey Seyfried-2/+2
2017-03-11Temporarily prefix catch block with do keywordTaylor Cramer-0/+1
2017-02-28Remove `Token::MatchNt`.Jeffrey Seyfried-3/+0
2017-02-28Clean up `ext::tt::transcribe::TtFrame`, rename to `Frame`.Jeffrey Seyfried-2/+2
2017-01-27Rollup merge of #39335 - cramertj:cramertj/can_begin_expr_fix, r=petrochenkovAlex Crichton-1/+23
Fix can_begin_expr keyword behavior Partial fix for #28784.
2017-01-26Fix can_begin_expr keyword behaviorTaylor Cramer-1/+23
2017-01-24Refactor parsing of generic arguments/parameters and where clausesVadim Petrochenkov-0/+23
2017-01-23Remove `open_span` and `close_span` from `Delimited`.Jeffrey Seyfried-0/+6
2016-11-20Move `syntax::util::interner` -> `syntax::symbol`, cleanup.Jeffrey Seyfried-267/+1
2016-11-20Refactor `P<ast::MetaItem>` -> `ast::MetaItem`.Jeffrey Seyfried-1/+1
2016-11-20Avoid clearing the string interner.Jeffrey Seyfried-4/+0
2016-11-03Reduce the size of `Token` and make it cheaper to clone by refactoringJeffrey Seyfried-15/+20
`Token::Interpolated(Nonterminal)` -> `Token::Interpolated(Rc<Nonterminal>)`.