about summary refs log tree commit diff
path: root/src/librustc_parse/parser/mod.rs
AgeCommit message (Collapse)AuthorLines
2020-08-30mv compiler to compiler/mark-1270/+0
2020-08-17rust_ast::ast => rustc_astUjjwal Sharma-5/+3
2020-08-15replaced log with tracingGurpreet Singh-1/+1
2020-08-08Rollup merge of #75267 - estebank:cleanup, r=Dylan-DPCYuki Okushi-0/+2
Small cleanup * Add docstring to `Parser` field * Remove unnecessary `unwrap` * Remove unnecessary borrow * Fix indentation of some `teach`text output
2020-08-07Small cleanupEsteban Küber-0/+2
* Add docstring to `Parser` field * Remove unnecessary `unwrap` * Remove unnecessary borrow * Fix indentation of some `teach`text output
2020-08-06rustc_expand: Don not beautify doc comments before passing them to macrosVadim Petrochenkov-11/+5
Beautify all doc strings in rustdoc instead, including those in `#[doc]` attributes
2020-08-06rustc_ast: Stop using "string typing" for doc comment tokensVadim Petrochenkov-5/+7
Explicitly store their kind and style retrieved during lexing in the token
2020-08-02Formatting: don't mix mod and useAleksey Kladov-6/+5
Seems to be a fallout from rustfmt transition
2020-08-02Introduce NonterminalKindAleksey Kladov-2/+4
It encapsulate the (part of) the interface between the parser and macro by example (macro_rules) parser. The second bit is somewhat more general `parse_ast_fragment`, which is the reason why we keep some `parse_xxx` functions as public.
2020-07-15Remove lots of `Symbol::as_str()` calls.Nicholas Nethercote-2/+2
In various ways, such as changing functions to take a `Symbol` instead of a `&str`.
2020-07-06Rollup merge of #73953 - JohnTitor:audit-hidden-sugg, r=estebankManish Goregaokar-1/+1
Audit hidden/short code suggestions Should fix #73641. Audit uses of `span_suggestion_short` and `tool_only_span_suggestion` (`span_suggestion_hidden` is already tested with `run-rustfix`). Leave some FIXMEs for futher improvements/fixes. r? @estebank
2020-07-02Audit uses of `span_suggestion_short`Yuki Okushi-1/+1
2020-07-01Remove `token::FlattenGroup`Vadim Petrochenkov-3/+3
2020-06-26proc_macro: Stop flattening groups with dummy spansVadim Petrochenkov-3/+3
2020-06-15Always capture tokens for `macro_rules!` argumentsAaron Hill-1/+1
2020-06-09Fix more clippy warningsMatthias Krüger-3/+3
Fixes more of: clippy::unused_unit clippy::op_ref clippy::useless_format clippy::needless_return clippy::useless_conversion clippy::bind_instead_of_map clippy::into_iter_on_ref clippy::redundant_clone clippy::nonminimal_bool clippy::redundant_closure clippy::option_as_ref_deref clippy::len_zero clippy::iter_cloned_collect clippy::filter_next
2020-05-27improve diagnostics suggestion for missing `@` in slice id binding to rest ↵Chris Simpkins-0/+20
pattern add issue 72373 tests fmt test fix suggestion format Replacement, not insertion of suggested string implement review changes refactor to span_suggestion_verbose, improve suggestion message, change id @ pattern space formatting fmt fix diagnostics spacing between ident and @ refactor reference
2020-05-22Rewrite `Parser::collect_tokens`Aaron Hill-73/+113
The previous implementation did not work when called on an opening delimiter, or when called re-entrantly from the same `TokenCursor` stack depth.
2020-05-08Remove ast::{Ident, Name} reexports.Camille GILLOT-4/+4
2020-04-24Avoid unused Option::map resultsJosh Stone-2/+2
These are changes that would be needed if we add `#[must_use]` to `Option::map`, per #71484.
2020-03-21parse: nix unused `root_module_name`.Mazdak Farrokhzad-5/+0
2020-03-18{rustc_parse::parser -> rustc_expand}::moduleMazdak Farrokhzad-2/+0
2020-03-18outline modules: parse -> expand.Mazdak Farrokhzad-32/+1
2020-03-18expand: use push_directoryMazdak Farrokhzad-1/+1
2020-03-09rustc_parse: Remove `Parser::normalized(_prev)_token`Vadim Petrochenkov-37/+5
2020-03-09rustc_ast: Introduce `Token::uninterpolated_span`Vadim Petrochenkov-3/+3
2020-03-09rustc_parse: Use `Token::ident` where possibleVadim Petrochenkov-4/+4
2020-03-01Rollup merge of #69579 - petrochenkov:noprevspan, r=CentrilYuki Okushi-19/+21
parser: Remove `Parser::prev_span` Follow-up to https://github.com/rust-lang/rust/pull/69384. r? @Centril
2020-02-29Rename `syntax` to `rustc_ast` in source codeVadim Petrochenkov-7/+9
2020-02-29parser: Remove `Parser::prev_span`Vadim Petrochenkov-8/+10
2020-02-29parser: `prev_span` -> `prev_token.span`Vadim Petrochenkov-11/+11
2020-02-28Rollup merge of #69384 - petrochenkov:nounnorm, r=CentrilMazdak Farrokhzad-25/+23
parser: `token` -> `normalized_token`, `nonnormalized_token` -> `token` So, after https://github.com/rust-lang/rust/pull/69006, its follow-ups and an attempt to remove `Parser::prev_span` I came to the conclusion that the unnormalized token and its span is what you want in most cases, so it should be default. Normalization only makes difference in few cases where we are checking against `token::Ident` or `token::Lifetime` specifically. This PR uses `normalized_token` for those cases. Using normalization explicitly means that people writing code should remember about `NtIdent` and `NtLifetime` in general. (That is alleviated by the fact that `token.ident()` and `fn parse_ident_*` are already written.) Remembering about `NtIdent`, was, however, already the case, kind of, because the implicit normalization was performed only for the current/previous token, but not for things like `look_ahead`. As a result, most of token classification methods in `token.rs` already take `NtIdent` into account (this PR fixes a few pre-existing minor mistakes though). The next step is removing `normalized(_prev)_token` entirely and replacing it with `token.ident()` (mostly) and `token.normalize()` (occasionally). I want to make it a separate PR for that and run it though perf. `normalized_token` filled on every bump has both a potential to avoid repeated normalization, and to do unnecessary work in advance (it probably doesn't matter anyway, the normalization is very cheap). r? @Centril
2020-02-27don't use .into() to convert types into identical types.Matthias Krüger-4/+3
example: let s: String = format!("hello").into();
2020-02-24parser: `token` -> `normalized_token`, `nonnormalized_token` -> `token`Vadim Petrochenkov-25/+23
2020-02-22parser: Cleanup `Parser::bump_with` and its usesVadim Petrochenkov-127/+51
2020-02-17parser: Remove `Option`s from unnormalized tokensVadim Petrochenkov-36/+19
They are always set synchronously with normalized tokens now
2020-02-17parser: Set previous and unnormalized tokens in couple more placesVadim Petrochenkov-4/+4
2020-02-17parser: Do not call `bump` recursivelyVadim Petrochenkov-43/+32
Token normalization is merged directly into `bump`. Special "unknown macro variable" diagnostic for unexpected `$`s is removed as preventing legal code from compiling.
2020-02-13parser: misc small item related improvements & cleanups.Mazdak Farrokhzad-0/+5
2020-02-13parser: move `ban_async_in_2015` to `fn` parsing & improve it.Mazdak Farrokhzad-13/+0
2020-02-13IsAsync -> enum Async { Yes { span: Span, .. }, No }Mazdak Farrokhzad-4/+5
use new span for better diagnostics.
2020-02-13Constness -> enum Const { Yes(Span), No }Mazdak Farrokhzad-3/+9
Same idea for `Unsafety` & use new span for better diagnostics.
2020-02-13Rollup merge of #68848 - nnethercote:hasten-macro-parsing, r=petrochenkovDylan DPC-5/+4
Hasten macro parsing r? @eddyb
2020-02-12Rollup merge of #69034 - petrochenkov:notokind, r=CentrilDylan DPC-32/+6
parser: Remove `Parser::prev_token_kind` Follow-up to https://github.com/rust-lang/rust/pull/69006. r? @Centril
2020-02-11Run RustFmtjumbatm-1/+3
2020-02-11Invert control in struct_lint_level.jumbatm-1/+1
Caller now passes in a `decorate` function, which is only run if the lint is allowed.
2020-02-10parser: Remove `Parser::prev_token_kind`Vadim Petrochenkov-32/+6
2020-02-10parser: Keep current and previous tokens preciselyVadim Petrochenkov-23/+51
including their unnormalized forms. Add more documentation for them.
2020-02-06Remove the `Cow` from `Directory`.Nicholas Nethercote-5/+4
The previous commit wrapped `Parser` within a `Cow` for the hot macro parsing path. As a result, there's no need for the `Cow` within `Directory`, because it lies within `Parser`.
2020-02-04stop using BytePos for computing spans in librustc_parse/parser/mod.rsDavid Renshaw-17/+22