mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[groovy] update dummy elements
- move GroovyDummyElementType inside GroovyDummyElement; - make GroovyDummyElementType private; - extend GroovyDummyElementType from IFileElementType; - make GroovyDummyElement internal.
This commit is contained in:
+17
-1
@@ -1,7 +1,23 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package org.jetbrains.plugins.groovy.lang.psi.impl
|
||||
|
||||
import com.intellij.lang.ASTNode
|
||||
import com.intellij.lang.PsiBuilderFactory
|
||||
import com.intellij.psi.PsiElement
|
||||
import com.intellij.psi.impl.source.tree.FileElement
|
||||
import com.intellij.psi.tree.IElementType
|
||||
import com.intellij.psi.tree.IFileElementType
|
||||
import org.jetbrains.plugins.groovy.GroovyLanguage
|
||||
import org.jetbrains.plugins.groovy.lang.parser.GroovyParser
|
||||
|
||||
class GroovyDummyElement(val childType: IElementType, text: CharSequence) : FileElement(GroovyDummyElementType, text)
|
||||
internal class GroovyDummyElement(private val childType: IElementType, text: CharSequence) : FileElement(GroovyDummyElementType, text) {
|
||||
|
||||
private object GroovyDummyElementType : IFileElementType("GROOVY_DUMMY_ELEMENT", GroovyLanguage) {
|
||||
|
||||
override fun doParseContents(chameleon: ASTNode, psi: PsiElement): ASTNode {
|
||||
val builder = PsiBuilderFactory.getInstance().createBuilder(psi.project, chameleon)
|
||||
val dummyElement = chameleon as GroovyDummyElement
|
||||
return GroovyParser().parse(dummyElement.childType, builder)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
-18
@@ -1,18 +0,0 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package org.jetbrains.plugins.groovy.lang.psi.impl
|
||||
|
||||
import com.intellij.lang.ASTNode
|
||||
import com.intellij.lang.PsiBuilderFactory
|
||||
import com.intellij.psi.tree.ILazyParseableElementType
|
||||
import org.jetbrains.plugins.groovy.GroovyLanguage
|
||||
import org.jetbrains.plugins.groovy.lang.parser.GroovyParser
|
||||
|
||||
object GroovyDummyElementType : ILazyParseableElementType("GROOVY_DUMMY_ELEMENT", GroovyLanguage) {
|
||||
|
||||
override fun parseContents(chameleon: ASTNode): ASTNode {
|
||||
val dummyElement = chameleon as GroovyDummyElement
|
||||
val builder = PsiBuilderFactory.getInstance().createBuilder(chameleon.psi.project, chameleon)
|
||||
GroovyParser().parseLight(dummyElement.childType, builder)
|
||||
return builder.treeBuilt
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user