修改bnf
This commit is contained in:
@@ -66,11 +66,11 @@
|
||||
//
|
||||
Document ::= DocumentElement*
|
||||
private recoverTopElement ::= !('component' | 'struct' | 'enum' | 'global'| 'export'|'import' )
|
||||
private DocumentElement ::= Import | Struct |Export | Enum | GlobalSingleton | Component {
|
||||
private DocumentElement ::= Import | Struct | Enum | GlobalSingleton | Component | Export {
|
||||
recoverWhile=recoverTopElement
|
||||
}
|
||||
GlobalSingleton ::= GlobalKeyword ComponentName ComponentBody {
|
||||
pin=1
|
||||
GlobalSingleton ::= ExportKeyword? GlobalKeyword ComponentName ComponentBody {
|
||||
pin=2
|
||||
implements=["me.zhouxi.slint.lang.psi.SlintPsiNamedElement"]
|
||||
mixin="me.zhouxi.slint.lang.psi.impl.SlintPsiNamedElementMixinImpl"
|
||||
}
|
||||
@@ -79,30 +79,32 @@ Import ::= ImportKeyword ImportElement? ModuleLocation';'{
|
||||
pin=1
|
||||
}
|
||||
|
||||
private ImportElement ::= '{' ImportedIdentifier (',' ImportedIdentifier)* ','? '}' FromKeyword {
|
||||
private ImportElement ::= '{' ImportedSpecifier (',' ImportedSpecifier)* ','? '}' FromKeyword {
|
||||
pin=1
|
||||
}
|
||||
|
||||
// ABc as Def
|
||||
ImportedIdentifier ::= ReferenceIdentifier ImportAlias?{
|
||||
ImportedSpecifier ::= ReferenceIdentifier ImportAlias?{
|
||||
pin=1
|
||||
recoverWhile=AliasNameRecover
|
||||
}
|
||||
private AliasNameRecover::=!(','|'}'|';')
|
||||
|
||||
private ImportAlias ::= AsKeyword InternalName {
|
||||
ImportAlias ::= AsKeyword InternalName {
|
||||
pin=1
|
||||
implements=["me.zhouxi.slint.lang.psi.SlintPsiNamedElement"]
|
||||
mixin="me.zhouxi.slint.lang.psi.impl.SlintPsiNamedElementMixinImpl"
|
||||
}
|
||||
//Struct 定义
|
||||
Struct ::= StructKeyword TypeName (':=')? StructBody {
|
||||
pin=1
|
||||
Struct ::= ExportKeyword? StructKeyword TypeName (':=')? StructBody {
|
||||
pin=2
|
||||
}
|
||||
private StructBody ::= '{' FieldDeclarations? '}'{
|
||||
pin=1
|
||||
}
|
||||
//EnumDeclaration
|
||||
Enum ::= EnumKeyword EnumName '{' (EnumValue (','EnumValue)*','? )? '}'{
|
||||
pin=1
|
||||
Enum ::= ExportKeyword? EnumKeyword EnumName '{' (EnumValue (','EnumValue)*','? )? '}'{
|
||||
pin=2
|
||||
implements=["me.zhouxi.slint.lang.psi.SlintPsiNamedElement"]
|
||||
mixin="me.zhouxi.slint.lang.psi.impl.SlintPsiNamedElementMixinImpl"
|
||||
}
|
||||
@@ -111,15 +113,17 @@ Enum ::= EnumKeyword EnumName '{' (EnumValue (','EnumValue)*','? )? '}'{
|
||||
Export ::= ExportKeyword ExportElement {
|
||||
pin=1
|
||||
}
|
||||
private ExportElement ::= ExportType | Struct| Component | ExportModule | GlobalSingleton|Enum
|
||||
private ExportElement ::= ExportType | ExportModule
|
||||
|
||||
ExportType ::= '{' ExportIdentifier (','ExportIdentifier)* ','? '}'{
|
||||
ExportType ::= '{' ExportSpecifier (','ExportSpecifier)* ','? '}'{
|
||||
pin=1
|
||||
}
|
||||
ExportIdentifier ::= ReferenceIdentifier ExportAlias?{
|
||||
|
||||
ExportSpecifier::= ReferenceIdentifier ExportAlias?{
|
||||
recoverWhile=AliasNameRecover
|
||||
implements=["me.zhouxi.slint.lang.psi.SlintPsiNamedElement"]
|
||||
mixin="me.zhouxi.slint.lang.psi.impl.SlintPsiNamedElementMixinImpl"
|
||||
}
|
||||
private ExportAlias ::= AsKeyword ExternalName{
|
||||
ExportAlias ::= AsKeyword ExternalName{
|
||||
pin=1
|
||||
}
|
||||
ExportModule ::= '*' FromKeyword ModuleLocation ';'{
|
||||
@@ -131,8 +135,8 @@ ExportModule ::= '*' FromKeyword ModuleLocation ';'{
|
||||
//Old syntax
|
||||
//private LegacyComponent ::=(GlobalKeyword ComponentName ':=' ComponentName? ComponentBody)| ('global'? SubComponent)
|
||||
|
||||
Component ::= ComponentKeyword ComponentName InheritDeclaration? ComponentBody {
|
||||
pin=1
|
||||
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>"
|
||||
@@ -517,10 +521,7 @@ FunctionName ::= GenericIdentifier
|
||||
|
||||
ComponentName ::=GenericIdentifier
|
||||
|
||||
InternalName ::= GenericIdentifier{
|
||||
mixin="me.zhouxi.slint.lang.psi.impl.SlintPsiNamedElementMixinImpl"
|
||||
implements=["me.zhouxi.slint.lang.psi.SlintPsiNamedElement"]
|
||||
}
|
||||
InternalName ::= GenericIdentifier
|
||||
|
||||
PropertyName ::= GenericIdentifier
|
||||
|
||||
@@ -530,10 +531,7 @@ EnumName ::= GenericIdentifier
|
||||
|
||||
EnumValue ::=GenericIdentifier
|
||||
|
||||
ExternalName ::=GenericIdentifier{
|
||||
mixin="me.zhouxi.slint.lang.psi.impl.SlintPsiNamedElementMixinImpl"
|
||||
implements=["me.zhouxi.slint.lang.psi.SlintPsiNamedElement"]
|
||||
}
|
||||
ExternalName ::=GenericIdentifier
|
||||
|
||||
ReferenceIdentifier::=GenericIdentifier{
|
||||
mixin="me.zhouxi.slint.lang.psi.impl.SlintReferencedIdentifierMixinImpl"
|
||||
|
||||
Reference in New Issue
Block a user