Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Michael Schwarz
CUP Eclipse Plugin
Commits
24da6c0e
Commit
24da6c0e
authored
Feb 19, 2016
by
Michael Schwarz
🤔
Browse files
fixed bug when no precedence for reduce is given
parent
2d58e6e1
Changes
3
Hide whitespace changes
Inline
Side-by-side
CupPlugin/src/de/tum/in/www2/cupplugin/views/ConflictPanel.java
View file @
24da6c0e
...
...
@@ -404,7 +404,7 @@ class ConflictPanel extends Composite {
resolutionOptions
.
setEnabled
(
true
);
// Used assoc to sort out. Can't be changed anymore (unless this is the start)
if
(
srdetails
.
reduce
.
equals
(
srdetails
.
shift
)){
if
(
srdetails
.
shiftAndReducePrecedenceFromSameTerminal
(
)){
resolutionOptions
.
setEnabled
(
forceEnableDropdown
);
}
}
...
...
@@ -413,7 +413,7 @@ class ConflictPanel extends Composite {
resolutionOptions
.
setEnabled
(
true
);
// Used assoc to sort out. Can't be changed anymore
if
(
srdetails
.
reduce
.
equals
(
srdetails
.
shift
)){
if
(
srdetails
.
shiftAndReducePrecedenceFromSameTerminal
(
)){
resolutionOptions
.
setEnabled
(
forceEnableDropdown
);
}
}
...
...
@@ -423,7 +423,7 @@ class ConflictPanel extends Composite {
resolutionOptions
.
setEnabled
(
true
);
// Used assoc to sort out. Can't be changed anymore (unless this is the start)
if
(
srdetails
.
reduce
.
equals
(
srdetails
.
shift
)){
if
(
srdetails
.
shiftAndReducePrecedenceFromSameTerminal
(
)){
resolutionOptions
.
setEnabled
(
forceEnableDropdown
);
}
}
...
...
CupPlugin/src/de/tum/in/www2/cupplugin/views/CupConflictsView.java
View file @
24da6c0e
...
...
@@ -194,7 +194,6 @@ public class CupConflictsView extends FailableView implements ICupEditorPageVisi
int
size
=
conflicts
.
size
();
scrolled
.
setLayoutDeferred
(
true
);
matchPanelNumber
(
size
);
// Do this first, otherwise the affects others is wrong because it operates on a subset of actual terminals
terminalsAffectConflicts
=
new
HashMap
<>();
...
...
@@ -202,7 +201,8 @@ public class CupConflictsView extends FailableView implements ICupEditorPageVisi
Conflict
conflict
=
conflicts
.
get
(
i
);
addToTerminalSet
(
crm
,
conflict
);
}
matchPanelNumber
(
size
);
for
(
int
i
=
0
;
i
<
size
;
i
++)
{
Conflict
conflict
=
conflicts
.
get
(
i
);
ConflictPanel
panel
=
conflictPanels
.
get
(
i
);
...
...
CupPlugin/src/de/tum/in/www2/cupplugin/views/PrecedenceToInsert.java
View file @
24da6c0e
...
...
@@ -79,7 +79,7 @@ class PrecedenceToInsert {
* @return true iff conflict is resolved in favor of Shift
*/
public
boolean
isResolvedInFavorOfShift
(
ShiftReduceDetails
srd
){
if
(!
srd
.
shift
.
equals
(
srd
.
reduce
))
if
(!
srd
.
shift
AndReducePrecedenceFromSameTerminal
(
))
//TODO: Check if precedence set for terminal at all
return
hasPrecedence
(
srd
.
shift
,
srd
.
reduce
);
else
...
...
@@ -92,7 +92,7 @@ class PrecedenceToInsert {
* @return true iff conflict is resolved in favor of Reduce
*/
public
boolean
isResolvedInFavorOfReduce
(
ShiftReduceDetails
srd
)
{
if
(!
srd
.
shift
.
equals
(
srd
.
reduce
))
if
(!
srd
.
shift
AndReducePrecedenceFromSameTerminal
(
))
//TODO: Check if precedence set for terminal at all
return
hasPrecedence
(
srd
.
reduce
,
srd
.
shift
);
else
...
...
@@ -106,7 +106,7 @@ class PrecedenceToInsert {
* @return true iff conflict is resolved as error
*/
public
boolean
isResolvedAsError
(
ShiftReduceDetails
srd
)
{
if
(!
srd
.
reduce
.
equals
(
srd
.
shift
))
if
(!
srd
.
shiftAndReducePrecedenceFromSameTerminal
(
))
return
false
;
else
return
precs
.
get
(
srd
.
shift
)
==
Precedence
.
Type
.
NonAssoc
;
...
...
Write
Preview
Supports
Markdown
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