Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
CUP Eclipse Plugin
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Dr. Michael Petter
CUP Eclipse Plugin
Commits
4004e645
Commit
4004e645
authored
Feb 21, 2016
by
Michael Schwarz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
disable conflicts where no choice can be made without inserting cycle
parent
df3d8605
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
7 deletions
+36
-7
CupPlugin/src/de/tum/in/www2/cupplugin/views/ConflictPanel.java
...gin/src/de/tum/in/www2/cupplugin/views/ConflictPanel.java
+15
-2
CupPlugin/src/de/tum/in/www2/cupplugin/views/PrecedenceToInsert.java
...rc/de/tum/in/www2/cupplugin/views/PrecedenceToInsert.java
+21
-5
No files found.
CupPlugin/src/de/tum/in/www2/cupplugin/views/ConflictPanel.java
View file @
4004e645
...
...
@@ -409,8 +409,11 @@ class ConflictPanel extends Composite {
if
(
srdetails
.
shiftAndReducePrecedenceFromSameTerminal
()){
resolutionOptions
.
setEnabled
(
forceEnableDropdown
);
}
else
{
resolutionOptions
.
setEnabled
(
pti
.
canChangeDefaultResolution
(
srdetails
));
}
}
if
(
pti
.
isResolvedInFavorOfShift
(
srdetails
)){
else
if
(
pti
.
isResolvedInFavorOfShift
(
srdetails
)){
resolutionOptions
.
select
(
1
);
resolutionOptions
.
setEnabled
(
true
);
...
...
@@ -418,9 +421,12 @@ class ConflictPanel extends Composite {
if
(
srdetails
.
shiftAndReducePrecedenceFromSameTerminal
()){
resolutionOptions
.
setEnabled
(
forceEnableDropdown
);
}
else
{
resolutionOptions
.
setEnabled
(
pti
.
canChangeDefaultResolution
(
srdetails
));
}
}
if
(
pti
.
isResolvedAsError
(
srdetails
)){
else
if
(
pti
.
isResolvedAsError
(
srdetails
)){
resolutionOptions
.
select
(
3
);
resolutionOptions
.
setEnabled
(
true
);
...
...
@@ -428,6 +434,13 @@ class ConflictPanel extends Composite {
if
(
srdetails
.
shiftAndReducePrecedenceFromSameTerminal
()){
resolutionOptions
.
setEnabled
(
forceEnableDropdown
);
}
else
{
resolutionOptions
.
setEnabled
(
pti
.
canChangeDefaultResolution
(
srdetails
));
}
}
else
{
resolutionOptions
.
select
(
0
);
resolutionOptions
.
setEnabled
(
true
);
}
resolutionButton
.
setEnabled
(
false
);
...
...
CupPlugin/src/de/tum/in/www2/cupplugin/views/PrecedenceToInsert.java
View file @
4004e645
...
...
@@ -116,6 +116,17 @@ class PrecedenceToInsert {
return
precs
.
containsKey
(
srd
.
shift
)
||
precs
.
containsKey
(
srd
.
reduce
);
}
/**
* Returns true if the default way of resolving can be changed by inserting precedences.
* Undefined if there is no default way of resolving this conflict
* @param srd S
* @return true iff it can be changed
*/
public
boolean
canChangeDefaultResolution
(
ShiftReduceDetails
srd
){
return
!((
precs
.
containsKey
(
srd
.
shift
)
||
originalEdge
.
getFirst
().
equals
(
srd
.
shift
))
&&
(
precs
.
containsKey
(
srd
.
reduce
)
||
originalEdge
.
getFirst
().
equals
(
srd
.
reduce
)));
}
/**
* Insert terminal precedence t over other. other is not inserted into the set of precedences because it might not be necessary to resolve
* a conflict to insert both precs. However, the possible edge is recorded and will be added later on if it becomes necessary
...
...
@@ -138,7 +149,16 @@ class PrecedenceToInsert {
* @throws PrecedenceCyclicException if this would induce a cyclic precedence. In this case the action is not performed
*/
public
void
addPrecedence
(
terminal
higher
,
terminal
lower
)
throws
PrecedenceCyclicException
{
boolean
addedHigher
=
false
,
addedLower
=
false
;
boolean
addedHigher
=
false
;
// Lower is guaranteed to be part of the current conflict,
// otherwise we would not need to insert prec since
// - not affected
// - resolved the way we want it to be resolved anyway
if
(!
precs
.
containsKey
(
lower
)){
throw
new
IllegalArgumentException
(
"This conflict is either not part of the set of affected conflicts,"
+
" or it is resolved in this way even without adding the precedence"
);
}
// Make sure all terminals are represented within the precs
if
(!
precs
.
containsKey
(
higher
)){
...
...
@@ -148,10 +168,6 @@ class PrecedenceToInsert {
addedHigher
=
true
;
}
// Lower is guaranteed to be part of the current conflict,
// otherwise we would not need to insert prec since
// - not affected
// - resolved the way we want it to be resolved anyway
if
(
originalEdge
.
getFirst
().
equals
(
higher
)){
// We know the for original edge u->v that u is present since u == higher
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment