From e9bdc734b41628b074dce156592c99caa7fa315a Mon Sep 17 00:00:00 2001 From: dgelessus <dgelessus@users.noreply.github.com> Date: Fri, 11 Oct 2024 10:52:40 +0200 Subject: [PATCH] Update parser and replace use of now removed AOpSubstitution --- build.gradle | 2 +- .../de/tlc4b/analysis/MachineContext.java | 21 ++++++++++--------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/build.gradle b/build.gradle index 45c8f70..8aea1eb 100644 --- a/build.gradle +++ b/build.gradle @@ -26,7 +26,7 @@ configurations.all { resolutionStrategy.cacheChangingModulesFor 0, 'seconds' } -def parser_version = '2.13.3' +def parser_version = '2.13.5-SNAPSHOT' dependencies { //implementation(group: 'com.microsoft', name: 'tla2tools', version: '1.4.6') diff --git a/src/main/java/de/tlc4b/analysis/MachineContext.java b/src/main/java/de/tlc4b/analysis/MachineContext.java index ae62b99..3f87105 100644 --- a/src/main/java/de/tlc4b/analysis/MachineContext.java +++ b/src/main/java/de/tlc4b/analysis/MachineContext.java @@ -2,6 +2,7 @@ package de.tlc4b.analysis; import java.util.*; import java.util.Map.Entry; +import java.util.stream.Collectors; import de.be4.classicalb.core.parser.analysis.DepthFirstAdapter; import de.be4.classicalb.core.parser.node.*; @@ -650,16 +651,16 @@ public class MachineContext extends DepthFirstAdapter { } @Override - public void caseAOpSubstitution(AOpSubstitution node) { - if (node.getName() != null) { - AIdentifierExpression op = (AIdentifierExpression) node.getName(); - String name = Utils.getTIdentifierListAsString(op.getIdentifier()); - Node o = operations.get(name); - if (o != null) { - this.referencesTable.put(op, o); - } else { - throw new ScopeException("Unknown operation '" + name + "'"); - } + public void caseAOperationCallSubstitution(AOperationCallSubstitution node) { + String name = Utils.getTIdentifierListAsString(node.getOperation()); + Node o = operations.get(name); + if (o != null) { + AIdentifierExpression op = new AIdentifierExpression(node.getOperation().stream() + .map(TIdentifierLiteral::clone) + .collect(Collectors.toList())); + this.referencesTable.put(op, o); + } else { + throw new ScopeException("Unknown operation '" + name + "'"); } { List<PExpression> copy = new ArrayList<>(node.getParameters()); -- GitLab