Skip to content

Commit

Permalink
GRAM: Fix parsing of nested async functions
Browse files Browse the repository at this point in the history
  • Loading branch information
mchernyavsky committed Aug 13, 2019
1 parent e25ceab commit e83838e
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/main/grammars/RustParser.bnf
Expand Up @@ -171,7 +171,7 @@ MetaItemArgs ::= '(' ( [ <<comma_separated_list (LitExpr | MetaItemWithoutTT )>>
// Paths
///////////////////////////////////////////////////////////////////////////////////////////////////

private PathIdent ::= !("union" identifier) identifier | self | super | 'Self' | crate
private PathIdent ::= !("union" identifier | "async" fn) identifier | self | super | 'Self' | crate

fake Path ::= (Path '::' | '::' | TypeQual)? PathIdent PathTypeArguments? {
implements = [ "org.rust.lang.core.psi.ext.RsPathReferenceElement" ]
Expand Down
Expand Up @@ -36,7 +36,7 @@ class RsFileStub : PsiFileStubImpl<RsFile> {

object Type : IStubFileElementType<RsFileStub>(RsLanguage) {
// Bump this number if Stub structure changes
override fun getStubVersion(): Int = 178
override fun getStubVersion(): Int = 179

override fun getBuilder(): StubBuilder = object : DefaultStubBuilder() {
override fun createStubForFile(file: PsiFile): StubElement<*> = RsFileStub(file as RsFile)
Expand Down
Expand Up @@ -23,4 +23,6 @@ fn main() {
async || { () };
async move || { () };
static move || { () };

async fn nested() {}
}
Expand Up @@ -311,5 +311,19 @@ FILE
PsiWhiteSpace(' ')
PsiElement(})('}')
PsiElement(;)(';')
PsiWhiteSpace('\n\n ')
RsFunctionImpl(FUNCTION)
PsiElement(async_kw)('async')
PsiWhiteSpace(' ')
PsiElement(fn)('fn')
PsiWhiteSpace(' ')
PsiElement(identifier)('nested')
RsValueParameterListImpl(VALUE_PARAMETER_LIST)
PsiElement(()('(')
PsiElement())(')')
PsiWhiteSpace(' ')
RsBlockImpl(BLOCK)
PsiElement({)('{')
PsiElement(})('}')
PsiWhiteSpace('\n')
PsiElement(})('}')

0 comments on commit e83838e

Please sign in to comment.