Skip to content

Commit

Permalink
Обновление на новый парсер с antlr 4.13.1
Browse files Browse the repository at this point in the history
  • Loading branch information
theshadowco committed Jul 12, 2024
1 parent c6c6b06 commit 5e22a78
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
5 changes: 2 additions & 3 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,7 @@ dependencies {
api("org.eclipse.lsp4j", "org.eclipse.lsp4j.websocket.jakarta", "0.23.1")

// 1c-syntax
api("io.github.1c-syntax", "bsl-parser", "0.24.0") {
exclude("com.tunnelvisionlabs", "antlr4-annotations")
api("io.github.1c-syntax", "bsl-parser", "0.25.0") {
exclude("com.ibm.icu", "*")
exclude("org.antlr", "ST4")
exclude("org.abego.treelayout", "org.abego.treelayout.core")
Expand All @@ -94,7 +93,7 @@ dependencies {
api("io.github.1c-syntax", "supportconf", "0.14.0") {
exclude("io.github.1c-syntax", "bsl-common-library")
}
api("io.github.1c-syntax", "bsl-parser-core", "0.1.0")
api("io.github.1c-syntax", "bsl-parser-core", "0.2.0")

// JLanguageTool
implementation("org.languagetool", "languagetool-core", languageToolVersion){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import com.github._1c_syntax.bsl.languageserver.utils.Trees;
import com.github._1c_syntax.bsl.parser.BSLParser;
import lombok.RequiredArgsConstructor;
import org.antlr.v4.runtime.tree.ParseTree;
import org.antlr.v4.runtime.tree.RuleNode;
import org.antlr.v4.runtime.tree.TerminalNode;
import org.apache.commons.lang3.tuple.Pair;
Expand Down Expand Up @@ -154,13 +155,14 @@ private Optional<RuleNode> getRefContextInsideDefAssign(Reference defRef, Refere
final var assignment = defNode
.map(TerminalNode::getParent)
.filter(BSLParser.LValueContext.class::isInstance)
.map(RuleNode::getParent)
.map(ParseTree::getParent)
.filter(BSLParser.AssignmentContext.class::isInstance)
.map(BSLParser.AssignmentContext.class::cast);

return assignment.flatMap(assignContext ->
Trees.findTerminalNodeContainsPosition(assignContext, nextRef.getSelectionRange().getStart()))
.map(TerminalNode::getParent);
.map(TerminalNode::getParent)
.map(RuleNode.class::cast);
}

private static boolean isVarNameOnlyIntoExpression(RuleNode refContext) {
Expand All @@ -170,7 +172,7 @@ private static boolean isVarNameOnlyIntoExpression(RuleNode refContext) {
.filter(node -> node.getChildCount() == 1)
.map(RuleNode::getParent)
.filter(BSLParser.MemberContext.class::isInstance)
.map(RuleNode::getParent)
.map(ParseTree::getParent)
.filter(expression -> expression.getChildCount() == 1)
.filter(BSLParser.ExpressionContext.class::isInstance)
.isPresent();
Expand Down

1 comment on commit 5e22a78

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark 'BSL LS perfomance measurement (SSL 3.1)'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.10.

Benchmark suite Current: 5e22a78 Previous: 24668e8 Ratio
.github/scripts/benchmark.py::test_analyze_ssl31 107.91923793156941 sec (stddev: 0.900736243999912) 78.17074457804362 sec (stddev: 1.6692284736263403) 1.38

This comment was automatically generated by workflow using github-action-benchmark.

CC: @otymko

Please sign in to comment.