Skip to content

Commit f8ac039

Browse files
committed
address reviewer comments
1 parent 4e0508a commit f8ac039

File tree

3 files changed

+61
-58
lines changed

3 files changed

+61
-58
lines changed

key.core/src/main/java/de/uka/ilkd/key/nparser/ParsingFacade.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ private ParsingFacade() {
5050
* <b>The use of this method is discouraged and should be avoided in all high level
5151
* scenarios.</b>
5252
*
53-
* @param ast a key ast object
53+
* @param ast a {@link KeyAst} object
5454
* @param <T> parse tree type
5555
* @return the {@link ParserRuleContext} inside the given ast object.
5656
*/

key.core/src/main/java/de/uka/ilkd/key/scripts/ScriptCommandAst.java

Lines changed: 30 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -3,37 +3,37 @@
33
* SPDX-License-Identifier: GPL-2.0-only */
44
package de.uka.ilkd.key.scripts;
55

6-
import java.util.Collections;
7-
import java.util.List;
8-
import java.util.Map;
9-
import java.util.Objects;
10-
116
import de.uka.ilkd.key.parser.Location;
12-
7+
import org.antlr.v4.runtime.CharStream;
138
import org.antlr.v4.runtime.ParserRuleContext;
149
import org.jspecify.annotations.NullMarked;
1510
import org.jspecify.annotations.Nullable;
1611

12+
import java.util.Collections;
13+
import java.util.List;
14+
import java.util.Map;
15+
import java.util.Objects;
16+
1717
import static java.util.stream.Collectors.joining;
1818

1919
/// This class represents is the AST of a proof script command.
2020
///
2121
/// It is an abstraction to the commands of following structure:
2222
/// ```
23-
/// <commandName> key_1=value_1 ... key_m=value_m positionalArgs_1 ... positionalArgs_n {
23+
/// <commandName> key_1:value_1 ... key_m:value_m positionalArgs_1 ... positionalArgs_n {
2424
/// commands_0; ...; commands_k;
25-
/// }
26-
/// ```
25+
///}
26+
///```
2727
///
28-
/// @param commandName the name of the command, e.g., "macro" for `macro auto;`
29-
/// @param namedArgs a map of the given named arguments and values.
30-
/// If a named argument is not given, the entry should be missing in the map. Null-values are not
31-
/// allowed.
28+
/// @param commandName the name of the command, e.g., "macro" for `macro auto;`
29+
/// @param namedArgs a map of the given named arguments and values.
30+
/// If a named argument is not given, the entry should be missing in the map. Null-values are not
31+
/// allowed.
3232
/// @param positionalArgs the list of given positional arguments
33-
/// @param commands a nullable block of proof script arguments (represents "higher-order proof
34-
/// scripts").
35-
/// If null, the block was omitted syntactically in contrast to an empty list.
36-
/// @param location the location of this command for error reporting.
33+
/// @param commands a nullable block of proof script arguments (represents "higher-order proof
34+
/// scripts").
35+
/// If null, the block was omitted syntactically in contrast to an empty list.
36+
/// @param location the location of this command for error reporting.
3737
/// @author Alexander Weigl
3838
/// @version 1 (14.03.25)
3939
@NullMarked
@@ -45,26 +45,30 @@ public record ScriptCommandAst(
4545
@Nullable Location location) {
4646

4747
public ScriptCommandAst(String commandName, Map<String, Object> namedArgs,
48-
List<Object> positionalArgs) {
48+
List<Object> positionalArgs) {
4949
this(commandName, namedArgs, positionalArgs, Collections.emptyList(), null);
5050
}
5151

52+
/// Renders this command a parsable string representation. The order of the arguments is as follows:
53+
/// key-value arguments, positional arguments and the additional script block.
54+
///
55+
/// @see de.uka.ilkd.key.nparser.ParsingFacade#parseScript(CharStream)
5256
public String asCommandLine() {
5357
return commandName + ' ' +
5458
namedArgs.entrySet().stream()
55-
.map(it -> it.getKey() + ": " + humanString(it.getValue()))
59+
.map(it -> it.getKey() + ": " + asReadableString(it.getValue()))
5660
.collect(joining(" "))
5761
+ ' '
58-
+ positionalArgs.stream().map(ScriptCommandAst::humanString).collect(joining(" "))
62+
+ positionalArgs.stream().map(ScriptCommandAst::asReadableString).collect(joining(" "))
5963
+ (commands != null
60-
? " {"
61-
+ commands.stream().map(ScriptCommandAst::asCommandLine)
62-
.collect(joining("\n"))
63-
+ "\n}"
64-
: ";");
64+
? " {"
65+
+ commands.stream().map(ScriptCommandAst::asCommandLine)
66+
.collect(joining("\n"))
67+
+ "\n}"
68+
: ";");
6569
}
6670

67-
public static String humanString(Object value) {
71+
public static String asReadableString(Object value) {
6872
if (value instanceof ParserRuleContext ctx) {
6973
return ctx.getText();
7074
}

key.core/tacletProofs/seqPerm2/Taclet_schiffl_thm_1.proof

Lines changed: 30 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -47,75 +47,74 @@
4747

4848
\proofScript {
4949
macro "split-prop";
50-
rule schiffl_lemma_2 formula: (seqPerm(f_s,f_t));
51-
instantiate hide var: x with: (f_x);
52-
instantiate hide var: y with: (f_y);
50+
rule schiffl_lemma_2 formula=(seqPerm(f_s,f_t));
51+
instantiate hide var=x with=(f_x);
52+
instantiate hide var=y with=(f_y);
5353
rule impLeft;
5454
tryclose branch;
5555
rule exLeft;
5656
macro "split-prop";
57-
rule seqPermDef occ: 1;
57+
rule seqPermDef occ=1;
5858
rule andRight;
5959
tryclose branch;
60-
instantiate hide var: s with: (r_0);
60+
instantiate hide var=s with=(r_0);
6161
rule andRight;
6262
tryclose branch;
6363
rule allRight;
6464
rule impRight;
65-
instantiate hide var: iv with: (iv_0);
65+
instantiate hide var=iv with=(iv_0);
6666
rule impLeft;
6767
tryclose branch;
6868
rule andLeft;
6969
rule seqNPermRange;
70-
instantiate hide var: iv with: (iv_0);
70+
instantiate hide var=iv with=(iv_0);
7171
rule impLeft;
7272
tryclose branch;
7373
rule andLeft;
7474
rule andLeft;
7575
rule seqNPermRange;
76-
instantiate hide var: iv with: (f_x);
76+
instantiate hide var=iv with=(f_x);
7777
rule impLeft;
7878
tryclose branch;
79-
// Wrong branch is selected here. Goal 1 instead of Goal 2
8079
rule andLeft;
8180
rule andLeft;
8281
rule seqNPermRange;
83-
instantiate hide var: iv with: (f_y);
82+
instantiate hide var=iv with=(f_y);
8483
rule impLeft;
8584
tryclose branch;
8685
rule andLeft;
8786
rule andLeft;
88-
rule getOfSeqDef occ: 0;
87+
rule getOfSeqDef occ=0;
8988
rule getOfSeqDef;
90-
rule ifthenelse_split occ: 0;
91-
rule andLeft occ: 0;
92-
rule sub_zero_2 occ: 0;
93-
rule ifthenelse_split occ: 2;
89+
rule ifthenelse_split occ=0;
90+
rule andLeft occ=0;
91+
rule sub_zero_2 occ=0;
92+
rule ifthenelse_split occ=2;
9493
rule andLeft;
95-
rule sub_zero_2 occ: 0;
96-
rule add_zero_right occ: 0;
97-
rule add_zero_right occ: 0;
98-
rule add_zero_right occ: 0;
99-
rule add_zero_right occ: 0;
100-
rule add_zero_right occ: 0;
101-
rule add_zero_right occ: 0;
102-
rule ifthenelse_split occ: 0;
103-
rule ifthenelse_split occ: 0;
94+
rule sub_zero_2 occ=0;
95+
rule add_zero_right occ=0;
96+
rule add_zero_right occ=0;
97+
rule add_zero_right occ=0;
98+
rule add_zero_right occ=0;
99+
rule add_zero_right occ=0;
100+
rule add_zero_right occ=0;
101+
rule ifthenelse_split occ=0;
102+
rule ifthenelse_split occ=0;
104103
tryclose branch;
105104
tryclose branch;
106-
rule ifthenelse_split occ: 0;
105+
rule ifthenelse_split occ=0;
107106
tryclose branch;
108-
rule ifthenelse_split occ: 0;
107+
rule ifthenelse_split occ=0;
109108
rule seqNPermInjective;
110-
instantiate hide var: iv with: (iv_0);
111-
instantiate hide var: jv with: (f_y);
109+
instantiate hide var=iv with=(iv_0);
110+
instantiate hide var=jv with=(f_y);
112111
rule impLeft;
113112
tryclose branch;
114113
tryclose branch;
115-
rule ifthenelse_split occ: 0;
114+
rule ifthenelse_split occ=0;
116115
rule seqNPermInjective;
117-
instantiate hide var: iv with: (iv_0);
118-
instantiate hide var: jv with: (f_x);
116+
instantiate hide var=iv with=(iv_0);
117+
instantiate hide var=jv with=(f_x);
119118
rule impLeft;
120119
tryclose branch;
121120
tryclose branch;

0 commit comments

Comments
 (0)