about summary refs log tree commit diff
path: root/src/libsyntax/parse
AgeCommit message (Collapse)AuthorLines
2016-02-11[breaking-change] don't glob export ast::UnOp variantsOliver Schneider-7/+7
2016-02-08Breaking tokens into pieces should behave similar to Parser::bump.Tomasz Miąsko-11/+19
Previously when breaking tokens into smaller pieces, the replace_token function have been used. It replaced current token and updated span information, but it did not clear the list of expected tokens, neither did it update remaining info about last token. This could lead to incorrect error message, like one described in the issue #24780: expected one of ... `>` ... found `>`
2016-02-01Replace some aborts with ResultsNick Cameron-7/+3
Fixes #31207 by removing abort_if_new_errors
2016-01-30Rollup merge of #31244 - tshepang:rustfmt-parse, r=nikomatsakisManish Goregaokar-49/+49
2016-01-27rustfmt syntax::parseTshepang Lekhonkhobe-49/+49
2016-01-27Auto merge of #31089 - fhahn:macro-ice, r=pnkfelixbors-30/+68
This is a work in progress PR that potentially should fix #29084, #28308, #25385, #28288, #31011. I think this may also adresse parts of #2887. The problem in this issues seems to be that when transcribing macro arguments, we just clone the argument Nonterminal, which still has to original spans. This leads to the unprintable spans. One solution would be to update the spans of the inserted argument to match the argument in the macro definition. So for [this testcase](https://github.com/rust-lang/rust/compare/master...fhahn:macro-ice?expand=1#diff-f7def7420c51621640707b6337726876R2) the error message would be displayed in the macro definition: src/test/compile-fail/issue-31011.rs:4:12: 4:22 error: attempted access of field `trace` on type `&T`, but no field with that name was found src/test/compile-fail/issue-31011.rs:4 if $ctx.trace { Currently I've added a very simple `update_span` function, which updates the span of the outer-most expression of a `NtExpr`, but this `update_span` function should be updated to handle all Nonterminals. But I'm pretty new to the macro system and would like to check if this approach makes sense, before doing that.
2016-01-27Avoid storing interolated token in Parser.last_tokenFlorian Hahn-7/+11
2016-01-27Turn interpolated_or_expr_span into a functionFlorian Hahn-28/+24
2016-01-26Rollup merge of #31211 - Manishearth:pr-30765, r=nrcManish Goregaokar-0/+6
r? @eddyb or @nrc
2016-01-26Push try! to call site of interpolated_or_expr_span!Florian Hahn-17/+18
2016-01-26Add interpolated_or_expr_span macro and pass lo to newly added parse_dot_suffixFlorian Hahn-30/+38
2016-01-26Use interpolated token span when building spans for bigger expressionsFlorian Hahn-19/+37
2016-01-26Set span for interpolated tokens correctlyFlorian Hahn-5/+16
2016-01-26Improve error message for let-in-expr-positionManish Goregaokar-2/+3
2016-01-25do not additionally note about unexpected identifier after unexpected letDaan Sprenkels-6/+5
error, by moving unexpected let check into the proper if-else clause
2016-01-25Update qquote.rs test case and make unexpected `let` error fatalDaan Sprenkels-6/+6
2016-01-25libsyntax: move check for keyword Let to a more logical spotDaan Sprenkels-6/+6
2016-01-25libsyntax: note that `let a = (let b = something)` is invalidDaan Sprenkels-0/+6
in parse_bottom_expr (parser.rs)
2016-01-22The war on abort_if_errorsNick Cameron-15/+12
2016-01-22Some basic error correction in the parser after a dotNick Cameron-42/+62
2016-01-16libsyntax: accept only whitespace with the PATTERN_WHITE_SPACE propertyKevin Butler-9/+12
This aligns with unicode recommendations and should be stable for all future unicode releases. See http://unicode.org/reports/tr31/#R3. This renames `libsyntax::lexer::is_whitespace` to `is_pattern_whitespace` so potentially breaks users of libsyntax.
2016-01-15Auto merge of #30763 - gchp:issue/30033, r=nagisabors-10/+15
This is achieved by adding the scan_back method. This method looks back through the source_text of the StringReader until it finds the target char, returning it's offset in the source. We use this method to find the offset of the opening single quote, and use that offset as the start of the error. Given this code: ```rust fn main() { let _ = 'abcd'; } ``` The compiler would give a message like: ``` error: character literal may only contain one codepoint: '; let _ = 'abcd'; ^~ ``` With this change, the message now displays: ``` error: character literal may only contain one codepoint: 'abcd'; let _ = 'abcd'; ^~~~~~~ ``` Fixes #30033
2016-01-14libsyntax: use char::is_whitespace instead of custom implementationsKevin Butler-4/+1
Fixes #29590.
2016-01-15Implement JSON error emissionNick Cameron-1/+1
[breaking-change] syntax::errors::Handler::new has been renamed to with_tty_emitter Many functions which used to take a syntax::errors::ColorConfig, now take a rustc::session::config::ErrorOutputType. If you previously used ColorConfig::Auto as a default, you should now use ErrorOutputType::default().
2016-01-14Display better snippet for invalid char literalGreg Chapple-10/+15
Given this code: fn main() { let _ = 'abcd'; } The compiler would give a message like: error: character literal may only contain one codepoint: '; let _ = 'abcd'; ^~ With this change, the message now displays: error: character literal may only contain one codepoint: 'abcd' let _ = 'abcd' ^~~~~~ Fixes #30033
2016-01-13Auto merge of #30813 - fhahn:fix-ice-semicolon-in-lifetime, r=nrcbors-4/+6
This PR fixes an ICE due to an DiagnosticsBuilder not being canceld or emitted. Ideally it would use `Handler::cancel`, but I did not manage to get a `&mut` reference to the diagnostics handler.
2016-01-13Auto merge of #30684 - tshepang:rustfmt-lexer-part2, r=nrcbors-511/+756
2016-01-12re-instate comment that was mysteriously disappearedTshepang Lekhonkhobe-0/+1
2016-01-10Cancel parse_ty error in Parser::parse_generic_values_after_ltFlorian Hahn-4/+6
2016-01-07Auto merge of #30723 - nrc:macro-err-bug, r=Manishearthbors-2/+9
Fixes #30715
2016-01-06Rollup merge of #30729 - huonw:delete-bad-comment, r=sanxiynSteve Klabnik-3/+0
The fundamental problem of duplication was fixed in https://github.com/rust-lang/rust/pull/10891, but the comment was preserved. Closes https://github.com/rust-lang/rust/issues/9762.
2016-01-06Auto merge of #30654 - nrc:panictry, r=brsonbors-295/+300
The motivation (other than removing boilerplate) is that this is a baby step towards a parser with error recovery. [breaking-change] if you use any of the changed functions, you'll need to remove a try! or panictry!
2016-01-06Remove irrelevant commentHuon Wilson-3/+0
The fundamental problem of duplication was fixed in https://github.com/rust-lang/rust/pull/10891, but the comment was preserved. Closes https://github.com/rust-lang/rust/issues/9762.
2016-01-06Cancel an error before it panicsNick Cameron-2/+9
Fixes #30715
2016-01-04address review commentTshepang Lekhonkhobe-10/+2
2016-01-03fix "make tidy" failureTshepang Lekhonkhobe-1/+2
2016-01-03run rustfmt on syntax::parse::lexerTshepang Lekhonkhobe-513/+764
2015-12-31Auto merge of #30598 - est31:macro_export_help_note, r=Manishearthbors-5/+17
The current help message is too much about "normal" macros to be used as general message. Keep it for normal macros, and add custom help and error messages for macro definitions.
2015-12-31Cut out a bunch of Result and panictry! boilerplate from libsyntax.Nick Cameron-295/+300
[breaking-change] if you use any of the changed functions, you'll need to remove a try! or panictry!
2015-12-30Auto merge of #30375 - aaronkeen:issue_28777, r=eddybbors-6/+15
RESTRICTION_STMT_EXPR restriction to allow subsequent expressions to contain braces. https://github.com/rust-lang/rust/issues/28777
2015-12-30Limit line length to below 100 charsest31-2/+4
2015-12-30whitespace after colon, not beforeest31-1/+1
2015-12-30Custom help message for people trying to make macro publicest31-5/+15
The current help message is too much about "normal" macros to be used as general message. Keep it for normal macros, and add custom help and error messages for macro definitions.
2015-12-30Auto merge of #30526 - Ms2ger:PathParameters, r=brsonbors-7/+8
2015-12-30Rebasing and review commentsNick Cameron-1/+1
2015-12-30use structured errorsNick Cameron-288/+337
2015-12-22Stop re-exporting PathParameters's variants.Ms2ger-7/+8
2015-12-21Auto merge of #30460 - Ms2ger:BindingMode, r=alexcrichtonbors-10/+10
2015-12-20Stop re-exporting the ast::BindingMode variants.Ms2ger-10/+10
2015-12-19Auto merge of #30184 - petrochenkov:ascr, r=nikomatsakisbors-3/+9
This PR is a rebase of the original PR by @eddyb https://github.com/rust-lang/rust/pull/21836 with some unrebasable parts manually reapplied, feature gate added + type equality restriction added as described below. This implementation is partial because the type equality restriction is applied to all type ascription expressions and not only those in lvalue contexts. Thus, all difficulties with detection of these contexts and translation of coercions having effect in runtime are avoided. So, you can't write things with coercions like `let slice = &[1, 2, 3]: &[u8];`. It obviously makes type ascription less useful than it should be, but it's still much more useful than not having type ascription at all. In particular, things like `let v = something.iter().collect(): Vec<_>;` and `let u = t.into(): U;` work as expected and I'm pretty happy with these improvements alone. Part of https://github.com/rust-lang/rust/issues/23416