Skip to content

Commit 3f4fd23

Browse files
authored
Use KeYParser.g4 for parsing proof scripts (#3021)
2 parents 2208fad + db46d41 commit 3f4fd23

File tree

251 files changed

+1540
-1240
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

251 files changed

+1540
-1240
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

key.core.rifl/src/main/resources/de.uka.ilkd.key.util/rifl/blueprint_rifl.key

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
"class": "de.uka.ilkd.key.informationflow.po.InfFlowContractPO",
4848
}
4949

50-
\proofScript "macro 'infflow-autopilot';"
50+
\proofScript { macro "infflow-autopilot"; }
5151

5252
\proof {
5353
(autoModeTime "0")

key.core/src/main/antlr4/KeYLexer.g4

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,6 @@ RGUILLEMETS: '>''>' | '»' | '›';
391391
IMPLICIT_IDENT: '<' '$'? (LETTER)+ '>' ('$lmtd')? -> type(IDENT);
392392

393393
EQV: '<->' | '\u2194';
394-
PRIMES: ('\'')+;
395394
CHAR_LITERAL
396395
: '\''
397396
((' '..'&') |
@@ -481,6 +480,7 @@ MODAILITYGENERIC:
481480
-> more, pushMode(modGeneric);
482481
*/
483482
//BACKSLASH: '\\';
483+
ERROR_UKNOWN_ESCAPE: '\\' IDENT;
484484
ERROR_CHAR: .;
485485

486486
mode modDiamond;

key.core/src/main/antlr4/KeYParser.g4

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ problem
4141
| CHOOSECONTRACT (chooseContract=string_value SEMI)?
4242
| PROOFOBLIGATION (proofObligation=cvalue)? SEMI?
4343
)
44-
proofScript?
44+
proofScriptEntry?
4545
;
4646

4747

@@ -852,10 +852,34 @@ preferences
852852
| c=cvalue ) // LBRACE, RBRACE included in cvalue#table
853853
;
854854

855-
proofScript
855+
proofScriptEntry
856856
:
857-
PROOFSCRIPT ps = STRING_LITERAL
857+
PROOFSCRIPT
858+
( STRING_LITERAL SEMI?
859+
| LBRACE proofScript RBRACE
860+
)
858861
;
862+
proofScriptEOF: proofScript EOF;
863+
proofScript: proofScriptCommand+;
864+
proofScriptCommand: cmd=IDENT proofScriptParameters?
865+
( LBRACE sub=proofScript RBRACE SEMI?
866+
| SEMI);
867+
868+
proofScriptParameters: proofScriptParameter+;
869+
proofScriptParameter : ((pname=proofScriptParameterName (COLON|EQUALS))? expr=proofScriptExpression);
870+
proofScriptParameterName: AT? IDENT; // someone thought, that the let-command parameters should have a leading "@"
871+
proofScriptExpression:
872+
boolean_literal
873+
| char_literal
874+
| integer
875+
| floatnum
876+
| string_literal
877+
| LPAREN (term | seq) RPAREN
878+
| simple_ident
879+
| abbreviation
880+
| literals
881+
;
882+
859883

860884
// PROOF
861885
proof: PROOF EOF;

key.core/src/main/java/de/uka/ilkd/key/control/KeYEnvironment.java

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
import de.uka.ilkd.key.java.Services;
1515
import de.uka.ilkd.key.java.abstraction.KeYJavaType;
1616
import de.uka.ilkd.key.logic.op.IObserverFunction;
17-
import de.uka.ilkd.key.nparser.ProofScriptEntry;
17+
import de.uka.ilkd.key.nparser.KeyAst.ProofScript;
1818
import de.uka.ilkd.key.proof.Proof;
1919
import de.uka.ilkd.key.proof.init.InitConfig;
2020
import de.uka.ilkd.key.proof.init.Profile;
@@ -56,7 +56,7 @@ public class KeYEnvironment<U extends UserInterfaceControl> {
5656
/**
5757
* An optional field denoting a script contained in the proof file.
5858
*/
59-
private final @Nullable ProofScriptEntry proofScript;
59+
private final @Nullable ProofScript proofScript;
6060

6161
/**
6262
* Indicates that this {@link KeYEnvironment} is disposed.
@@ -83,9 +83,10 @@ public KeYEnvironment(U ui, InitConfig initConfig) {
8383
*
8484
* @param ui The {@link UserInterfaceControl} in which the {@link Proof} is loaded.
8585
* @param initConfig The loaded project.
86+
* @param proofScript add an optional proof script
8687
*/
8788
public KeYEnvironment(U ui, InitConfig initConfig, Proof loadedProof,
88-
@Nullable ProofScriptEntry proofScript, ReplayResult replayResult) {
89+
@Nullable ProofScript proofScript, ReplayResult replayResult) {
8990
this.ui = ui;
9091
this.initConfig = initConfig;
9192
this.loadedProof = loadedProof;
@@ -251,8 +252,10 @@ public static KeYEnvironment<DefaultUserInterfaceControl> load(Profile profile,
251252
* @param poPropertiesToForce Some optional PO {@link Properties} to force.
252253
* @param ruleCompletionHandler An optional {@link RuleCompletionHandler}.
253254
* @param forceNewProfileOfNewProofs {@code} true
254-
* {@code AbstractProblemLoader.profileOfNewProofs} will be used as {@link Profile} of
255-
* new proofs, {@code false} {@link Profile} specified by problem file will be used for
255+
* {@code AbstractProblemLoader.profileOfNewProofs} will
256+
* be used as {@link Profile} of
257+
* new proofs, {@code false} {@link Profile}
258+
* specified by problem file will be used for
256259
* new proofs.
257260
* @return The {@link KeYEnvironment} which contains all references to the loaded location.
258261
* @throws ProblemLoaderException Occurred Exception
@@ -290,7 +293,8 @@ public static KeYEnvironment<DefaultUserInterfaceControl> load(Profile profile,
290293
List<File> classPaths, File bootClassPath, List<File> includes,
291294
Properties poPropertiesToForce, RuleCompletionHandler ruleCompletionHandler,
292295
Consumer<Proof> callbackProofLoaded,
293-
boolean forceNewProfileOfNewProofs) throws ProblemLoaderException {
296+
boolean forceNewProfileOfNewProofs)
297+
throws ProblemLoaderException {
294298
DefaultUserInterfaceControl ui = new DefaultUserInterfaceControl(ruleCompletionHandler);
295299
AbstractProblemLoader loader = ui.load(profile, location, classPaths, bootClassPath,
296300
includes, poPropertiesToForce, forceNewProfileOfNewProofs, callbackProofLoaded);
@@ -319,13 +323,13 @@ public void dispose() {
319323
* Checks if this {@link KeYEnvironment} is disposed meaning that {@link #dispose()} was already
320324
* executed at least once.
321325
*
322-
* @return {@code true} disposed, {@code false} not disposed and still functionable.
326+
* @return {@code true} disposed, {@code false} not disposed and still functional.
323327
*/
324328
public boolean isDisposed() {
325329
return disposed;
326330
}
327331

328-
public @Nullable ProofScriptEntry getProofScript() {
332+
public @Nullable ProofScript getProofScript() {
329333
return proofScript;
330334
}
331335

key.core/src/main/java/de/uka/ilkd/key/macros/scripts/AllCommand.java

Lines changed: 0 additions & 95 deletions
This file was deleted.

key.core/src/main/java/de/uka/ilkd/key/macros/scripts/LetCommand.java

Lines changed: 0 additions & 60 deletions
This file was deleted.

0 commit comments

Comments
 (0)