Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
ProofScriptParser
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
24
Issues
24
List
Boards
Labels
Service Desk
Milestones
Merge Requests
4
Merge Requests
4
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sarah.grebing
ProofScriptParser
Commits
10f6693e
Commit
10f6693e
authored
Dec 16, 2017
by
Alexander Weigl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
grammar restructured
* if/while/strict/relax added * no rt adaptions
parent
3d79d1fe
Changes
19
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
438 additions
and
167 deletions
+438
-167
lang/src/main/antlr4/edu/kit/iti/formal/psdbg/parser/ScriptLanguage.g4
.../antlr4/edu/kit/iti/formal/psdbg/parser/ScriptLanguage.g4
+13
-16
lang/src/main/java/edu/kit/iti/formal/psdbg/parser/ASTTraversal.java
...in/java/edu/kit/iti/formal/psdbg/parser/ASTTraversal.java
+47
-21
lang/src/main/java/edu/kit/iti/formal/psdbg/parser/DefaultASTVisitor.java
...va/edu/kit/iti/formal/psdbg/parser/DefaultASTVisitor.java
+20
-0
lang/src/main/java/edu/kit/iti/formal/psdbg/parser/PrettyPrinter.java
...n/java/edu/kit/iti/formal/psdbg/parser/PrettyPrinter.java
+45
-0
lang/src/main/java/edu/kit/iti/formal/psdbg/parser/TransformAst.java
...in/java/edu/kit/iti/formal/psdbg/parser/TransformAst.java
+79
-47
lang/src/main/java/edu/kit/iti/formal/psdbg/parser/Visitor.java
...rc/main/java/edu/kit/iti/formal/psdbg/parser/Visitor.java
+30
-21
lang/src/main/java/edu/kit/iti/formal/psdbg/parser/ast/ConditionalBlock.java
...edu/kit/iti/formal/psdbg/parser/ast/ConditionalBlock.java
+59
-0
lang/src/main/java/edu/kit/iti/formal/psdbg/parser/ast/ForeachStatement.java
...edu/kit/iti/formal/psdbg/parser/ast/ForeachStatement.java
+1
-1
lang/src/main/java/edu/kit/iti/formal/psdbg/parser/ast/GoalSelector.java
...ava/edu/kit/iti/formal/psdbg/parser/ast/GoalSelector.java
+0
-55
lang/src/main/java/edu/kit/iti/formal/psdbg/parser/ast/IfStatement.java
...java/edu/kit/iti/formal/psdbg/parser/ast/IfStatement.java
+20
-0
lang/src/main/java/edu/kit/iti/formal/psdbg/parser/ast/RelaxBlock.java
.../java/edu/kit/iti/formal/psdbg/parser/ast/RelaxBlock.java
+18
-0
lang/src/main/java/edu/kit/iti/formal/psdbg/parser/ast/RepeatStatement.java
.../edu/kit/iti/formal/psdbg/parser/ast/RepeatStatement.java
+1
-3
lang/src/main/java/edu/kit/iti/formal/psdbg/parser/ast/StrictBlock.java
...java/edu/kit/iti/formal/psdbg/parser/ast/StrictBlock.java
+18
-0
lang/src/main/java/edu/kit/iti/formal/psdbg/parser/ast/TheOnlyStatement.java
...edu/kit/iti/formal/psdbg/parser/ast/TheOnlyStatement.java
+1
-1
lang/src/main/java/edu/kit/iti/formal/psdbg/parser/ast/UnconditionalBlock.java
...u/kit/iti/formal/psdbg/parser/ast/UnconditionalBlock.java
+54
-0
lang/src/main/java/edu/kit/iti/formal/psdbg/parser/ast/WhileStatement.java
...a/edu/kit/iti/formal/psdbg/parser/ast/WhileStatement.java
+19
-0
lint/src/main/java/edu/kit/iti/formal/psdbg/lint/checkers/SuccessiveGoalSelector.java
...ti/formal/psdbg/lint/checkers/SuccessiveGoalSelector.java
+1
-1
ui/pom.xml
ui/pom.xml
+11
-0
ui/src/main/java/edu/kit/iti/formal/psdbg/gui/controls/ScriptArea.java
...ava/edu/kit/iti/formal/psdbg/gui/controls/ScriptArea.java
+1
-1
No files found.
lang/src/main/antlr4/edu/kit/iti/formal/psdbg/parser/ScriptLanguage.g4
View file @
10f6693e
...
@@ -28,12 +28,11 @@ stmtList
...
@@ -28,12 +28,11 @@ stmtList
statement
statement
: //scriptDecl
: //scriptDecl
assignment
assignment
| repeatStmt
| casesStmt
| casesStmt
| scriptCommand
| forEachStmt
| unconditionalBlock
| theOnlyStmt
| conditionalBlock
| scriptCommand
// | callStmt
// | callStmt
;
;
...
@@ -102,10 +101,6 @@ scriptVar
...
@@ -102,10 +101,6 @@ scriptVar
;
;
repeatStmt
: REPEAT INDENT stmtList DEDENT
;
casesStmt
casesStmt
: CASES INDENT
: CASES INDENT
casesList*
casesList*
...
@@ -126,12 +121,12 @@ casesList
...
@@ -126,12 +121,12 @@ casesList
: CLOSES INDENT closesGuard=stmtList DEDENT
: CLOSES INDENT closesGuard=stmtList DEDENT
;*/
;*/
forEachStmt
unconditionalBlock
:
FOREACH IN
DENT stmtList DEDENT
:
(kind+=(FOREACH|THEONLY|STRICT|RELAX|REPEAT))+ I
DENT stmtList DEDENT
;
;
theOnlyStmt
conditionalBlock
:
THEONLY IN
DENT stmtList DEDENT
:
kind=(IF|WHILE) LPAREN expression RPAREN I
DENT stmtList DEDENT
;
;
...
@@ -176,14 +171,16 @@ BOOL: 'bool' ;
...
@@ -176,14 +171,16 @@ BOOL: 'bool' ;
TERMTYPE : 'term' ;*/
TERMTYPE : 'term' ;*/
FOREACH : 'foreach' ;
FOREACH : 'foreach' ;
THEONLY : 'theonly' ;
THEONLY : 'theonly' ;
STRICT : 'strict' ;
RELAX : 'relax';
IF:'if';
WHILE:'while';
INDENT : '{' ;
INDENT : '{' ;
DEDENT : '}' ;
DEDENT : '}' ;
SEMICOLON : ';' ;
SEMICOLON : ';' ;
COLON : ':' ;
COLON : ':' ;
HEAPSIMP:'heap-simp';
SUBST_TO: '\\';
SUBST_TO: '\\';
STRING_LITERAL
STRING_LITERAL
: '\'' ('\'\'' | ~ ('\''))* '\''
: '\'' ('\'\'' | ~ ('\''))* '\''
;
;
...
...
lang/src/main/java/edu/kit/iti/formal/psdbg/parser/ASTTraversal.java
View file @
10f6693e
package
edu.kit.iti.formal.psdbg.parser
;
package
edu.kit.iti.formal.psdbg.parser
;
/*-
/*-
* #%L
* #%L
* ProofScriptParser
* ProofScriptParser
* %%
* %%
* Copyright (C) 2017 Application-oriented Formal Verification
* Copyright (C) 2017 Application-oriented Formal Verification
* %%
* %%
* This program is free software: you can redistribute it and/or modify
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General default License as
* it under the terms of the GNU General default License as
* published by the Free Software Foundation, either version 3 of the
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
* License, or (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General default License for more details.
* GNU General default License for more details.
*
*
* You should have received a copy of the GNU General default
* You should have received a copy of the GNU General default
* License along with this program. If not, see
* License along with this program. If not, see
* <http://www.gnu.org/licenses/gpl-3.0.html>.
* <http://www.gnu.org/licenses/gpl-3.0.html>.
* #L%
* #L%
*/
*/
import
edu.kit.iti.formal.psdbg.parser.ast.*
;
import
edu.kit.iti.formal.psdbg.parser.ast.*
;
...
@@ -200,4 +200,30 @@ public interface ASTTraversal<T> extends Visitor<T> {
...
@@ -200,4 +200,30 @@ public interface ASTTraversal<T> extends Visitor<T> {
func
.
getArguments
().
forEach
(
a
->
a
.
accept
(
this
));
func
.
getArguments
().
forEach
(
a
->
a
.
accept
(
this
));
return
null
;
return
null
;
}
}
@Override
default
T
visit
(
WhileStatement
ws
)
{
ws
.
getCondition
().
accept
(
this
);
ws
.
getBody
().
accept
(
this
);
return
null
;
}
@Override
default
T
visit
(
IfStatement
is
)
{
is
.
getCondition
().
accept
(
this
);
is
.
getBody
().
accept
(
this
);
return
null
;
}
@Override
default
T
visit
(
StrictBlock
strictBlock
)
{
strictBlock
.
getBody
().
accept
(
this
);
return
null
;
}
@Override
default
T
visit
(
RelaxBlock
relaxBlock
)
{
relaxBlock
.
getBody
().
accept
(
this
);
return
null
;
}
}
}
lang/src/main/java/edu/kit/iti/formal/psdbg/parser/DefaultASTVisitor.java
View file @
10f6693e
...
@@ -156,5 +156,25 @@ public class DefaultASTVisitor<T> implements Visitor<T> {
...
@@ -156,5 +156,25 @@ public class DefaultASTVisitor<T> implements Visitor<T> {
public
T
visit
(
FunctionCall
func
)
{
public
T
visit
(
FunctionCall
func
)
{
return
defaultVisit
(
func
);
return
defaultVisit
(
func
);
}
}
@Override
public
T
visit
(
WhileStatement
ws
)
{
return
defaultVisit
(
ws
);
}
@Override
public
T
visit
(
IfStatement
is
)
{
return
defaultVisit
(
is
);
}
@Override
public
T
visit
(
StrictBlock
strictBlock
)
{
return
defaultVisit
(
strictBlock
);
}
@Override
public
T
visit
(
RelaxBlock
relaxBlock
)
{
return
defaultVisit
(
relaxBlock
);
}
}
}
lang/src/main/java/edu/kit/iti/formal/psdbg/parser/PrettyPrinter.java
View file @
10f6693e
...
@@ -318,6 +318,51 @@ public class PrettyPrinter extends DefaultASTVisitor<Void> {
...
@@ -318,6 +318,51 @@ public class PrettyPrinter extends DefaultASTVisitor<Void> {
return
null
;
return
null
;
}
}
@Override
public
Void
visit
(
DefaultCaseStatement
defCase
)
{
return
super
.
visit
(
defCase
);
}
@Override
public
Void
visit
(
CaseStatement
caseStatement
)
{
return
super
.
visit
(
caseStatement
);
}
@Override
public
Void
visit
(
SubstituteExpression
subst
)
{
return
super
.
visit
(
subst
);
}
@Override
public
Void
visit
(
TryCase
TryCase
)
{
return
super
.
visit
(
TryCase
);
}
@Override
public
Void
visit
(
ClosesCase
closesCase
)
{
return
super
.
visit
(
closesCase
);
}
@Override
public
Void
visit
(
WhileStatement
ws
)
{
return
super
.
visit
(
ws
);
}
@Override
public
Void
visit
(
IfStatement
is
)
{
return
super
.
visit
(
is
);
}
@Override
public
Void
visit
(
StrictBlock
strictBlock
)
{
return
super
.
visit
(
strictBlock
);
}
@Override
public
Void
visit
(
RelaxBlock
relaxBlock
)
{
return
super
.
visit
(
relaxBlock
);
}
//region Printers little helper
//region Printers little helper
private
int
getLastNewline
()
{
private
int
getLastNewline
()
{
...
...
lang/src/main/java/edu/kit/iti/formal/psdbg/parser/TransformAst.java
View file @
10f6693e
package
edu.kit.iti.formal.psdbg.parser
;
package
edu.kit.iti.formal.psdbg.parser
;
/*-
/*-
* #%L
* #%L
* ProofScriptParser
* ProofScriptParser
* %%
* %%
* Copyright (C) 2017 Application-oriented Formal Verification
* Copyright (C) 2017 Application-oriented Formal Verification
* %%
* %%
* This program is free software: you can redistribute it and/or modify
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 3 of the
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
* License, or (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public
* You should have received a copy of the GNU General Public
* License along with this program. If not, see
* License along with this program. If not, see
* <http://www.gnu.org/licenses/gpl-3.0.html>.
* <http://www.gnu.org/licenses/gpl-3.0.html>.
* #L%
* #L%
*/
*/
import
edu.kit.iti.formal.psdbg.parser.ast.*
;
import
edu.kit.iti.formal.psdbg.parser.ast.*
;
...
@@ -39,26 +39,61 @@ import java.util.ArrayList;
...
@@ -39,26 +39,61 @@ import java.util.ArrayList;
import
java.util.LinkedHashMap
;
import
java.util.LinkedHashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.function.Function
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
/**
/**
* @author Alexander Weigl
* @author Alexander Weigl
* @version 2 (29.10.17), introduction of parent
* @version 2 (29.10.17), introduction of parent
*
version 1 (27.04.17)
* version 1 (27.04.17)
*/
*/
public
class
TransformAst
implements
ScriptLanguageVisitor
<
Object
>
{
public
class
TransformAst
implements
ScriptLanguageVisitor
<
Object
>
{
/**
/**
* Start index for positional arguments for command calls
* Start index for positional arguments for command calls
*/
*/
public
static
final
int
KEY_START_INDEX_PARAMETER
=
2
;
public
static
final
int
KEY_START_INDEX_PARAMETER
=
2
;
@Getter
@Getter
private
final
List
<
ProofScript
>
scripts
=
new
ArrayList
<>(
10
);
private
final
List
<
ProofScript
>
scripts
=
new
ArrayList
<>(
10
);
@Getter
@Getter
@Setter
@Setter
private
FunctionRegister
functionRegister
=
new
FunctionRegister
();
private
FunctionRegister
functionRegister
=
new
FunctionRegister
();
private
Function
<
String
,
UnconditionalBlock
>
ubFactory
;
private
Function
<
String
,
ConditionalBlock
>
cbFactory
;
public
TransformAst
()
{
public
TransformAst
()
{
functionRegister
.
loadDefault
();
functionRegister
.
loadDefault
();
ubFactory
=
(
id
->
{
switch
(
id
)
{
case
"foreach"
:
return
new
ForeachStatement
();
case
"theonly"
:
return
new
TheOnlyStatement
();
case
"repeat"
:
return
new
RepeatStatement
();
case
"relax"
:
return
new
RelaxBlock
();
case
"strict"
:
return
new
StrictBlock
();
default
:
throw
new
RuntimeException
(
"Block "
+
id
+
" is not known."
);
}
});
cbFactory
=
(
id
->
{
switch
(
id
)
{
case
"if"
:
return
new
IfStatement
();
case
"while"
:
return
new
WhileStatement
();
default
:
throw
new
RuntimeException
(
"Block "
+
id
+
" is not known."
);
}
});
}
}
@Override
@Override
...
@@ -268,11 +303,11 @@ public class TransformAst implements ScriptLanguageVisitor<Object> {
...
@@ -268,11 +303,11 @@ public class TransformAst implements ScriptLanguageVisitor<Object> {
}
}
@Override
@Override
public
Map
<
String
,
Expression
>
visitSubstExpressionList
(
ScriptLanguageParser
.
SubstExpressionListContext
ctx
)
{
public
Map
<
String
,
Expression
<
ParserRuleContext
>
>
visitSubstExpressionList
(
ScriptLanguageParser
.
SubstExpressionListContext
ctx
)
{
Map
<
String
,
Expression
>
map
=
new
LinkedHashMap
<>();
Map
<
String
,
Expression
<
ParserRuleContext
>
>
map
=
new
LinkedHashMap
<>();
for
(
int
i
=
0
;
i
<
ctx
.
scriptVar
().
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
ctx
.
scriptVar
().
size
();
i
++)
{
map
.
put
(
ctx
.
scriptVar
(
i
).
getText
(),
map
.
put
(
ctx
.
scriptVar
(
i
).
getText
(),
(
Expression
)
ctx
.
expression
(
i
).
accept
(
this
));
(
Expression
<
ParserRuleContext
>
)
ctx
.
expression
(
i
).
accept
(
this
));
}
}
return
map
;
return
map
;
}
}
...
@@ -335,16 +370,6 @@ public class TransformAst implements ScriptLanguageVisitor<Object> {
...
@@ -335,16 +370,6 @@ public class TransformAst implements ScriptLanguageVisitor<Object> {
throw
new
IllegalStateException
(
"not implemented"
);
throw
new
IllegalStateException
(
"not implemented"
);
}
}
@Override
public
Object
visitRepeatStmt
(
ScriptLanguageParser
.
RepeatStmtContext
ctx
)
{
RepeatStatement
rs
=
new
RepeatStatement
();
rs
.
setRuleContext
(
ctx
);
Statements
body
=
(
Statements
)
ctx
.
stmtList
().
accept
(
this
);
rs
.
setBody
(
body
);
body
.
setParent
(
rs
);
return
rs
;
}
@Override
@Override
public
Object
visitCasesStmt
(
ScriptLanguageParser
.
CasesStmtContext
ctx
)
{
public
Object
visitCasesStmt
(
ScriptLanguageParser
.
CasesStmtContext
ctx
)
{
CasesStatement
cases
=
new
CasesStatement
();
CasesStatement
cases
=
new
CasesStatement
();
...
@@ -388,25 +413,32 @@ public class TransformAst implements ScriptLanguageVisitor<Object> {
...
@@ -388,25 +413,32 @@ public class TransformAst implements ScriptLanguageVisitor<Object> {
@Override
@Override
public
Object
visitForEachStmt
(
ScriptLanguageParser
.
ForEachStmtContext
ctx
)
{
public
UnconditionalBlock
visitUnconditionalBlock
(
ScriptLanguageParser
.
UnconditionalBlockContext
ctx
)
{
ForeachStatement
f
=
new
ForeachStatement
();
List
<
UnconditionalBlock
>
list
=
ctx
.
kind
.
stream
().
map
(
token
->
ubFactory
.
apply
(
token
.
getText
())).
collect
(
Collectors
.
toList
());
f
.
setRuleContext
(
ctx
);
UnconditionalBlock
first
=
list
.
get
(
0
);
UnconditionalBlock
last
=
list
.
stream
().
reduce
((
a
,
b
)
->
{
b
.
setParent
(
a
);
a
.
getBody
().
add
(
b
);
return
b
;
}).
orElse
(
first
);
list
.
forEach
(
a
->
a
.
setRuleContext
(
ctx
));
Statements
body
=
(
Statements
)
ctx
.
stmtList
().
accept
(
this
);
Statements
body
=
(
Statements
)
ctx
.
stmtList
().
accept
(
this
);
f
.
setBody
(
body
);
last
.
setBody
(
body
);
body
.
setParent
(
f
);
body
.
setParent
(
last
);
return
f
;
return
f
irst
;
}
}
@Override
@Override
public
Object
visitTheOnlyStmt
(
ScriptLanguageParser
.
TheOnlyStmt
Context
ctx
)
{
public
ConditionalBlock
visitConditionalBlock
(
ScriptLanguageParser
.
ConditionalBlock
Context
ctx
)
{
TheOnlyStatement
f
=
new
TheOnlyStatement
(
);
ConditionalBlock
cb
=
cbFactory
.
apply
(
ctx
.
kind
.
getText
()
);
f
.
setRuleContext
(
ctx
);
cb
.
setRuleContext
(
ctx
);
Statements
body
=
(
Statements
)
ctx
.
stmtList
().
accept
(
this
);
Statements
body
=
(
Statements
)
ctx
.
stmtList
().
accept
(
this
);
f
.
setBody
(
body
);
cb
.
setBody
(
body
);
body
.
setParent
(
f
);
body
.
setParent
(
cb
);
return
f
;
return
cb
;
}
}
@Override
@Override
public
Object
visitScriptCommand
(
ScriptLanguageParser
.
ScriptCommandContext
ctx
)
{
public
Object
visitScriptCommand
(
ScriptLanguageParser
.
ScriptCommandContext
ctx
)
{
CallStatement
scs
=
new
CallStatement
();
CallStatement
scs
=
new
CallStatement
();
...
...
lang/src/main/java/edu/kit/iti/formal/psdbg/parser/Visitor.java
View file @
10f6693e
package
edu.kit.iti.formal.psdbg.parser
;
package
edu.kit.iti.formal.psdbg.parser
;
/*-
/*-
* #%L
* #%L
* ProofScriptParser
* ProofScriptParser
* %%
* %%
* Copyright (C) 2017 Application-oriented Formal Verification
* Copyright (C) 2017 Application-oriented Formal Verification
* %%
* %%
* This program is free software: you can redistribute it and/or modify
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 3 of the
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
* License, or (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public
* You should have received a copy of the GNU General Public
* License along with this program. If not, see
* License along with this program. If not, see
* <http://www.gnu.org/licenses/gpl-3.0.html>.
* <http://www.gnu.org/licenses/gpl-3.0.html>.
* #L%
* #L%
*/
*/
import
edu.kit.iti.formal.psdbg.parser.ast.*
;
import
edu.kit.iti.formal.psdbg.parser.ast.*
;
...
@@ -81,4 +81,13 @@ public interface Visitor<T> {
...
@@ -81,4 +81,13 @@ public interface Visitor<T> {
T
visit
(
ClosesCase
closesCase
);
T
visit
(
ClosesCase
closesCase
);
T
visit
(
FunctionCall
func
);
T
visit
(
FunctionCall
func
);
T
visit
(
WhileStatement
ws
);
T
visit
(
IfStatement
is
);
T
visit
(
StrictBlock
strictBlock
);
T
visit
(
RelaxBlock
relaxBlock
);
}
}
lang/src/main/java/edu/kit/iti/formal/psdbg/parser/ast/ConditionalBlock.java
0 → 100644
View file @
10f6693e
package
edu.kit.iti.formal.psdbg.parser.ast
;
/*-
* #%L
* ProofScriptParser
* %%
* Copyright (C) 2017 Application-oriented Formal Verification
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/gpl-3.0.html>.
* #L%
*/
import
edu.kit.iti.formal.psdbg.parser.ScriptLanguageParser
;
import
lombok.*
;
import
org.antlr.v4.runtime.ParserRuleContext
;
/**
* @author Alexander Weigl
* @version 1 (29.04.17)
*/
@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
public
abstract
class
ConditionalBlock
extends
Statement
<
ScriptLanguageParser
.
ConditionalBlockContext
>
{
@Getter
@Setter
@NonNull
protected
Statements
body
=
new
Statements
();
@Getter
@Setter
@NonNull
protected
Expression
condition
=
BooleanLiteral
.
TRUE
;
@Override
public
boolean
eq
(
ASTNode
o
)
{
if
(
this
==
o
)
return
true
;
if
(
o
==
null
||
getClass
()
!=
o
.
getClass
())
return
false
;
if
(!
super
.
equals
(
o
))
return
false
;
ConditionalBlock
that
=
(
ConditionalBlock
)
o
;
return
getBody
()
!=
null
?
getBody
().
eq
(
that
.
getBody
())
:
that
.
getBody
()
==
null
;
}
}
lang/src/main/java/edu/kit/iti/formal/psdbg/parser/ast/ForeachStatement.java
View file @
10f6693e
...
@@ -34,7 +34,7 @@ import lombok.Setter;
...
@@ -34,7 +34,7 @@ import lombok.Setter;
*/