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 10, 2024
1 parent 52c9f43 commit 78f6110
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 @@ -80,8 +80,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 @@ -91,7 +90,7 @@ dependencies {
api("io.github.1c-syntax", "mdclasses", "0.13.0")
api("io.github.1c-syntax", "bsl-common-library", "0.6.0")
api("io.github.1c-syntax", "supportconf", "0.14.0")
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 78f6110

@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: 78f6110 Previous: 52c9f43 Ratio
.github/scripts/benchmark.py::test_analyze_ssl31 106.14488625526428 sec (stddev: 1.8993544970899003) 79.20686467488606 sec (stddev: 1.3500954506276241) 1.34

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

CC: @otymko

Please sign in to comment.