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
ffcbe160
Commit
ffcbe160
authored
Feb 22, 2016
by
Michael Schwarz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Works for last as well
parent
18eeec17
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
9 deletions
+27
-9
CupPlugin/src/de/tum/in/www2/cupplugin/views/ReduceReduceReorder.java
...c/de/tum/in/www2/cupplugin/views/ReduceReduceReorder.java
+27
-9
No files found.
CupPlugin/src/de/tum/in/www2/cupplugin/views/ReduceReduceReorder.java
View file @
ffcbe160
...
...
@@ -73,25 +73,43 @@ public class ReduceReduceReorder {
int
index
=
1
;
int
start
=
pr
.
getRange
().
getBegin
().
getOffsetFromStart
();
int
end
=
0
;
String
pString
=
""
;
for
(
int
i
=
0
;
i
<
rhs
.
size
();
i
++){
if
(
rhs
.
get
(
i
).
equals
(
pr
)){
index
=
i
;
break
;
}
}
if
(
index
==
rhs
.
size
()-
1
){
//TODO: take care of the SEMI
if
(
index
==
0
){
end
=
rhs
.
get
(
1
).
getRange
().
getBegin
().
getOffsetFromStart
();
pString
=
p
.
getName
().
name
+
" ::= "
+
document
.
get
(
start
,
end
-(
start
))
+
";"
;
toInsert
=
"\n\n//Separated and moved by CUP Eclipse plugin\n"
+
pString
;
//We want to remove the leading | as well
rangesToRemove
.
add
(
new
RangeToRemove
(
start
,(
end
-
start
)+
1
));
}
else
if
(
index
==
rhs
.
size
()-
1
){
end
=
pr
.
getRange
().
getEnd
().
getOffsetFromStart
();
// +1 here because we don't need the |
pString
=
p
.
getName
().
name
+
" ::= "
+
document
.
get
(
start
+
1
,
end
-(
start
+
1
))
+
";"
;
toInsert
=
"\n\n//Separated and moved by CUP Eclipse plugin\n"
+
pString
;
// But we want to remove the entire thing
rangesToRemove
.
add
(
new
RangeToRemove
(
start
,
end
-
start
));
}
else
{
end
=
rhs
.
get
(
index
+
1
).
getRange
().
getBegin
().
getOffsetFromStart
();
// +1 here because we don't need the |
pString
=
p
.
getName
().
name
+
" ::= "
+
document
.
get
(
start
+
1
,
end
-(
start
+
1
))
+
";"
;
toInsert
=
"\n\n//Separated and moved by CUP Eclipse plugin\n"
+
pString
;
// But we want to remove the entire thing
rangesToRemove
.
add
(
new
RangeToRemove
(
start
,
end
-
start
));
}
// +1 here because we don't need the |
String
pString
=
p
.
getName
().
name
+
"::="
+
document
.
get
(
start
+
1
,
end
-(
start
+
1
))
+
";"
;
toInsert
=
"\n\n//Separated and moved by CUP Eclipse plugin\n"
+
pString
;
// But we want to remove the entire thing
rangesToRemove
.
add
(
new
RangeToRemove
(
start
,
end
-
start
));
}
catch
(
BadLocationException
e
)
{
// TODO Auto-generated catch block
...
...
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