about summary refs log tree commit diff
path: root/src/libsyntax/parse/attr.rs
AgeCommit message (Collapse)AuthorLines
2019-02-18Remove `LazyTokenStream`.Nicholas Nethercote-2/+2
It's present within `Token::Interpolated` as an optimization, so that if a nonterminal is converted to a `TokenStream` multiple times, the first-computed value is saved and reused. But in practice it's not needed. `interpolated_to_tokenstream()` is a cold function: it's only called a few dozen times while compiling rustc itself, and a few hundred times across the entire `rustc-perf` suite. Furthermore, when it is called, it is almost always the first conversion, so no benefit is gained from it. So this commit removes `LazyTokenStream`, along with the now-unnecessary `Token::interpolated()`. As well as a significant simplification, the removal speeds things up slightly, mostly due to not having to `drop` the `LazyTokenStream` instances.
2019-02-07libsyntax => 2018Taiki Endo-8/+10
2018-12-25Remove licensesMark Rousskov-10/+0
2018-12-12Rename `TokenStream::concat` and remove `TokenStream::concat_rc_vec`.Nicholas Nethercote-1/+1
`TokenStream::new` is a better name for the former, and the latter is now just equivalent to `TokenStream::Stream`.
2018-12-04cleanup: remove static lifetimes from constsljedrz-2/+2
2018-08-19mv (mod) codemap source_mapDonato Sciarra-1/+1
2018-08-15syntax: Enforce attribute grammar in the parserVadim Petrochenkov-5/+29
2018-07-14Remove most of `PartialEq` impls from AST and HIR structuresVadim Petrochenkov-2/+2
2018-06-09Crate-ify and delete unused code in syntax::parseMark Simulacrum-6/+5
2018-05-02make it compile againflip1995-3/+3
2018-05-02Allow Path for name of MetaItemSeiichi Uchida-3/+4
2018-04-06Use `Ident` instead of `Name` in `MetaItem`Vadim Petrochenkov-3/+2
2018-04-06Remove more duplicated spansVadim Petrochenkov-1/+1
2018-03-17improve attribute trailing semicolon errorcsmoe-10/+1
2017-10-30edit and fix bad spacing of inner-attribute-not-allowed noteZack M. Davis-5/+4
This multiline string literal was missing a backslash, leaving an awkward newline and 35 spaces in the middle of the message. But while we're here, the existing message seems kind of long in comparison to similar notes: to cut it down, we excise the mentions of doc comments, which seems sensible because we know that this erroneous attribute is not a doc comment (notice the `is_sugared_doc: false` at the end of the function; if it had been a doc comment, that error would get set in the `token::DocComment` match branch of `parse_outer_attributes`).
2017-08-18Auto merge of #43904 - topecongiro:libsyntax/parse-attr, r=petrochenkovbors-6/+4
Eat open paren when parsing list in libsyntax/parse/attr.rs This PR adds a small refactoring: ```diff pub fn parse_meta_item_kind(&mut self) -> PResult<'a, ast::MetaItemKind> { Ok(if self.eat(&token::Eq) { ast::MetaItemKind::NameValue(self.parse_unsuffixed_lit()?) - } else if self.token == token::OpenDelim(token::Paren) { + } else if self.eat(&token::OpenDelim(token::Paren)) { ast::MetaItemKind::List(self.parse_meta_seq()?) } else { - self.eat(&token::OpenDelim(token::Paren)); ast::MetaItemKind::Word }) } ``` in `parse_meta_item_kind()`, the parser calls `self.eat(&token::OpenDelim(token::Paren));` before returning `ast::MetaItemKind::Word` just to add `(` to expected token. It seems more natural to eat the paren when parsing `ast::MetaItemKind::List`.
2017-08-16Eat open paren when parsing listSeiichi Uchida-6/+4
2017-08-15use field init shorthand EVERYWHEREZack M. Davis-4/+4
Like #43008 (f668999), but _much more aggressive_.
2017-06-26Add `LazyTokenStream`.Jeffrey Seyfried-2/+2
2017-05-12Fix some clippy warnings in libsyntaxAndre Bogus-2/+2
This is mostly removing stray ampersands, needless returns and lifetimes.
2017-03-29Refactor how spans are combined in the parser.Jeffrey Seyfried-17/+12
2017-03-14Liberalize attributes.Jeffrey Seyfried-7/+25
2017-03-14Refactor `Attribute` to use `Path` and `TokenStream` instead of `MetaItem`.Jeffrey Seyfried-5/+11
2016-11-21Use `Symbol` instead of `InternedString` in the AST, HIR, and various other ↵Jeffrey Seyfried-8/+3
places.
2016-11-20Refactor `P<ast::MetaItem>` -> `ast::MetaItem`.Jeffrey Seyfried-3/+2
2016-11-20Move `MetaItemKind`'s `Name` to a field of `MetaItem`.Jeffrey Seyfried-17/+9
2016-11-20Refactor `MetaItemKind` to use `Name`s instead of `InternedString`s.Jeffrey Seyfried-4/+3
2016-11-20Refactor away `ast::Attribute_`.Jeffrey Seyfried-11/+9
2016-11-03Reduce the size of `Token` and make it cheaper to clone by refactoringJeffrey Seyfried-1/+4
`Token::Interpolated(Nonterminal)` -> `Token::Interpolated(Rc<Nonterminal>)`.
2016-10-05Rename Parser::last_span as prev_span.Nicholas Nethercote-6/+6
This is a [breaking-change] for libsyntax.
2016-09-16fix top level attr spansMikhail Modin-1/+1
2016-09-10fix span for errors E0537, E0535 & E0536Mikhail Modin-5/+5
2016-08-25Implement RFC#1559: allow all literals in attributes.Sergio Benitez-16/+48
2016-07-15syntax: Better error message for inner attr following doc commentAravind Gollakota-14/+56
2016-07-03prefer `if let` to match with `None => {}` arm in some placesZack M. Davis-6/+3
This is a spiritual succesor to #34268/8531d581, in which we replaced a number of matches of None to the unit value with `if let` conditionals where it was judged that this made for clearer/simpler code (as would be recommended by Manishearth/rust-clippy's `single_match` lint). The same rationale applies to matches of None to the empty block.
2016-06-23Move errors from libsyntax to its own crateJonathan Turner-1/+2
2016-05-03parser: show a helpful note on unexpected inner commentGeorg Brandl-1/+4
Fixes: #30318.
2016-05-02replace fileline_{help,note} with {help,note}Niko Matsakis-3/+2
The extra filename and line was mainly there to keep the indentation relative to the main snippet; now that this doesn't include filename/line-number as a prefix, it is distracted.
2016-03-22try! -> ?Jorge Aparicio-8/+8
Automated conversion using the untry tool [1] and the following command: ``` $ find -name '*.rs' -type f | xargs untry ``` at the root of the Rust repo. [1]: https://github.com/japaric/untry
2016-02-22Use associated functions for libsyntax SepSeq constructors.Corey Farwell-2/+2
2016-02-11[breaking-change] don't glob export ast::MetaItem_Oliver 'ker' Schneider-3/+3
2016-02-11[breaking-change] don't pub export ast::Lit_ variantsOliver Schneider-1/+1
2016-01-27rustfmt syntax::parseTshepang Lekhonkhobe-34/+34
2015-12-31Cut out a bunch of Result and panictry! boilerplate from libsyntax.Nick Cameron-7/+7
[breaking-change] if you use any of the changed functions, you'll need to remove a try! or panictry!
2015-12-30use structured errorsNick Cameron-11/+13
2015-10-28Make quote plugin use parsing functions which explicitly panic.Eli Friedman-1/+1
Rename parse_* to parse_*_panic, and add parse_attribute_panic.
2015-10-27Don't panic for fatal errors in attribute parsing.Eli Friedman-34/+35
2015-10-27Delete unnecessary ParserAttr trait.Eli Friedman-21/+4
2015-10-01Stop re-exporting AttrStyle's variants and rename them.Ms2ger-6/+6
2015-09-24Cleanup interfaces of Name, SyntaxContext and IdentVadim Petrochenkov-4/+3
Make sure Name, SyntaxContext and Ident are passed by value Make sure Idents don't serve as keys (or parts of keys) in maps, Ident comparison is not well defined