添加stubIndex

This commit is contained in:
me
2024-05-26 13:48:10 +08:00
parent c25144f4b6
commit 9603c24461
51 changed files with 727 additions and 311 deletions

View File

@@ -59,9 +59,8 @@
]
extends(".*Expression")=Expression
implements(".*Keyword")=[
"me.zhouxi.slint.lang.psi.SlintPsiKeywordIdentifier"
]
implements(".*Keyword")=["me.zhouxi.slint.lang.psi.keyword.SlintPsiKeywordIdentifier"]
mixin(".*Keyword")="me.zhouxi.slint.lang.psi.keyword.SlintPsiKeywordIdentifierImpl"
}
//
Document ::= DocumentElement*
@@ -72,28 +71,35 @@ private DocumentElement ::= Import | Struct | Enum | GlobalSingleton | Component
GlobalSingleton ::= ExportKeyword? GlobalKeyword ComponentName ComponentBody {
pin=2
implements=["me.zhouxi.slint.lang.psi.SlintPsiNamedElement"]
mixin="me.zhouxi.slint.lang.psi.impl.SlintPsiNamedElementMixinImpl"
mixin="me.zhouxi.slint.lang.psi.impl.SlintPsiNamedElementImpl"
}
//import 定义
Import ::= ImportKeyword ImportElement? ModuleLocation';'{
Import ::= ImportKeyword (ImportElement|ImportResource)';'{
pin=1
elementTypeFactory="me.zhouxi.slint.lang.psi.stubs.types.SlintStubTypes.slintImport"
stubClass="me.zhouxi.slint.lang.psi.stubs.stub.SlintImportStub"
extends="me.zhouxi.slint.lang.psi.impl.SlintStubBasedPsiElementImpl<?>"
}
private ImportElement ::= '{' ImportedSpecifier (',' ImportedSpecifier)* ','? '}' FromKeyword {
ImportElement ::= '{' ImportSpecifier (',' ImportSpecifier)* ','? '}' FromKeyword ModuleLocation{
pin=1
}
ImportResource ::= ModuleLocation
// ABc as Def
ImportedSpecifier ::= ReferenceIdentifier ImportAlias?{
ImportSpecifier ::= ReferenceIdentifier ImportAlias?{
pin=1
recoverWhile=AliasNameRecover
elementTypeFactory="me.zhouxi.slint.lang.psi.stubs.types.SlintStubTypes.importSpecifier"
stubClass="me.zhouxi.slint.lang.psi.stubs.stub.SlintImportSpecifierStub"
extends="me.zhouxi.slint.lang.psi.impl.SlintStubBasedPsiElementImpl<?>"
}
private AliasNameRecover::=!(','|'}'|';')
ImportAlias ::= AsKeyword InternalName {
pin=1
recoverWhile=AliasNameRecover
implements=["me.zhouxi.slint.lang.psi.SlintPsiNamedElement"]
mixin="me.zhouxi.slint.lang.psi.impl.SlintPsiNamedElementMixinImpl"
extends="me.zhouxi.slint.lang.psi.impl.SlintPsiNamedElementImpl"
}
//Struct 定义
Struct ::= ExportKeyword? StructKeyword TypeName (':=')? StructBody {
@@ -106,14 +112,13 @@ private StructBody ::= '{' FieldDeclarations? '}'{
Enum ::= ExportKeyword? EnumKeyword EnumName '{' (EnumValue (','EnumValue)*','? )? '}'{
pin=2
implements=["me.zhouxi.slint.lang.psi.SlintPsiNamedElement"]
mixin="me.zhouxi.slint.lang.psi.impl.SlintPsiNamedElementMixinImpl"
extends="me.zhouxi.slint.lang.psi.impl.SlintPsiNamedElementImpl"
}
//--------------ExportsList -------------------------------------
//ExportsList
Export ::= ExportKeyword ExportElement {
Export ::= ExportKeyword (ExportType | ExportModule) {
pin=1
}
private ExportElement ::= ExportType | ExportModule
ExportType ::= '{' ExportSpecifier (','ExportSpecifier)* ','? '}'{
pin=1
@@ -121,7 +126,7 @@ ExportType ::= '{' ExportSpecifier (','ExportSpecifier)* ','? '}'{
ExportSpecifier::= ReferenceIdentifier ExportAlias?{
recoverWhile=AliasNameRecover
implements=["me.zhouxi.slint.lang.psi.SlintPsiNamedElement"]
mixin="me.zhouxi.slint.lang.psi.impl.SlintPsiNamedElementMixinImpl"
extends="me.zhouxi.slint.lang.psi.impl.SlintPsiNamedElementImpl"
}
ExportAlias ::= AsKeyword ExternalName{
pin=1
@@ -129,21 +134,15 @@ ExportAlias ::= AsKeyword ExternalName{
ExportModule ::= '*' FromKeyword ModuleLocation ';'{
pin=1
}
//---------- component ------------------------------------------------------------
//Component ::= NewComponent
//| LegacyComponent
//Old syntax
//private LegacyComponent ::=(GlobalKeyword ComponentName ':=' ComponentName? ComponentBody)| ('global'? SubComponent)
Component ::= ExportKeyword? ComponentKeyword ComponentName InheritDeclaration? ComponentBody {
pin=2
implements=[
"me.zhouxi.slint.lang.psi.SlintPsiNamedElement"
"com.intellij.psi.StubBasedPsiElement<me.zhouxi.slint.stubs.stub.SlintComponentStub>"
]
elementTypeClass="me.zhouxi.slint.stubs.types.SlintComponentStubType"
stubClass="me.zhouxi.slint.stubs.stub.SlintComponentStub"
mixin="me.zhouxi.slint.lang.psi.impl.SlintStubBasedPsiNamedElementImpl<me.zhouxi.slint.stubs.stub.SlintComponentStub>"
elementTypeFactory="me.zhouxi.slint.lang.psi.stubs.types.SlintStubTypes.component"
stubClass="me.zhouxi.slint.lang.psi.stubs.stub.SlintComponentStub"
extends="me.zhouxi.slint.lang.psi.impl.SlintStubBasedPsiNamedElementImpl<?>"
}
//组件定义
//private LegacyComponent ::= (ComponentName|NamedIdentifier ':=' ) ComponentBody
@@ -154,12 +153,12 @@ ComponentBody ::= '{' ComponentElement* '}'{
pin=1
}
//组件元素定义
private ComponentElement ::=ChildrenPlaceholder| PropertyDeclaration | CallbackDeclaration
private ComponentElement ::=ChildrenPlaceholder| Property | Callback
| Function | PropertyAnimation | CallbackConnection | Transitions
| PropertyChanged
| States | TwoWayBinding | PropertyBinding | ConditionalElement
| RepetitionElement | SubComponent {
recoverWhile=recoverWhileForComponentBody
recoverWhile(".*")=recoverWhileForComponentBody
}
private recoverWhileForComponentBody::= !(
'property'|'callback'|'changed'
@@ -172,12 +171,16 @@ ChildrenPlaceholder ::= '@' 'children'{
}
//--------------------------------PropertyDeclaration Start----------------------------------------------------
// 属性定义 in property <type> name: value / in property <type> name <=> value
PropertyDeclaration ::= PropertyModifier? PropertyKeyword ('<' Type '>')? PropertyName(PropertyValue|PropertyTwoWayBindingValue|';'){
Property ::= PropertyModifier? PropertyKeyword ('<' Type '>')? PropertyName(PropertyValue|PropertyTwoWayBindingValue|';'){
pin=2
implements=["me.zhouxi.slint.lang.psi.SlintPsiNamedElement"]
mixin="me.zhouxi.slint.lang.psi.impl.SlintPsiNamedElementMixinImpl"
implements=[
"me.zhouxi.slint.lang.psi.SlintPsiNamedElement"
]
elementTypeFactory="me.zhouxi.slint.lang.psi.stubs.types.SlintStubTypes.property"
stubClass="me.zhouxi.slint.lang.psi.stubs.stub.SlintPropertyStub"
extends="me.zhouxi.slint.lang.psi.impl.SlintStubBasedPsiNamedElementImpl<?>"
}
private PropertyModifier ::= InKeyword|OutKeyword|InOutKeyword|PrivateKeyword
PropertyModifier ::= InKeyword|OutKeyword|InOutKeyword|PrivateKeyword
private PropertyValue::= ':' BindingStatement {
pin=1
}
@@ -190,10 +193,10 @@ PropertyChanged ::= ChangedKeyword LocalVariable '=>' CodeBlock{
}
//--------------------------------CallbackDeclaration Start----------------------------------------------------
// 回调定义 pure callback abc()->int; callback abc; callback(..);callback()->type;
CallbackDeclaration ::= PureKeyword? CallbackKeyword FunctionName CallbackBinding? ';'{
Callback ::= PureKeyword? CallbackKeyword FunctionName CallbackBinding? ';'{
pin=2
implements=["me.zhouxi.slint.lang.psi.SlintPsiNamedElement"]
mixin="me.zhouxi.slint.lang.psi.impl.SlintPsiNamedElementMixinImpl"
extends="me.zhouxi.slint.lang.psi.impl.SlintPsiNamedElementImpl"
}
//回调参数定义
CallbackBinding::= CallbackArgument | ('<=>'QualifiedPropertyNameReference)
@@ -215,7 +218,7 @@ TwoWayBinding ::= ReferenceIdentifier '<=>' QualifiedPropertyNameReference ';' {
Function ::= FunctionModifiers? FunctionKeyword FunctionName FunctionArguments ReturnType? CodeBlock{
pin=2
implements=["me.zhouxi.slint.lang.psi.SlintPsiNamedElement"]
mixin="me.zhouxi.slint.lang.psi.impl.SlintPsiNamedElementMixinImpl"
extends="me.zhouxi.slint.lang.psi.impl.SlintPsiNamedElementImpl"
}
private FunctionModifiers ::= ((PublicKeyword | ProtectedKeyword) PureKeyword?) | (PureKeyword (PublicKeyword | ProtectedKeyword)?)
@@ -246,7 +249,7 @@ RepetitionIndex ::= '[' LocalVariable ']'{
//--------------------------------SubElementDeclaration Start---------------------------------------------------
//子组件结构元素定义
SubComponent ::= (PropertyName ':=')? ReferenceIdentifier ComponentBody{
pin=2
}
//--------------------------------TransitionsDeclaration Start---------------------------------------------------
@@ -268,7 +271,7 @@ States ::= StatesKeyword '[' State* ']'{
State ::= LocalVariable StateCondition? ':' '{' StateItem* '}' {
pin=3
implements=["me.zhouxi.slint.lang.psi.SlintPsiNamedElement"]
mixin="me.zhouxi.slint.lang.psi.impl.SlintPsiNamedElementMixinImpl"
extends="me.zhouxi.slint.lang.psi.impl.SlintPsiNamedElementImpl"
recoverWhile=recoverForRBracket
}
private recoverForRBracket::=!(']'|'}'|';'|GenericIdentifier)
@@ -514,7 +517,7 @@ Named ::= PropertyName | TypeName |ExternalName | InternalName|ComponentName|Fu
extends("PropertyName|TypeName|ComponentName|FunctionName|InternalName|ExternalName")=Named
}
LocalVariable ::= GenericIdentifier{
mixin="me.zhouxi.slint.lang.psi.impl.SlintPsiNamedElementMixinImpl"
extends="me.zhouxi.slint.lang.psi.impl.SlintPsiNamedElementImpl"
implements=["me.zhouxi.slint.lang.psi.SlintPsiNamedElement"]
}
FunctionName ::= GenericIdentifier
@@ -534,13 +537,13 @@ EnumValue ::=GenericIdentifier
ExternalName ::=GenericIdentifier
ReferenceIdentifier::=GenericIdentifier{
mixin="me.zhouxi.slint.lang.psi.impl.SlintReferencedIdentifierMixinImpl"
extends="me.zhouxi.slint.lang.psi.impl.SlintReferencedIdentifierImpl"
}
//----------UnnamedIdentifier------------------
PropertyNameReference ::= GenericIdentifier{
mixin="me.zhouxi.slint.lang.psi.impl.SlintReferencedIdentifierMixinImpl"
extends="me.zhouxi.slint.lang.psi.impl.SlintReferencedIdentifierImpl"
}
FunctionReference ::=GenericIdentifier{
@@ -555,7 +558,7 @@ QualifiedTypeNameReference ::= TypeNameReference ('.' TypeNameReference)*{
}
ModuleLocation ::= RawStringLiteral{
mixin="me.zhouxi.slint.lang.psi.impl.SlintReferencedIdentifierMixinImpl"
extends="me.zhouxi.slint.lang.psi.impl.SlintReferencedIdentifierImpl"
}
//
//noinspection BnfSuspiciousToken