aboutsummaryrefslogtreecommitdiff
path: root/crates/syntax
Commit message (Collapse)AuthorAgeFilesLines
...
| * Fixed typos in code assertsVincent Esche2021-01-091-1/+1
| |
| * Fixed typos in code commentsVincent Esche2021-01-092-5/+5
| |
* | Merge #7239bors[bot]2021-01-101-1/+1
|\ \ | | | | | | | | | | | | | | | | | | | | | 7239: Replace SyntaxKind usage with T! macro where applicable r=lnicola a=Veykril https://github.com/rust-analyzer/rust-analyzer/blob/master/docs/dev/style.md#token-names Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
| * | Replace SyntaxKind usage with T! macro where applicableLukas Wirth2021-01-101-1/+1
| | |
* | | Fix typo, parentheses is pluralLaurențiu Nicola2021-01-101-2/+2
|/ /
* / Allow `true` and `false` keywords in const genericsCallym2021-01-102-10/+20
|/
* Change <|> to $0 - RebaseKevaundray Wedderburn2021-01-072-29/+29
|
* Rename expr -> tail_exprAleksey Kladov2021-01-052-2/+2
|
* Update crateskjeremy2021-01-041-1/+1
|
* Merge #6587bors[bot]2021-01-0430-0/+227
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 6587: SSR: Support statement matching and replacing r=davidlattimore a=MarijnS95 For #3186 Hi! This is a smaller initial patchset that came up while working on support for statement lists (and my first time working on RA :grin:). It has me stuck on trailing semicolons for which I hope to receive some feedback. Matching (and replacing) `let` bindings with a trailing semicolon works fine, but trying to omit these (to make patterns more ergonomic) turns out more complex than expected. The "optional trailing semicolon solution" implemented in this PR is ugly because `Matcher::attempt_match_token` should only consume a trailing `;` when parsing `let` bindings to prevent other code from breaking. That at the same time has a nasty side-effect of `;` ending up in the matched code: any replacements on that should include the trailing semicolon as well even if it was not in the pattern. A better example is in the tests: https://github.com/rust-analyzer/rust-analyzer/blob/3ae1649c24a689473b874c331f5f176e5839978e/crates/ssr/src/tests.rs#L178-L184 The end result to achieve is (I guess) allowing replacement of let bindings without trailing semicolon like `let x = $a ==>> let x = 1` (but including them on both sides is still fine), and should make replacement in a macro call (where `foo!(let a = 2;)` for a `$x:stmt` is invalid syntax) possible as well. That should allow to enable/fix these tests: https://github.com/rust-analyzer/rust-analyzer/blob/3ae1649c24a689473b874c331f5f176e5839978e/crates/ssr/src/tests.rs#L201-L214 A possible MVP of this PR might be to drop this optional `;' handling entirely and only allow an SSR pattern/template with semicolons on either side. Co-authored-by: Marijn Suijten <marijn@traverseresearch.nl>
| * parser,syntax: Add separate parser for stmt with optional semicolonMarijn Suijten2021-01-0313-5/+66
| | | | | | | | | | Adjusting `grammar::fragments::stmt` to Optional or Yes will break original functionality and tests.
| * syntax,ssr: Implement statement parsingMarijn Suijten2021-01-0330-0/+166
| |
* | Upgrade expect-test to 1.1Jesse Bakker2021-01-031-1/+1
|/
* Fix warnings on rust-nightlycynecx2021-01-021-2/+2
|
* Update crateskjeremy2020-12-301-1/+1
|
* indentationAdnoC2020-12-301-3/+3
|
* Smarter bracketed use diagnosticAdnoC2020-12-301-0/+8
|
* Merge #7027bors[bot]2020-12-242-0/+59
|\ | | | | | | | | | | | | | | 7027: Fix macro_rules not accepting brackets or parentheses r=matklad,lnicola a=Veykril Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
| * Fix macro_rules not accepting brackets or parenthesesLukas Wirth2020-12-242-0/+59
| |
* | Merge #7020bors[bot]2020-12-231-0/+4
|\ \ | | | | | | | | | | | | | | | | | | | | | 7020: Implement const pat and expr inference r=flodiebold a=Veykril Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
| * | Implement const block inferenceLukas Wirth2020-12-231-0/+4
| |/
* | Merge #7016bors[bot]2020-12-231-1/+1
|\ \ | |/ |/| | | | | | | | | | | 7016: Bump deps r=flodiebold a=lnicola Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
| * Bump rustc_lexerLaurențiu Nicola2020-12-231-1/+1
| |
* | Merge #7010bors[bot]2020-12-235-1/+136
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 7010: Update ungrammar for const block patterns r=matklad a=Veykril Fixes #6848 Adds const blocks and const block patterns to the AST and parses them. Blocked on https://github.com/rust-analyzer/ungrammar/pull/17/, will merge that PR there once this one gets the OK so I can remove the local ungrammar dependency path and fix the Cargo.lock. Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
| * | Parse const effect blockLukas Wirth2020-12-232-0/+24
| | |
| * | Parse ConstBlockPatLukas Wirth2020-12-232-0/+80
| | |
| * | Update ungrammar for const block patternsLukas Wirth2020-12-231-1/+32
| |/
* / Document `make` module designAleksey Kladov2020-12-231-1/+7
|/
* Merge #6965bors[bot]2020-12-215-135/+186
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 6965: Properly attach attributes to Param instead of parent ParamList r=matklad a=Veykril Fixes #2783, fixes #2781 The problem with `let _a = [0,#[cfg(feature = "L")]0];` has already been fixed some time ago it seems: <details> <summary>Syntax Tree for the const item</summary> ``` LET_STMT@200..236 LET_KW@200..203 "let" WHITESPACE@203..204 " " IDENT_PAT@204..206 NAME@204..206 IDENT@204..206 "_a" WHITESPACE@206..207 " " EQ@207..208 "=" WHITESPACE@208..209 " " ARRAY_EXPR@209..235 L_BRACK@209..210 "[" LITERAL@210..211 INT_NUMBER@210..211 "0" COMMA@211..212 "," LITERAL@212..234 ATTR@212..233 POUND@212..213 "#" L_BRACK@213..214 "[" PATH@214..217 PATH_SEGMENT@214..217 NAME_REF@214..217 IDENT@214..217 "cfg" TOKEN_TREE@217..232 L_PAREN@217..218 "(" IDENT@218..225 "feature" WHITESPACE@225..226 " " EQ@226..227 "=" WHITESPACE@227..228 " " STRING@228..231 "\"L\"" R_PAREN@231..232 ")" R_BRACK@232..233 "]" INT_NUMBER@233..234 "0" R_BRACK@234..235 "]" SEMICOLON@235..236 ";" ``` </details> Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
| * Parse attributes in tuple expressionsLukas Wirth2020-12-202-0/+51
| |
| * Properly attach attributes to Param instead of parent ParamListLukas Wirth2020-12-203-135/+135
| |
* | Properly parse legacy trait objects with leading ForTypeLukas Wirth2020-12-202-0/+44
|/
* Merge #6934bors[bot]2020-12-181-0/+7
|\ | | | | | | | | | | | | | | 6934: Implement `cfg_attr` handling r=jonas-schievink a=jonas-schievink Part of https://github.com/rust-analyzer/rust-analyzer/issues/5548 Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
| * Implement `RawAttr::filter`Jonas Schievink2020-12-181-0/+7
| |
* | Minor, cleanup APIAleksey Kladov2020-12-181-0/+3
|/
* Merge #6896bors[bot]2020-12-1637-174/+316
|\ | | | | | | | | | | | | | | | | | | | | | | 6896: Node-ify lifetimes r=jonas-schievink a=Veykril Let's see if this passes the tests 🤞 Depends on https://github.com/rust-analyzer/ungrammar/pull/15 Co-authored-by: Jonas Schievink <jonasschievink@gmail.com> Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com> Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
| * Node-ify lifetimesLukas Wirth2020-12-1637-174/+316
| |
* | Merge #6897bors[bot]2020-12-164-6/+106
|\| | | | | | | | | | | | | | | | | | | | | | | | | 6897: Basic support for macros 2.0 r=jonas-schievink a=jonas-schievink This adds support for (built-in-only) macros 2.0, and removes some hacks used for builtin derives, which are declared via macros 2.0 in libcore. First steps for https://github.com/rust-analyzer/rust-analyzer/issues/2248. Blocked on https://github.com/rust-analyzer/ungrammar/pull/16. Co-authored-by: Jonas Schievink <jonasschievink@gmail.com> Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
| * Basic support for decl macros 2.0Jonas Schievink2020-12-154-6/+106
| |
* | Merge #6894bors[bot]2020-12-161-0/+3
|\ \ | |/ |/| | | | | | | | | | | 6894: Parenthesize composite if condition before inverting in invert-if assist r=matklad a=Jesse-Bakker Fixes #6867 Co-authored-by: Jesse Bakker <github@jessebakker.com>
| * Parenthesize composite if condition before inverting in invert-if assistJesse Bakker2020-12-151-0/+3
| |
* | Reject visibilities on `macro_rules!`Jonas Schievink2020-12-151-1/+13
| |
* | Move to upstream `macro_rules!` modelJonas Schievink2020-12-159-69/+80
|/
* Remove some redundant allocationsJeremy Kolb2020-12-122-2/+2
|
* Fix accidently quadratic syntax rewriterAleksey Kladov2020-12-101-8/+14
| | | | | | Switching from SyntaxNode to GreenNode is a costly operation (b/c dereferencing a synax ptr in `with_green` is linear), so we should avoid that.
* Properly fetch inner and outer docs on hir-levelLukas Wirth2020-12-091-0/+8
|
* Simplify ast::Comment api surfaceLukas Wirth2020-12-081-10/+15
|
* Keep doc attribute orderLukas Wirth2020-12-072-41/+35
|
* Merge #6719bors[bot]2020-12-074-16/+17
|\ | | | | | | | | | | | | | | 6719: Use items can also have doc comments r=matklad a=Veykril Prior to this change modules show more docs than they have cause they inherit the docs from documented use items inside of them. Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
| * Use items can also have doc commentsLukas Wirth2020-12-044-16/+17
| |