about summary refs log tree commit diff
path: root/src/libsyntax/parse
AgeCommit message (Collapse)AuthorLines
2015-11-26Moved and refactored ThinAttributesMarvin Löbel-22/+22
2015-11-26Add syntax support for attributes on expressions and all syntaxMarvin Löbel-152/+315
nodes in statement position. Extended #[cfg] folder to allow removal of statements, and of expressions in optional positions like expression lists and trailing block expressions. Extended lint checker to recognize lint levels on expressions and locals.
2015-11-26Fix spans for macrosKevin Yeh-3/+6
2015-11-18Add some unicode aliases for ".Huon Wilson-0/+17
2015-11-17Auto merge of #29766 - oli-obk:impl_item, r=nikomatsakisbors-8/+8
[breaking change] I'm not sure if those renames are ok. [TokenType::Tt* to TokenType::*](https://github.com/rust-lang/rust/pull/29582) was obvious, but for all those Item-enums it's less obvious to me what the right way forward is due to the underscore.
2015-11-17Detect confusing unicode characters and show the alternativeRavi Shankar-1/+189
2015-11-16rename `ast::ImplItem_::*ImplItem` to `ast::ImplItemKind::*`Oliver Schneider-8/+8
2015-11-13Move the panicking parse functions out of the parserKyle Mayes-47/+0
Since these functions are only used by the AST quoting syntax extensions, they should be there instead of in the parser.
2015-11-13Auto merge of #29761 - eefriedman:rename-nopanic, r=sanxiynbors-62/+62
Just `sed s/_nopanic//g`. Hopefully makes libsyntax a bit more readable.
2015-11-12Auto merge of #29807 - nrc:op_span, r=brsonbors-1/+1
cc @nagisa
2015-11-13Fix a bad span for binopsNick Cameron-1/+1
2015-11-12Auto merge of #29780 - KyleMayes:quote-ext, r=nrcbors-1/+21
This is my first code contribution to Rust, so I'm sure there are some issues with the changes I've made. I've added the `quote_arg!`, `quote_block!`, `quote_path!`, and `quote_meta_item!` quasiquoting macros. From my experience trying to build AST in compiler plugins, I would like to be able to build any AST piece with a quasiquoting macro (e.g., `quote_struct_field!` or `quote_variant!`) and then use those AST pieces in other quasiquoting macros, but this pull request just adds some of the low-hanging fruit. I'm not sure if these additions are desirable, and I'm sure these macros can be implemented in an external crate if not.
2015-11-12libsyntax: deny warnings in doctestsKevin Butler-1/+1
2015-11-11libsyntax: Add more quasiquoting macrosKyle Mayes-1/+21
2015-11-11Auto merge of #29744 - sanxiyn:modernize, r=nrcbors-6/+6
2015-11-10Rename _nopanic methods to remove the suffix.Eli Friedman-62/+62
Just `sed s/_nopanic//g`. Hopefully makes libsyntax a bit more readable.
2015-11-10Use deref coercionsSeo Sanghyeon-6/+6
2015-11-09Use enum ParsePub instead of bool in field parsing + typoVadim Petrochenkov-11/+24
2015-11-09syntax: Merge parsing code for structures and variantsVadim Petrochenkov-44/+20
2015-11-06Auto merge of #29582 - oli-obk:token_tree, r=sfacklerbors-29/+28
2015-11-06remove `Tt` prefix from TokenType variantsOliver Schneider-29/+28
[breaking change]
2015-11-06Auto merge of #29615 - steveklabnik:lol_strings, r=alexcrichtonbors-1/+1
&format!("...") is the same as "" if we're not doing any interpolation, and doesn't allocate an intermediate String.
2015-11-05remove excess string allocationSteve Klabnik-1/+1
&format!("...") is the same as "" if we're not doing any interpolation, and doesn't allocate an intermediate String.
2015-11-05Improve error message for char literalsSteve Klabnik-5/+6
If you try to put something that's bigger than a char into a char literal, you get an error: fn main() { let c = 'ஶ்ரீ'; } error: unterminated character constant: This is a very compiler-centric message. Yes, it's technically 'unterminated', but that's not what you, the user did wrong. Instead, this commit changes it to error: character literal may only contain one codepoint As this actually tells you what went wrong. Fixes #28851
2015-11-03Auto merge of #29285 - eefriedman:libsyntax-panic, r=nrcbors-119/+111
A set of commits which pushes some panics out of core parser methods, and into users of those parser methods.
2015-10-31Remove PatWildMultiVadim Petrochenkov-4/+3
2015-10-28libsyntax: improve error message when a statement is prefixed with a match ↵Kevin Butler-1/+7
keyword
2015-10-28Make quote plugin use parsing functions which explicitly panic.Eli Friedman-7/+11
Rename parse_* to parse_*_panic, and add parse_attribute_panic.
2015-10-27Update libsyntax tests.Eli Friedman-2/+2
2015-10-27Make fatal errors more consistent.Eli Friedman-1/+1
2015-10-27Start pushing panics outward in lexer.Eli Friedman-34/+38
2015-10-27Don't panic for fatal errors in attribute parsing.Eli Friedman-52/+54
2015-10-27Delete unnecessary ParserAttr trait.Eli Friedman-23/+4
2015-10-27Don't use panicking helpers in Parser.Eli Friedman-5/+6
2015-10-27Add tests for newly introduced syntaxSimonas Kazlauskas-3/+5
Also add some (regression) tests for discovered parser oddities
2015-10-27Fix restrictions when parsing rhs of equalitiesSimonas Kazlauskas-8/+29
2015-10-27Fix prefix range expressions being not parsedSimonas Kazlauskas-74/+68
2015-10-27Generalise associative operator parsingSimonas Kazlauskas-131/+132
This commit generalises parsing of associative operators from left-associative only (with some ugly hacks to support right-associative assignment) to properly left/right-associative operators. Parsing still is not general enough to handle non-associative, non-highest-precedence prefix or non-highest-precedence postfix operators (e.g. `..` range syntax), though. That should be fixed in the future. Lastly, this commit adds support for parsing right-associative `<-` (left arrow) operator with precedence higher than assignment as the operator for placement-in feature.
2015-10-26Auto merge of #29274 - thepowersgang:issues-29107-const-unsafe-fn-order, ↵bors-10/+14
r=nikomatsakis This PR switches the implemented ordering from `unsafe const fn` (as was in the original RFC) to `const unsafe fn` (which is what the lang team decided on)
2015-10-26Auto merge of #29287 - Ryman:fn_nopat, r=alexcrichtonbors-15/+13
Previously, if you copied a signature from a trait definition such as: ```rust fn foo<'a>(&'a Bar) -> bool {} ``` and moved it into an `impl`, there would be an error message: "unexpected token `'a`" Adding to the error message that a pattern is expected should help users to find the actual problem with using a lifetime here.
2015-10-26Auto merge of #29303 - petrochenkov:unistrimp, r=eddybbors-8/+6
And use `VariantData` instead of `P<VariantData>` in `Item_` and `Variant_` Improvements suggested by @eddyb in https://github.com/rust-lang/rust/pull/28816#discussion_r42483587 and https://github.com/rust-lang/rust/pull/28816#discussion_r42483648 plugin-[breaking-change] r? @eddyb
2015-10-25std: Stabilize library APIs for 1.5Alex Crichton-1/+1
This commit stabilizes and deprecates library APIs whose FCP has closed in the last cycle, specifically: Stabilized APIs: * `fs::canonicalize` * `Path::{metadata, symlink_metadata, canonicalize, read_link, read_dir, exists, is_file, is_dir}` - all moved to inherent methods from the `PathExt` trait. * `Formatter::fill` * `Formatter::width` * `Formatter::precision` * `Formatter::sign_plus` * `Formatter::sign_minus` * `Formatter::alternate` * `Formatter::sign_aware_zero_pad` * `string::ParseError` * `Utf8Error::valid_up_to` * `Iterator::{cmp, partial_cmp, eq, ne, lt, le, gt, ge}` * `<[T]>::split_{first,last}{,_mut}` * `Condvar::wait_timeout` - note that `wait_timeout_ms` is not yet deprecated but will be once 1.5 is released. * `str::{R,}MatchIndices` * `str::{r,}match_indices` * `char::from_u32_unchecked` * `VecDeque::insert` * `VecDeque::shrink_to_fit` * `VecDeque::as_slices` * `VecDeque::as_mut_slices` * `VecDeque::swap_remove_front` - (renamed from `swap_front_remove`) * `VecDeque::swap_remove_back` - (renamed from `swap_back_remove`) * `Vec::resize` * `str::slice_mut_unchecked` * `FileTypeExt` * `FileTypeExt::{is_block_device, is_char_device, is_fifo, is_socket}` * `BinaryHeap::from` - `from_vec` deprecated in favor of this * `BinaryHeap::into_vec` - plus a `Into` impl * `BinaryHeap::into_sorted_vec` Deprecated APIs * `slice::ref_slice` * `slice::mut_ref_slice` * `iter::{range_inclusive, RangeInclusive}` * `std::dynamic_lib` Closes #27706 Closes #27725 cc #27726 (align not stabilized yet) Closes #27734 Closes #27737 Closes #27742 Closes #27743 Closes #27772 Closes #27774 Closes #27777 Closes #27781 cc #27788 (a few remaining methods though) Closes #27790 Closes #27793 Closes #27796 Closes #27810 cc #28147 (not all parts stabilized)
2015-10-25syntax/rustc_front: Simplify VariantData::fieldsVadim Petrochenkov-8/+6
And use VariantData instead of P<VariantData> in Item_ and Variant_
2015-10-25Switch to 'const unsafe fn' ordering (rust-lang/rust#29107)John Hodge-10/+14
2015-10-25libsyntax: Consolidate branch to benefit from exhaustive checking instead of ↵Kevin Butler-6/+6
unwrapping
2015-10-25libsyntax: remove panics from Parser::parse_pat_nopanicKevin Butler-9/+3
2015-10-25libsyntax: better error for lifetimes in patternsKevin Butler-0/+4
Previously, if you copied a signature from a trait definition such as: ``` fn foo<'a>(&'a Bar) -> bool {} ``` and moved it into an `impl`, there would be an error message: "unexpected token `'a`" Adding to the error message that a pattern is expected should help users to find the actual problem with using a lifetime here.
2015-10-23parser: fix erroneous commentAleksey Kladov-2/+15
Qualified paths allow full path after the `>::`. For example ```rust <T as Foo>::U::generic_method::<f64>() ``` The example is taken from `test/run-pass/associated-item-long-paths.rs`.
2015-10-18Fix span for pattern literalsMarcus Klaas-2/+2
2015-10-14Auto merge of #28827 - thepowersgang:unsafe-const-fn-2, r=Aatchbors-3/+8
This is the original test implementation, which works according to the tests I wrote, but might need a review.