about summary refs log tree commit diff
path: root/src/libsyntax/parse
AgeCommit message (Collapse)AuthorLines
2015-12-18Require exact type equality + add testsVadim Petrochenkov-1/+2
+ Rebase fixes
2015-12-18Rollup merge of #30420 - petrochenkov:owned2, r=nrcManish Goregaokar-19/+17
Part of https://github.com/rust-lang/rust/pull/30095 not causing mysterious segfaults. r? @nrc
2015-12-18Rollup merge of #30384 - nrc:diagnostics, r=@nikomatsakisManish Goregaokar-56/+80
Should make it possible to add JSON or HTML errors. Also tidies up a lot.
2015-12-18Deprecate name `OwnedSlice` and don't use itVadim Petrochenkov-19/+17
2015-12-17Remove unused importsJeffrey Seyfried-3/+3
2015-12-17test errorsNick Cameron-27/+51
2015-12-17Move a bunch of stuff from Session to syntax::errorsNick Cameron-1/+1
The intention here is that Session is a very thin wrapper over the error handling infra.
2015-12-17move error handling from libsyntax/diagnostics.rs to libsyntax/errors/*Nick Cameron-32/+32
Also split out emitters into their own module.
2015-12-16Add ExprType to HIR and make everything compileVadim Petrochenkov-1/+7
+ Apply parser changes manually + Add feature gate
2015-12-16Implement type ascription.Eduard Burtescu-2/+1
2015-12-16Rollup merge of #30388 - DanielJCampbell:macro-ident-spans, r=nrcManish Goregaokar-1/+1
r? @nrc
2015-12-16Corrected formatting mistakes.Aaron Keen-7/+7
Changed bit manipulation to use supported - (set difference) instead of explicit '& !'.
2015-12-15Generated code spans now point to callsite parameters (where applicable)Daniel Campbell-1/+1
2015-12-14[breaking-change] move ast_util functions to methodsfaineance-2/+2
2015-12-14Corrects issue #28777 by removing, once a binary operator is found, theAaron Keen-6/+15
RESTRICTION_STMT_EXPR restriction to allow subsequent expressions to contain braces. https://github.com/rust-lang/rust/issues/28777
2015-12-04Auto merge of #29850 - Kimundi:attributes_that_make_a_statement, r=pnkfelixbors-152/+315
See https://github.com/rust-lang/rfcs/pull/16 and https://github.com/rust-lang/rust/issues/15701 - Added syntax support for attributes on expressions and all syntax 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. - As per RFC, attributes are not yet accepted on `if` expressions. Examples: ```rust let x = y; { ... } assert_eq!((1, #[cfg(unset)] 2, 3), (1, 3)); let FOO = 0; ``` Implementation wise, there are a few rough corners and open questions: - The parser work ended up a bit ugly. - The pretty printer change was based mostly on guessing. - Similar to the `if` case, there are some places in the grammar where a new `Expr` node starts, but where it seemed weird to accept attributes and hence the parser doesn't. This includes: - const expressions in patterns - in the middle of an postfix operator chain (that is, after `.`, before indexing, before calls) - on range expressions, since `#[attr] x .. y` parses as `(#[attr] x) .. y`, which is inconsistent with `#[attr] .. y` which would parse as `#[attr] (.. y)` - Attributes are added as additional `Option<Box<Vec<Attribute>>>` fields in expressions and locals. - Memory impact has not been measured yet. - A cfg-away trailing expression in a block does not currently promote the previous `StmtExpr` in a block to a new trailing expr. That is to say, this won't work: ```rust let x = { #[cfg(foo)] Foo { data: x } #[cfg(not(foo))] Foo { data: y } }; ``` - One-element tuples can have their inner expression removed to become Unit, but just Parenthesis can't. Eg, `(#[cfg(unset)] x,) == ()` but `(#[cfg(unset)] x) == error`. This seemed reasonable to me since tuples and unit are type constructors, but could probably be argued either way. - Attributes on macro nodes are currently unconditionally dropped during macro expansion, which seemed fine since macro disappear at that point? - Attributes on `ast::ExprParens` will be prepend-ed to the inner expression in the hir folder. - The work on pretty printer tests for this did trigger, but not fix errors regarding macros: - expression `foo![]` prints as `foo!()` - expression `foo!{}` prints as `foo!()` - statement `foo![];` prints as `foo!();` - statement `foo!{};` prints as `foo!();` - statement `foo!{}` triggers a `None` unwrap ICE.
2015-11-28Use last_span for macro spansKevin Yeh-3/+4
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