-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1198 from artbear/annotations-method-symbol-1115
Директивы компиляции и аннотации в MethodSymbol
- Loading branch information
Showing
11 changed files
with
522 additions
and
20 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
42 changes: 42 additions & 0 deletions
42
.../java/com/github/_1c_syntax/bsl/languageserver/context/symbol/annotations/Annotation.java
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,42 @@ | ||
/* | ||
* This file is a part of BSL Language Server. | ||
* | ||
* Copyright © 2018-2020 | ||
* Alexey Sosnoviy <labotamy@gmail.com>, Nikita Gryzlov <nixel2007@gmail.com> and contributors | ||
* | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
* | ||
* BSL Language Server is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU Lesser General Public | ||
* License as published by the Free Software Foundation; either | ||
* version 3.0 of the License, or (at your option) any later version. | ||
* | ||
* BSL Language Server is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public | ||
* License along with BSL Language Server. | ||
*/ | ||
package com.github._1c_syntax.bsl.languageserver.context.symbol.annotations; | ||
|
||
import lombok.Builder; | ||
import lombok.Value; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
/** | ||
* Класс хранит информацию об аннотации. | ||
* См. {@link com.github._1c_syntax.bsl.languageserver.context.symbol.MethodSymbol} | ||
*/ | ||
@Value | ||
@Builder | ||
public class Annotation { | ||
String name; | ||
AnnotationKind kind; | ||
|
||
@Builder.Default | ||
List<AnnotationParameterDefinition> parameters = new ArrayList<>(); | ||
} |
52 changes: 52 additions & 0 deletions
52
...a/com/github/_1c_syntax/bsl/languageserver/context/symbol/annotations/AnnotationKind.java
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,52 @@ | ||
/* | ||
* This file is a part of BSL Language Server. | ||
* | ||
* Copyright © 2018-2020 | ||
* Alexey Sosnoviy <labotamy@gmail.com>, Nikita Gryzlov <nixel2007@gmail.com> and contributors | ||
* | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
* | ||
* BSL Language Server is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU Lesser General Public | ||
* License as published by the Free Software Foundation; either | ||
* version 3.0 of the License, or (at your option) any later version. | ||
* | ||
* BSL Language Server is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public | ||
* License along with BSL Language Server. | ||
*/ | ||
package com.github._1c_syntax.bsl.languageserver.context.symbol.annotations; | ||
|
||
import com.github._1c_syntax.bsl.parser.BSLParser; | ||
import lombok.Getter; | ||
|
||
import java.util.stream.Stream; | ||
|
||
/** | ||
* Класс хранит информацию о виде аннотации. | ||
* См. {@link Annotation} | ||
*/ | ||
public enum AnnotationKind { | ||
BEFORE(BSLParser.ANNOTATION_BEFORE_SYMBOL), | ||
AFTER(BSLParser.ANNOTATION_AFTER_SYMBOL), | ||
AROUND(BSLParser.ANNOTATION_AROUND_SYMBOL), | ||
CHANGEANDVALIDATE(BSLParser.ANNOTATION_CHANGEANDVALIDATE_SYMBOL), | ||
CUSTOM(BSLParser.ANNOTATION_CUSTOM_SYMBOL); | ||
|
||
@Getter | ||
private final int tokenType; | ||
|
||
AnnotationKind(int tokenType) { | ||
this.tokenType = tokenType; | ||
} | ||
|
||
public static AnnotationKind of(int tokenType) { | ||
return Stream.of(values()) | ||
.filter(annotationKind -> annotationKind.getTokenType() == tokenType) | ||
.findAny().orElse(CUSTOM); | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
...c_syntax/bsl/languageserver/context/symbol/annotations/AnnotationParameterDefinition.java
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,35 @@ | ||
/* | ||
* This file is a part of BSL Language Server. | ||
* | ||
* Copyright © 2018-2020 | ||
* Alexey Sosnoviy <labotamy@gmail.com>, Nikita Gryzlov <nixel2007@gmail.com> and contributors | ||
* | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
* | ||
* BSL Language Server is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU Lesser General Public | ||
* License as published by the Free Software Foundation; either | ||
* version 3.0 of the License, or (at your option) any later version. | ||
* | ||
* BSL Language Server is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public | ||
* License along with BSL Language Server. | ||
*/ | ||
package com.github._1c_syntax.bsl.languageserver.context.symbol.annotations; | ||
|
||
import lombok.Value; | ||
|
||
/** | ||
* Класс хранит информацию о параметре аннотации. | ||
* См. {@link Annotation} | ||
*/ | ||
@Value | ||
public class AnnotationParameterDefinition { | ||
String name; | ||
String value; | ||
boolean optional; | ||
} |
55 changes: 55 additions & 0 deletions
55
...ithub/_1c_syntax/bsl/languageserver/context/symbol/annotations/CompilerDirectiveKind.java
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,55 @@ | ||
/* | ||
* This file is a part of BSL Language Server. | ||
* | ||
* Copyright © 2018-2020 | ||
* Alexey Sosnoviy <labotamy@gmail.com>, Nikita Gryzlov <nixel2007@gmail.com> and contributors | ||
* | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
* | ||
* BSL Language Server is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU Lesser General Public | ||
* License as published by the Free Software Foundation; either | ||
* version 3.0 of the License, or (at your option) any later version. | ||
* | ||
* BSL Language Server is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public | ||
* License along with BSL Language Server. | ||
*/ | ||
package com.github._1c_syntax.bsl.languageserver.context.symbol.annotations; | ||
|
||
import com.github._1c_syntax.bsl.parser.BSLParser; | ||
|
||
import java.util.Optional; | ||
import java.util.stream.Stream; | ||
|
||
/** | ||
* Класс хранит информацию о директиве компиляции. | ||
* См. {@link com.github._1c_syntax.bsl.languageserver.context.symbol.MethodSymbol} | ||
*/ | ||
public enum CompilerDirectiveKind { | ||
AT_SERVER_NO_CONTEXT(BSLParser.ANNOTATION_ATSERVERNOCONTEXT_SYMBOL), | ||
AT_CLIENT_AT_SERVER_NO_CONTEXT(BSLParser.ANNOTATION_ATCLIENTATSERVERNOCONTEXT_SYMBOL), | ||
AT_CLIENT_AT_SERVER(BSLParser.ANNOTATION_ATCLIENTATSERVER_SYMBOL), | ||
AT_CLIENT(BSLParser.ANNOTATION_ATCLIENT_SYMBOL), | ||
AT_SERVER(BSLParser.ANNOTATION_ATSERVER_SYMBOL); | ||
|
||
private final int tokenType; | ||
|
||
CompilerDirectiveKind(int tokenType) { | ||
this.tokenType = tokenType; | ||
} | ||
|
||
public int getTokenType() { | ||
return tokenType; | ||
} | ||
|
||
public static Optional<CompilerDirectiveKind> of(int tokenType){ | ||
return Stream.of(values()) | ||
.filter(compilerDirective -> compilerDirective.getTokenType() == tokenType) | ||
.findAny(); | ||
} | ||
} |
Oops, something went wrong.