Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Обновление на новый парсер с antlr 4.13.1 #3266

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading