about summary refs log tree commit diff
path: root/src/libsyntax/ext/tt/macro_parser.rs
AgeCommit message (Collapse)AuthorLines
2018-08-28Use FxHash{Map,Set} instead of the default Hash{Map,Set} everywhere in rustc.Eduard-Mihai Burtescu-5/+5
2018-08-23Use optimized SmallVec implementationIgor Gutorov-1/+1
2018-08-19Fix typos found by codespell.Matthias Krüger-2/+2
2018-08-13Move SmallVec and ThinVec out of libsyntaxljedrz-7/+7
2018-07-16cleanup unnecessary elseMichael Lamparski-6/+4
2018-07-07fix perf issue in macro parserMichael Lamparski-1/+8
For a fuller description of the performance issue fixed by this: https://github.com/rust-lang/rust/issues/51754#issuecomment-403242159
2018-06-10Enable fall through past $:lifetime matcherDavid Tolnay-0/+8
2018-05-27innacurate -> inaccurateTakanori Ishibashi-1/+1
2018-05-26Add `Ident::as_str` helperVadim Petrochenkov-2/+2
2018-05-20Auto merge of #50855 - nnethercote:fewer-macro_parser-allocs, r=petrochenkovbors-23/+71
Speed up the macro parser These three commits reduce the number of allocations done by the macro parser, in some cases dramatically. For example, for a clean check builds of html5ever, the number of allocations is reduced by 40%. Here are the rustc-benchmarks that are sped up by at least 1%. ``` html5ever-check avg: -6.6% min: -10.3% max: -4.1% html5ever avg: -5.2% min: -9.5% max: -2.8% html5ever-opt avg: -4.3% min: -9.3% max: -1.6% crates.io-check avg: -1.8% min: -2.9% max: -0.6% crates.io-opt avg: -1.0% min: -2.2% max: -0.1% crates.io avg: -1.1% min: -2.2% max: -0.2% ```
2018-05-18Introduce `MatcherPosHandle`.Nicholas Nethercote-11/+59
This lets us store most `MatcherPos` instances on the stack. This speeds up various runs of html5ever, the best by 3%.
2018-05-17Change `TokenTreeOrTokenTreeVec` to `TokenTreeOrTokenTreeSlice`.Nicholas Nethercote-19/+19
This avoids a `to_owned` call that can be hot, speeding up the various runs of html5ever by 1--5%, and some runs of crates.io by 2--3%.
2018-05-13Macros: Add a 'literal' fragment specifierDan Aloni-0/+2
Implements RFC 1576. See: https://github.com/rust-lang/rfcs/blob/master/text/1576-macros-literal-matcher.md Changes are mostly in libsyntax, docs, and tests. Feature gate is enabled for 1.27.0. Many thanks to Vadim Petrochenkov for following through code reviews and suggestions. Example: ````rust macro_rules! test_literal { ($l:literal) => { println!("literal: {}", $l); }; ($e:expr) => { println!("expr: {}", $e); }; } fn main() { let a = 1; test_literal!(a); test_literal!(2); test_literal!(-3); } ``` Output: ``` expr: 1 literal: 2 literal: -3 ```
2018-05-03check if the token is a lifetime before parsingrleungx-1/+7
2018-04-06Make lifetime nonterminals closer to identifier nonterminalsVadim Petrochenkov-2/+2
2018-04-06Remove more duplicated spansVadim Petrochenkov-1/+1
2018-04-06Get rid of `SpannedIdent`Vadim Petrochenkov-3/+3
2018-03-18Return a is_raw parameter from Token::ident rather than having separate methods.Lymia Aluysia-2/+2
2018-03-18Initial implementation of RFC 2151, Raw IdentifiersLymia Aluysia-9/+10
2018-03-17Reject `_` in `ident` matcherVadim Petrochenkov-17/+19
2018-03-17syntax: Make `_` an identifierVadim Petrochenkov-2/+1
2018-01-30Update a few commentsMark Mansi-1/+0
2018-01-30Fix trailing whitespaceMark Mansi-1/+1
2018-01-30Attempted fix for `?` kleene opMark Mansi-23/+21
2018-01-30Run rustfmt on macro_parser.rsMark Mansi-4/+6
2018-01-30Update the macro parser to allow at most once repetitions for `?` KleeneMark Mansi-16/+22
2018-01-29Update commentMark Mansi-1/+2
2018-01-26A few more commentsMark Mansi-0/+8
2018-01-26Still more commentsMark Mansi-2/+26
2018-01-26Added/improved commentsMark Mansi-17/+61
2018-01-26Added lots of comments + minor reorganizationMark Mansi-34/+94
2018-01-26Added a bunch of comments to macro_parser.rsMark Mansi-10/+62
2018-01-26Run rustfmt on /libsyntax/ext/tt/macro_parser.rsMark Mansi-78/+114
2018-01-26Do not capture stderr in the compiler. Instead just panic silently for fatal ↵John Kåre Alsaker-3/+3
errors
2017-12-28replace parse_lifetime with expect_lifetimeMichael Hewson-1/+1
made `parser::Parser::expect_lifetime` public, so it can be called from `macro_parser::parse_nt`
2017-12-28Resurrecting #33135Michael Hewson-0/+1
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-08-30Make fields of `Span` privateVadim Petrochenkov-3/+4
2017-08-21Auto merge of #43540 - petrochenkov:pathrelax, r=nikomatsakisbors-3/+1
syntax: Relax path grammar TLDR: Accept the disambiguator `::` in "type" paths (`Type::<Args>`), accept the disambiguator `::` before parenthesized generic arguments (`Fn::(Args)`). The "turbofish" disambiguator `::<>` in expression paths is a necessary evil required for path parsing to be both simple and to give reasonable results. Since paths in expressions usually refer to values (but not necessarily, e.g. `Struct::<u8> { field: 0 }` is disambiguated, but refers to a type), people often consider `::<>` to be inherent to *values*, and not *expressions* and want to write disambiguated paths for values even in contexts where disambiguation is not strictly necessary, for example when a path is passed to a macro `m!(Vec::<i32>::new)`. The problem is that currently, if the disambiguator is not *required*, then it's *prohibited*. This results in confusion - see https://github.com/rust-lang/rust/issues/41740, https://internals.rust-lang.org/t/macro-path-uses-novel-syntax/5561. This PR makes the disambiguator *optional* instead of prohibited in contexts where it's not strictly required, so people can pass paths to macros in whatever form they consider natural (e.g. disambiguated form for value paths). This PR also accepts the disambiguator in paths with parenthesized arguments (`Fn::(Args)`) for consistency and to simplify testing of stuff like https://github.com/rust-lang/rust/pull/41856#issuecomment-301219194. Closes https://github.com/rust-lang/rust/issues/41740 cc @rust-lang/lang r? @nikomatsakis
2017-08-15use field init shorthand EVERYWHEREZack M. Davis-3/+3
Like #43008 (f668999), but _much more aggressive_.
2017-08-11Issue warnings for unnecessary path disambiguatorsVadim Petrochenkov-3/+1
2017-08-01Fixed all unnecessary muts in language coreIsaac van Bakel-2/+2
2017-07-24Make the macro parser theory description more accuratePiotr Czarnecki-100/+102
2017-07-07Only match a fragment specifier the if it starts with certain tokens.kennytm-4/+70
Fixes #24189. Fixes #26444. Fixes #27832. Fixes #34030. Fixes #35650. Fixes #39964. Fixes the 4th comment in #40569. Fixes the issue blocking #40984.
2017-06-26Simplify `hygiene::Mark` application, andJeffrey Seyfried-15/+9
remove variant `Token::SubstNt` in favor of `quoted::TokenTree::MetaVar`.
2017-06-08Speed up expansion.Mark Simulacrum-17/+23
This reduces duplication, thereby increasing expansion speed.
2017-05-18Add an option to the parser to avoid parsing out of line modulesNick Cameron-2/+6
This is useful if parsing from stdin or a String and don't want to try and read in a module from another file. Instead we just leave a stub in the AST.
2017-05-16Rollup merge of #41957 - llogiq:clippy-libsyntax, r=petrochenkovMark Simulacrum-28/+29
Fix some clippy warnings in libsyntax This is mostly removing stray ampersands, needless returns and lifetimes. Basically a lot of small changes.
2017-05-15adressed comments by @kennytm and @petrochenkovAndre Bogus-23/+27
2017-05-15Fix regression in `macro_rules!` name matching.Jeffrey Seyfried-5/+6
2017-05-12Fix some clippy warnings in libsyntaxAndre Bogus-26/+23
This is mostly removing stray ampersands, needless returns and lifetimes.