aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_parser/src/grammar
Commit message (Collapse)AuthorAgeFilesLines
* Revert "Merge #4233"Aleksey Kladov2020-05-021-3/+3
| | | | | This reverts commit a5f2b16366f027ad60c58266a66eb7fbdcbda9f9, reversing changes made to c96b2180c1c4206a0a98c280b4d30897eb116336.
* Remove dead code, which elaborately pretends to be aliveAleksey Kladov2020-04-301-3/+3
|
* Merge #4227bors[bot]2020-04-301-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 4227: Report invalid, nested, multi-segment crate-paths r=matklad a=djrenren There was a bug in the previous path-validating code that didn't detect multi-segment paths that started with `crate`. ```rust // Successfully reported use foo::{crate}; // BUG: was not being reported use foo::{crate::bar}; ``` This was due to my confusion about path-associativity. That is, the path with no qualifier is the innermost path, not the outermost. I've updated the code with a lot of comments to explain what's going on. This bug was discovered when I found an erroneous `ok` test which I reported here: https://github.com/rust-analyzer/rust-analyzer/issues/4226 This test now fails and has been modified, hopefully in the spirit of the original test, to be correct. Sorry about submitting the bug in the first place! Co-authored-by: John Renner <[email protected]>
| * Report invalid, nested, multi-segment crate-pathsJohn Renner2020-04-301-1/+1
| | | | | | | | | | | | | | | | | | | | Specifically, things like: use foo::{crate::bar}; Are now being caught, when before we only caught: use foo::{crate};
* | Special-case try macro_rulesEdwin Cheng2020-04-301-0/+11
|/
* Special-case try macro to better support 2015 editionAleksey Kladov2020-04-301-0/+16
|
* Align grammar for record patterns and literalsAleksey Kladov2020-04-111-27/+23
| | | | | | The grammar now looks like this [name_ref :] pat
* Make records grammar more orthogonalAleksey Kladov2020-04-111-12/+25
| | | | | | | | | | | | We used name [: expr] grammar before, now it is [name :] expr which makes things simpler
* Rename some tokensAleksey Kladov2020-04-102-3/+15
|
* Add L_DOLLAR for TYPE_RECOVERY_SETEdwin Cheng2020-04-081-1/+1
|
* Macro patterns are not confused with expressions.Aleksey Kladov2020-04-031-2/+2
| | | | | | | | | | | We treat macro calls as expressions (there's appropriate Into impl), which causes problem if there's expresison and non-expression macro in the same node (like in the match arm). We fix this problem by nesting macor patterns into another node (the same way we nest path into PathExpr or PathPat). Ideally, we probably should add a similar nesting for macro expressions, but that needs some careful thinking about macros in blocks: `{ am_i_expression!() }`.
* CleanupsAleksey Kladov2020-04-032-14/+13
|
* Fix parsing lambdas with return typeAleksey Kladov2020-03-251-7/+13
| | | | | | | We should eat only a single block, and not whatever larger expression may start with a block. closes #3721
* Support arbitrary discriminantsAleksey Kladov2020-03-201-4/+6
| | | | Closes #3661
* Better fix for stuck parser?Florian Diebold2020-03-161-3/+3
|
* Get tests workingFlorian Diebold2020-03-161-2/+2
|
* Parse variadics correctlyAleksey Kladov2020-03-131-11/+33
| | | | closes #3571
* Move verbose tests out of lineAleksey Kladov2020-03-131-20/+2
|
* Fix parsing of stement-ish binary expressionsAleksey Kladov2020-03-111-2/+8
| | | | closes #3512
* Rename ast::ImplBlock -> ast::ImplDefAleksey Kladov2020-02-292-5/+5
|
* Parse attr in rhs of let stmtsEdwin Cheng2020-02-281-1/+2
|
* More manual clippy fixesKirill Bulatov2020-02-181-1/+1
|
* Run cargo +nightly fix --clippy -Z unstable-optionsKirill Bulatov2020-02-182-5/+3
|
* Add test for unnamed argument in function pointerHan Mertens2020-02-121-0/+3
|
* Support unnamed arguments in function pointersHan Mertens2020-02-121-1/+1
| | | | Fixes #3089
* Address review commentsMatthew Jasper2020-02-101-7/+8
|
* Add or- and parenthesized-patternsMatthew Jasper2020-02-093-14/+60
|
* Merge #3047bors[bot]2020-02-071-9/+9
|\ | | | | | | | | | | | | | | | | | | | | | | 3047: Update async unsafe fn ordering in parser r=matklad a=kiljacken As of rust-lang/rust#61319 the correct order for functions that are both unsafe and async is: `async unsafe fn` and not `unsafe async fn`. This commit updates the parser tests to reflect this, and corrects parsing behavior to accept the correct ordering. Fixes #3025 Co-authored-by: Emil Lauridsen <[email protected]>
| * Update async unsafe fn ordering.Emil Lauridsen2020-02-071-9/+9
| | | | | | | | | | | | | | | | | | | | As of rust-lang/rust#61319 the correct order for functions that are both unsafe and async is: `async unsafe fn` and not `unsafe async fn`. This commit updates the parser tests to reflect this, and corrects parsing behavior to accept the correct ordering. Fixes #3025
* | PR tweaksToby Dimmick2020-02-073-21/+18
| |
* | Closure params testToby Dimmick2020-02-061-0/+4
| |
* | rustfmtToby Dimmick2020-02-061-2/+2
| |
* | Rework value parameter parsingToby Dimmick2020-02-065-55/+73
|/ | | | | | | - `Fn__(...)` parameters with idents/patterns no longer parse - Trait function parameters with arbitrary patterns parse - Trait function parameters without idents/patterns no longer parse - `fn(...)` parameters no longer parse with patterns other than a single ident
* Nest attrs into exprs in function argsAleksey Kladov2020-01-171-4/+1
|
* Extract expr_with_attrsAleksey Kladov2020-01-172-13/+22
|
* Merge pull request #2813 from jyn514/arg_attributesAleksey Kladov2020-01-171-0/+5
|\ | | | | Allow attributes before function arguments
| * move inline function closer to relevant codeJoshua Nelson2020-01-171-4/+4
| | | | | | | | also updates generated inline tests
| * shrink inline tesJoshua Nelson2020-01-161-9/+3
| |
| * Allow attributes before function argumentsJoshua Nelson2020-01-121-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds support for function calls of the form: ```rust ( #[attr(...)] 1.2, #[attr_one(...)] #[attr_two(...)] 1.5, ... etc ... ) ``` Closes https://github.com/rust-analyzer/rust-analyzer/issues/2801
* | Minimize testAleksey Kladov2020-01-161-13/+3
| |
* | Simplify array parsingAleksey Kladov2020-01-162-48/+31
| |
* | fix formatingEdwin Cheng2020-01-161-1/+1
| |
* | Fix array element attribute positionEdwin Cheng2020-01-163-8/+32
|/
* Parse trait aliasesEmil Lauridsen2020-01-091-0/+10
|
* Improve const generics parsingMichael Chesser2020-01-062-2/+13
| | | | | - Handle const generics type args - Fix issue with const generic as first parameter in trait impl
* Merge #2642bors[bot]2019-12-221-1/+1
|\ | | | | | | | | | | | | | | 2642: Use name instead of ident in parser for macro 2.0 syntax r=matklad a=edwin0cheng Co-authored-by: Edwin Cheng <[email protected]>
| * Use name instead of ident for macro 2.0 sytnaxEdwin Cheng2019-12-221-1/+1
| |
* | Merge #2641bors[bot]2019-12-221-0/+11
|\ \ | |/ |/| | | | | | | | | | | | | | | | | 2641: Parse const generics r=matklad a=roblabla Adds very primitive support for parsing const generics (`const IDENT: TY`) so that rust-analyzer stops complaining about the syntax being invalid. Fixes #1574 Fixes #2281 Co-authored-by: roblabla <[email protected]>
| * Parse const genericsroblabla2019-12-221-0/+11
| | | | | | | | | | Fixes #1574 Fixes #2281
* | Add macro keyword to ITEM_RECOVERY_SETEdwin Cheng2019-12-211-1/+1
| |