about summary refs log tree commit diff
path: root/src/libsyntax/parse/attr.rs
AgeCommit message (Collapse)AuthorLines
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
2015-04-05Work towards a non-panicing parser (libsyntax)Phil Dawes-15/+15
- Functions in parser.rs return PResult<> rather than panicing - Other functions in libsyntax call panic! explicitly for now if they rely on panicing behaviour. - 'panictry!' macro added as scaffolding while converting panicing functions. (This does the same as 'unwrap()' but is easier to grep for and turn into try!()) - Leaves panicing wrappers for the following functions so that the quote_* macros behave the same: - parse_expr, parse_item, parse_pat, parse_arm, parse_ty, parse_stmt
2015-03-13syntax: use lookahead to distinguish inner and outer attributes, instead of ↵Eduard Burtescu-32/+26
passing the latter around.
2015-03-03Change span_help calls to fileline_help where appropriateIvan Radanov Ivanov-1/+1
2015-02-20Remove remaining uses of `[]`. This time I tried to use deref coercions ↵Niko Matsakis-1/+1
where possible.
2015-02-02Tweak some ‘expected…’ error messagesP1start-3/+6
Fixes #21153.
2015-01-07use slicing sugarJorge Aparicio-1/+1
2015-01-06rollup merge of #20481: seanmonstar/fmt-show-stringAlex Crichton-2/+2
Conflicts: src/compiletest/runtest.rs src/libcore/fmt/mod.rs src/libfmt_macros/lib.rs src/libregex/parse.rs src/librustc/middle/cfg/construct.rs src/librustc/middle/dataflow.rs src/librustc/middle/infer/higher_ranked/mod.rs src/librustc/middle/ty.rs src/librustc_back/archive.rs src/librustc_borrowck/borrowck/fragments.rs src/librustc_borrowck/borrowck/gather_loans/mod.rs src/librustc_resolve/lib.rs src/librustc_trans/back/link.rs src/librustc_trans/save/mod.rs src/librustc_trans/trans/base.rs src/librustc_trans/trans/callee.rs src/librustc_trans/trans/common.rs src/librustc_trans/trans/consts.rs src/librustc_trans/trans/controlflow.rs src/librustc_trans/trans/debuginfo.rs src/librustc_trans/trans/expr.rs src/librustc_trans/trans/monomorphize.rs src/librustc_typeck/astconv.rs src/librustc_typeck/check/method/mod.rs src/librustc_typeck/check/mod.rs src/librustc_typeck/check/regionck.rs src/librustc_typeck/collect.rs src/libsyntax/ext/format.rs src/libsyntax/ext/source_util.rs src/libsyntax/ext/tt/transcribe.rs src/libsyntax/parse/mod.rs src/libsyntax/parse/token.rs src/test/run-pass/issue-8898.rs
2015-01-06core: split into fmt::Show and fmt::StringSean McArthur-2/+2
fmt::Show is for debugging, and can and should be implemented for all public types. This trait is used with `{:?}` syntax. There still exists #[derive(Show)]. fmt::String is for types that faithfully be represented as a String. Because of this, there is no way to derive fmt::String, all implementations must be purposeful. It is used by the default format syntax, `{}`. This will break most instances of `{}`, since that now requires the type to impl fmt::String. In most cases, replacing `{}` with `{:?}` is the correct fix. Types that were being printed specifically for users should receive a fmt::String implementation to fix this. Part of #20013 [breaking-change]
2015-01-07Replace full slice notation with index callsNick Cameron-1/+1