aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_parser
Commit message (Collapse)AuthorAgeFilesLines
* Remove parse error on array initializer attributesRyan Cumming2019-06-301-11/+0
| | | | | This is actually allowed by the `rustc` parser but most attributes will fail later due to attributes on expressions being experimental.
* Support attributes on array membersRyan Cumming2019-06-301-0/+28
| | | | | | | | | | | | Array members are allow to have attributes such as `#[cfg]`. This is a bit tricky as we don't know if the first expression is an initializer or a member until we encounter a `;`. This reuses a trick from `stmt` where we remember if we saw an attribute and then raise an error if the first expression ends up being an initializer. This isn't perfect as the error isn't correctly located on the attribute or initializer; it ends up immediately after the `;`.
* fixed #1384zjy2019-06-282-7/+20
|
* Merge #1415bors[bot]2019-06-241-1/+28
|\ | | | | | | | | | | | | | | | | 1415: fix: specialization r=matklad a=csmoe Closes #1402 r? @matklad Co-authored-by: csmoe <[email protected]>
| * fix: specialization(with blindly parsing)csmoe2019-06-191-1/+28
| | | | | | | | Change-Id: Ic5d2767e8781568d76d4d0013cd6081e95ae8a95
* | fix: box_patterncsmoe2019-06-194-5/+25
| | | | | | | | Change-Id: I45a856d74fb616d3bce33050f9e69d327186bd59
* | fix: box_syntax(#1412)csmoe2019-06-181-0/+5
|/ | | | Change-Id: I6e20e0163fa545de37226c1561b3b7103615626c
* fix: support existential typecsmoe2019-06-122-3/+17
|
* fix: never type with bindingcsmoe2019-06-072-2/+4
| | | | Change-Id: I14e1bc628b9d2dfdb1f40de3d3707f4e872767f2
* [#1083] Try block syntax: fix testsAndrey Tkachenko2019-06-061-7/+7
|
* [#1083] Try block syntaxAndrey Tkachenko2019-06-062-1/+24
|
* Fix clippy::if_same_then_elseAlan Du2019-06-041-0/+1
|
* Fix clippy::match_boolAlan Du2019-06-041-4/+2
|
* Merge #1328bors[bot]2019-05-272-42/+69
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1328: Change TokenSource to iteration based r=matklad a=edwin0cheng This PR change the `TokenSource` trait from random access to be an iteration based trait: ```rust /// `TokenSource` abstracts the source of the tokens parser operates one. /// /// Hopefully this will allow us to treat text and token trees in the same way! pub trait TokenSource { fn current(&self) -> Token; /// Lookahead n token fn lookahead_nth(&self, n: usize) -> Token; /// bump cursor to next token fn bump(&mut self); /// Is the current token a specified keyword? fn is_keyword(&self, kw: &str) -> bool; } /// `TokenCursor` abstracts the cursor of `TokenSource` operates one. #[derive(Debug, Copy, Clone, Eq, PartialEq)] pub struct Token { /// What is the current token? pub kind: SyntaxKind, /// Is the current token joined to the next one (`> >` vs `>>`). pub is_jointed_to_next: bool, } ``` Note that the refactoring based on this new trait will be separated to incoming PRs Co-authored-by: Edwin Cheng <[email protected]>
| * Change TokenSource to iteration basedEdwin Cheng2019-05-252-42/+69
| |
* | reformatAleksey Kladov2019-05-234-8/+8
|/
* apply T! macro where it is possibleSergey Parilin2019-05-1517-458/+457
|
* fixed macro for bracketsSergey Parilin2019-05-152-3/+3
|
* Implemented T! macro for syntax kindsSergey Parilin2019-05-134-0/+111
|
* Skip Dollars when bump raw tokenEdwin Cheng2019-05-011-1/+9
|
* Add macro pat parsingEdwin Cheng2019-04-301-1/+10
|
* Refactor parser handle mult-char punct internallyEdwin Cheng2019-04-282-5/+61
|
* Simplifykjeremy2019-04-261-6/+6
|
* Fix more bugsEdwin Cheng2019-04-251-1/+16
|
* Add `...` parsing for fn pointer typeEdwin Cheng2019-04-232-2/+3
|
* Add vis matcherEdwin Cheng2019-04-192-1/+8
|
* add block matcherEdwin Cheng2019-04-192-0/+31
|
* Add block matcherEdwin Cheng2019-04-192-0/+9
|
* Add expr, pat, ty and macro_stmtsEdwin Cheng2019-04-183-10/+58
|
* Add MacroItems and MacroStmts in grammer.ronEdwin Cheng2019-04-183-0/+14
|
* Add `item` matcher in mbeEdwin Cheng2019-04-182-0/+9
|
* Add mbe stmt matcherEdwin Cheng2019-04-173-72/+91
|
* Merge #1138bors[bot]2019-04-146-23/+168
|\ | | | | | | | | | | | | | | | | | | | | 1138: Add L_DOLLAR and R_DOLLAR r=matklad a=edwin0cheng As discussion in issue https://github.com/rust-analyzer/rust-analyzer/issues/1132 and PR #1125 , this PR add 2 `Syntax::Kind` : `L_DOLLAR` and `R_DOLLAR` for representing `Delimiter::None` in mbe and proc_marco. By design, It should not affect the final syntax tree, and will be discard in `TreeSink`. My original idea is handling these 2 tokens case by case, but i found that they will appear in every place in the parser (imagine `tt` matcher). So this PR only handle it in `Parser::do_bump` and `Parser::start`, although It will not fix the `expr` matcher executing order problem in original idea. Co-authored-by: Edwin Cheng <[email protected]>
| * Fix bug and add expr , pat , ty matcherEdwin Cheng2019-04-145-30/+159
| |
| * Remove skip Delimiter::None and handle DollarsEdwin Cheng2019-04-121-0/+12
| |
| * Add L_DOLLAR and R_DOLLAREdwin Cheng2019-04-111-0/+4
| |
* | migrate to untyped rowanAleksey Kladov2019-04-092-0/+36
|/
* Merge #1105bors[bot]2019-04-082-0/+12
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1105: [WIP] Implement ra_mbe meta variables support r=matklad a=edwin0cheng This PR implements the following meta variable support in `ra_mba` crate (issue #720): - [x] `path` - [ ] `expr` - [ ] `ty` - [ ] `pat` - [ ] `stmt` - [ ] `block` - [ ] `meta` - [ ] `item` *Implementation Details* In the macro expanding lhs phase, if we see a meta variable type, we try to create a `tt:TokenTree` from the remaining input. And then we use a special set of `ra_parser` to parse it to `SyntaxNode`. Co-authored-by: Edwin Cheng <[email protected]>
| * Add TtCursorTokenSource and TtCursorTokenSinkEdwin Cheng2019-04-062-0/+12
| |
* | Parse and infer tuple indicesrobojumper2019-04-061-1/+12
|/
* Parse unsafe async / const unsafe fns properlyrobojumper2019-04-031-6/+17
|
* Merge #1082bors[bot]2019-04-011-0/+1
|\ | | | | | | | | | | | | | | 1082: Async block in argument position r=matklad a=andreytkachenko Fixes case when async block appears in argument position Co-authored-by: Andrey Tkachenko <[email protected]>
| * Async block in argument positionAndrey Tkachenko2019-04-011-0/+1
| |
* | Merge #1081bors[bot]2019-04-012-3/+13
|\ \ | |/ |/| | | | | | | | | | | | | | | 1081: Async closure syntax r=matklad a=robojumper Fixes #1080. Also fixes an error introduced by #1072 where something like `async move "foo"` in expression position would trigger the assertion in `block_expr`. Co-authored-by: robojumper <[email protected]>
| * Async closure syntaxrobojumper2019-03-312-3/+13
| |
* | switch to new rowanAleksey Kladov2019-04-012-7/+7
|/
* Add WherePred to allow predicate access in WhereClauseVille Penttinen2019-03-311-1/+1
| | | | | This also unifies parsing of WHERE_PRED bounds, now Lifetime bounds will also be parsed using TYPE_BOUND_LIST
* Merge #1072bors[bot]2019-03-312-3/+3
|\ | | | | | | | | | | | | | | 1072: recognize async move blocks r=matklad a=memoryruins closes #1053 Co-authored-by: memoryruins <[email protected]>
| * recognize async movememoryruins2019-03-282-3/+3
| |
* | Change parsing bounds in path_typesVille Penttinen2019-03-312-11/+40
| | | | | | | | | | | | | | | | Now bounds inside a path are parsed as DYN_TRAIT_TYPE, previously they would be parsed as `PATH_TYPE` followed by `TYPE_BOUND_LIST`. Basically this means `Box<T + 'f>` is now parsed almost the same as `Box<dyn T + 'f>` with the exception of not having the `dyn` keyword.