forked from intellij-rust/intellij-rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GRAM: support if_while_or_patterns syntax
See rust-lang/rust#57532 for more details
- Loading branch information
1 parent
74ee70f
commit f8000ad
Showing
9 changed files
with
423 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
src/test/resources/org/rust/lang/core/parser/fixtures/complete/conditions.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
fn main() { | ||
if 1 < 2 {} | ||
if let Some(x) = o {} | ||
if let | Err(e) = r {} | ||
if let V1(s) | V2(s) = value {} | ||
if let | Cat(name) | Dog(name) | Parrot(name) = animal {} | ||
|
||
while 1 < 2 {} | ||
while let Some(x) = o {} | ||
while let | Err(e) = r {} | ||
while let V1(s) | V2(s) = value {} | ||
while let | Cat(name) | Dog(name) | Parrot(name) = animal {} | ||
} |
340 changes: 340 additions & 0 deletions
340
src/test/resources/org/rust/lang/core/parser/fixtures/complete/conditions.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,340 @@ | ||
FILE | ||
RsFunctionImpl(FUNCTION) | ||
PsiElement(fn)('fn') | ||
PsiWhiteSpace(' ') | ||
PsiElement(identifier)('main') | ||
RsValueParameterListImpl(VALUE_PARAMETER_LIST) | ||
PsiElement(()('(') | ||
PsiElement())(')') | ||
PsiWhiteSpace(' ') | ||
RsBlockImpl(BLOCK) | ||
PsiElement({)('{') | ||
PsiWhiteSpace('\n ') | ||
RsExprStmtImpl(EXPR_STMT) | ||
RsIfExprImpl(IF_EXPR) | ||
PsiElement(if)('if') | ||
PsiWhiteSpace(' ') | ||
RsConditionImpl(CONDITION) | ||
RsBinaryExprImpl(BINARY_EXPR) | ||
RsLitExprImpl(LIT_EXPR) | ||
PsiElement(INTEGER_LITERAL)('1') | ||
PsiWhiteSpace(' ') | ||
RsBinaryOpImpl(BINARY_OP) | ||
PsiElement(<)('<') | ||
PsiWhiteSpace(' ') | ||
RsLitExprImpl(LIT_EXPR) | ||
PsiElement(INTEGER_LITERAL)('2') | ||
PsiWhiteSpace(' ') | ||
RsBlockImpl(BLOCK) | ||
PsiElement({)('{') | ||
PsiElement(})('}') | ||
PsiWhiteSpace('\n ') | ||
RsExprStmtImpl(EXPR_STMT) | ||
RsIfExprImpl(IF_EXPR) | ||
PsiElement(if)('if') | ||
PsiWhiteSpace(' ') | ||
RsConditionImpl(CONDITION) | ||
PsiElement(let)('let') | ||
PsiWhiteSpace(' ') | ||
RsOrPatsImpl(OR_PATS) | ||
RsPatTupleStructImpl(PAT_TUPLE_STRUCT) | ||
RsPathImpl(PATH) | ||
PsiElement(identifier)('Some') | ||
PsiElement(()('(') | ||
RsPatIdentImpl(PAT_IDENT) | ||
RsPatBindingImpl(PAT_BINDING) | ||
PsiElement(identifier)('x') | ||
PsiElement())(')') | ||
PsiWhiteSpace(' ') | ||
PsiElement(=)('=') | ||
PsiWhiteSpace(' ') | ||
RsPathExprImpl(PATH_EXPR) | ||
RsPathImpl(PATH) | ||
PsiElement(identifier)('o') | ||
PsiWhiteSpace(' ') | ||
RsBlockImpl(BLOCK) | ||
PsiElement({)('{') | ||
PsiElement(})('}') | ||
PsiWhiteSpace('\n ') | ||
RsExprStmtImpl(EXPR_STMT) | ||
RsIfExprImpl(IF_EXPR) | ||
PsiElement(if)('if') | ||
PsiWhiteSpace(' ') | ||
RsConditionImpl(CONDITION) | ||
PsiElement(let)('let') | ||
PsiWhiteSpace(' ') | ||
RsOrPatsImpl(OR_PATS) | ||
PsiElement(|)('|') | ||
PsiWhiteSpace(' ') | ||
RsPatTupleStructImpl(PAT_TUPLE_STRUCT) | ||
RsPathImpl(PATH) | ||
PsiElement(identifier)('Err') | ||
PsiElement(()('(') | ||
RsPatIdentImpl(PAT_IDENT) | ||
RsPatBindingImpl(PAT_BINDING) | ||
PsiElement(identifier)('e') | ||
PsiElement())(')') | ||
PsiWhiteSpace(' ') | ||
PsiElement(=)('=') | ||
PsiWhiteSpace(' ') | ||
RsPathExprImpl(PATH_EXPR) | ||
RsPathImpl(PATH) | ||
PsiElement(identifier)('r') | ||
PsiWhiteSpace(' ') | ||
RsBlockImpl(BLOCK) | ||
PsiElement({)('{') | ||
PsiElement(})('}') | ||
PsiWhiteSpace('\n ') | ||
RsExprStmtImpl(EXPR_STMT) | ||
RsIfExprImpl(IF_EXPR) | ||
PsiElement(if)('if') | ||
PsiWhiteSpace(' ') | ||
RsConditionImpl(CONDITION) | ||
PsiElement(let)('let') | ||
PsiWhiteSpace(' ') | ||
RsOrPatsImpl(OR_PATS) | ||
RsPatTupleStructImpl(PAT_TUPLE_STRUCT) | ||
RsPathImpl(PATH) | ||
PsiElement(identifier)('V1') | ||
PsiElement(()('(') | ||
RsPatIdentImpl(PAT_IDENT) | ||
RsPatBindingImpl(PAT_BINDING) | ||
PsiElement(identifier)('s') | ||
PsiElement())(')') | ||
PsiWhiteSpace(' ') | ||
PsiElement(|)('|') | ||
PsiWhiteSpace(' ') | ||
RsPatTupleStructImpl(PAT_TUPLE_STRUCT) | ||
RsPathImpl(PATH) | ||
PsiElement(identifier)('V2') | ||
PsiElement(()('(') | ||
RsPatIdentImpl(PAT_IDENT) | ||
RsPatBindingImpl(PAT_BINDING) | ||
PsiElement(identifier)('s') | ||
PsiElement())(')') | ||
PsiWhiteSpace(' ') | ||
PsiElement(=)('=') | ||
PsiWhiteSpace(' ') | ||
RsPathExprImpl(PATH_EXPR) | ||
RsPathImpl(PATH) | ||
PsiElement(identifier)('value') | ||
PsiWhiteSpace(' ') | ||
RsBlockImpl(BLOCK) | ||
PsiElement({)('{') | ||
PsiElement(})('}') | ||
PsiWhiteSpace('\n ') | ||
RsExprStmtImpl(EXPR_STMT) | ||
RsIfExprImpl(IF_EXPR) | ||
PsiElement(if)('if') | ||
PsiWhiteSpace(' ') | ||
RsConditionImpl(CONDITION) | ||
PsiElement(let)('let') | ||
PsiWhiteSpace(' ') | ||
RsOrPatsImpl(OR_PATS) | ||
PsiElement(|)('|') | ||
PsiWhiteSpace(' ') | ||
RsPatTupleStructImpl(PAT_TUPLE_STRUCT) | ||
RsPathImpl(PATH) | ||
PsiElement(identifier)('Cat') | ||
PsiElement(()('(') | ||
RsPatIdentImpl(PAT_IDENT) | ||
RsPatBindingImpl(PAT_BINDING) | ||
PsiElement(identifier)('name') | ||
PsiElement())(')') | ||
PsiWhiteSpace(' ') | ||
PsiElement(|)('|') | ||
PsiWhiteSpace(' ') | ||
RsPatTupleStructImpl(PAT_TUPLE_STRUCT) | ||
RsPathImpl(PATH) | ||
PsiElement(identifier)('Dog') | ||
PsiElement(()('(') | ||
RsPatIdentImpl(PAT_IDENT) | ||
RsPatBindingImpl(PAT_BINDING) | ||
PsiElement(identifier)('name') | ||
PsiElement())(')') | ||
PsiWhiteSpace(' ') | ||
PsiElement(|)('|') | ||
PsiWhiteSpace(' ') | ||
RsPatTupleStructImpl(PAT_TUPLE_STRUCT) | ||
RsPathImpl(PATH) | ||
PsiElement(identifier)('Parrot') | ||
PsiElement(()('(') | ||
RsPatIdentImpl(PAT_IDENT) | ||
RsPatBindingImpl(PAT_BINDING) | ||
PsiElement(identifier)('name') | ||
PsiElement())(')') | ||
PsiWhiteSpace(' ') | ||
PsiElement(=)('=') | ||
PsiWhiteSpace(' ') | ||
RsPathExprImpl(PATH_EXPR) | ||
RsPathImpl(PATH) | ||
PsiElement(identifier)('animal') | ||
PsiWhiteSpace(' ') | ||
RsBlockImpl(BLOCK) | ||
PsiElement({)('{') | ||
PsiElement(})('}') | ||
PsiWhiteSpace('\n\n ') | ||
RsExprStmtImpl(EXPR_STMT) | ||
RsWhileExprImpl(WHILE_EXPR) | ||
PsiElement(while)('while') | ||
PsiWhiteSpace(' ') | ||
RsConditionImpl(CONDITION) | ||
RsBinaryExprImpl(BINARY_EXPR) | ||
RsLitExprImpl(LIT_EXPR) | ||
PsiElement(INTEGER_LITERAL)('1') | ||
PsiWhiteSpace(' ') | ||
RsBinaryOpImpl(BINARY_OP) | ||
PsiElement(<)('<') | ||
PsiWhiteSpace(' ') | ||
RsLitExprImpl(LIT_EXPR) | ||
PsiElement(INTEGER_LITERAL)('2') | ||
PsiWhiteSpace(' ') | ||
RsBlockImpl(BLOCK) | ||
PsiElement({)('{') | ||
PsiElement(})('}') | ||
PsiWhiteSpace('\n ') | ||
RsExprStmtImpl(EXPR_STMT) | ||
RsWhileExprImpl(WHILE_EXPR) | ||
PsiElement(while)('while') | ||
PsiWhiteSpace(' ') | ||
RsConditionImpl(CONDITION) | ||
PsiElement(let)('let') | ||
PsiWhiteSpace(' ') | ||
RsOrPatsImpl(OR_PATS) | ||
RsPatTupleStructImpl(PAT_TUPLE_STRUCT) | ||
RsPathImpl(PATH) | ||
PsiElement(identifier)('Some') | ||
PsiElement(()('(') | ||
RsPatIdentImpl(PAT_IDENT) | ||
RsPatBindingImpl(PAT_BINDING) | ||
PsiElement(identifier)('x') | ||
PsiElement())(')') | ||
PsiWhiteSpace(' ') | ||
PsiElement(=)('=') | ||
PsiWhiteSpace(' ') | ||
RsPathExprImpl(PATH_EXPR) | ||
RsPathImpl(PATH) | ||
PsiElement(identifier)('o') | ||
PsiWhiteSpace(' ') | ||
RsBlockImpl(BLOCK) | ||
PsiElement({)('{') | ||
PsiElement(})('}') | ||
PsiWhiteSpace('\n ') | ||
RsExprStmtImpl(EXPR_STMT) | ||
RsWhileExprImpl(WHILE_EXPR) | ||
PsiElement(while)('while') | ||
PsiWhiteSpace(' ') | ||
RsConditionImpl(CONDITION) | ||
PsiElement(let)('let') | ||
PsiWhiteSpace(' ') | ||
RsOrPatsImpl(OR_PATS) | ||
PsiElement(|)('|') | ||
PsiWhiteSpace(' ') | ||
RsPatTupleStructImpl(PAT_TUPLE_STRUCT) | ||
RsPathImpl(PATH) | ||
PsiElement(identifier)('Err') | ||
PsiElement(()('(') | ||
RsPatIdentImpl(PAT_IDENT) | ||
RsPatBindingImpl(PAT_BINDING) | ||
PsiElement(identifier)('e') | ||
PsiElement())(')') | ||
PsiWhiteSpace(' ') | ||
PsiElement(=)('=') | ||
PsiWhiteSpace(' ') | ||
RsPathExprImpl(PATH_EXPR) | ||
RsPathImpl(PATH) | ||
PsiElement(identifier)('r') | ||
PsiWhiteSpace(' ') | ||
RsBlockImpl(BLOCK) | ||
PsiElement({)('{') | ||
PsiElement(})('}') | ||
PsiWhiteSpace('\n ') | ||
RsExprStmtImpl(EXPR_STMT) | ||
RsWhileExprImpl(WHILE_EXPR) | ||
PsiElement(while)('while') | ||
PsiWhiteSpace(' ') | ||
RsConditionImpl(CONDITION) | ||
PsiElement(let)('let') | ||
PsiWhiteSpace(' ') | ||
RsOrPatsImpl(OR_PATS) | ||
RsPatTupleStructImpl(PAT_TUPLE_STRUCT) | ||
RsPathImpl(PATH) | ||
PsiElement(identifier)('V1') | ||
PsiElement(()('(') | ||
RsPatIdentImpl(PAT_IDENT) | ||
RsPatBindingImpl(PAT_BINDING) | ||
PsiElement(identifier)('s') | ||
PsiElement())(')') | ||
PsiWhiteSpace(' ') | ||
PsiElement(|)('|') | ||
PsiWhiteSpace(' ') | ||
RsPatTupleStructImpl(PAT_TUPLE_STRUCT) | ||
RsPathImpl(PATH) | ||
PsiElement(identifier)('V2') | ||
PsiElement(()('(') | ||
RsPatIdentImpl(PAT_IDENT) | ||
RsPatBindingImpl(PAT_BINDING) | ||
PsiElement(identifier)('s') | ||
PsiElement())(')') | ||
PsiWhiteSpace(' ') | ||
PsiElement(=)('=') | ||
PsiWhiteSpace(' ') | ||
RsPathExprImpl(PATH_EXPR) | ||
RsPathImpl(PATH) | ||
PsiElement(identifier)('value') | ||
PsiWhiteSpace(' ') | ||
RsBlockImpl(BLOCK) | ||
PsiElement({)('{') | ||
PsiElement(})('}') | ||
PsiWhiteSpace('\n ') | ||
RsWhileExprImpl(WHILE_EXPR) | ||
PsiElement(while)('while') | ||
PsiWhiteSpace(' ') | ||
RsConditionImpl(CONDITION) | ||
PsiElement(let)('let') | ||
PsiWhiteSpace(' ') | ||
RsOrPatsImpl(OR_PATS) | ||
PsiElement(|)('|') | ||
PsiWhiteSpace(' ') | ||
RsPatTupleStructImpl(PAT_TUPLE_STRUCT) | ||
RsPathImpl(PATH) | ||
PsiElement(identifier)('Cat') | ||
PsiElement(()('(') | ||
RsPatIdentImpl(PAT_IDENT) | ||
RsPatBindingImpl(PAT_BINDING) | ||
PsiElement(identifier)('name') | ||
PsiElement())(')') | ||
PsiWhiteSpace(' ') | ||
PsiElement(|)('|') | ||
PsiWhiteSpace(' ') | ||
RsPatTupleStructImpl(PAT_TUPLE_STRUCT) | ||
RsPathImpl(PATH) | ||
PsiElement(identifier)('Dog') | ||
PsiElement(()('(') | ||
RsPatIdentImpl(PAT_IDENT) | ||
RsPatBindingImpl(PAT_BINDING) | ||
PsiElement(identifier)('name') | ||
PsiElement())(')') | ||
PsiWhiteSpace(' ') | ||
PsiElement(|)('|') | ||
PsiWhiteSpace(' ') | ||
RsPatTupleStructImpl(PAT_TUPLE_STRUCT) | ||
RsPathImpl(PATH) | ||
PsiElement(identifier)('Parrot') | ||
PsiElement(()('(') | ||
RsPatIdentImpl(PAT_IDENT) | ||
RsPatBindingImpl(PAT_BINDING) | ||
PsiElement(identifier)('name') | ||
PsiElement())(')') | ||
PsiWhiteSpace(' ') | ||
PsiElement(=)('=') | ||
PsiWhiteSpace(' ') | ||
RsPathExprImpl(PATH_EXPR) | ||
RsPathImpl(PATH) | ||
PsiElement(identifier)('animal') | ||
PsiWhiteSpace(' ') | ||
RsBlockImpl(BLOCK) | ||
PsiElement({)('{') | ||
PsiElement(})('}') | ||
PsiWhiteSpace('\n') | ||
PsiElement(})('}') |
Oops, something went wrong.