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
Michael Schwarz
CUP Eclipse Plugin
Commits
0c1acc13
Commit
0c1acc13
authored
Feb 27, 2016
by
Michael Schwarz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
group productions that start with the same nonterminal
bugfix: check if there are precs before collapsing
parent
79495e5b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
51 additions
and
5 deletions
+51
-5
CupPlugin/src/de/tum/in/www2/cupplugin/Pair.java
CupPlugin/src/de/tum/in/www2/cupplugin/Pair.java
+8
-0
CupPlugin/src/de/tum/in/www2/cupplugin/editors/CupContentOutlinePage.java
.../tum/in/www2/cupplugin/editors/CupContentOutlinePage.java
+43
-5
No files found.
CupPlugin/src/de/tum/in/www2/cupplugin/Pair.java
View file @
0c1acc13
...
...
@@ -13,6 +13,14 @@ public class Pair<A, B> {
return
second
;
}
public
void
setFirst
(
A
first
){
this
.
first
=
first
;
}
public
void
setSecond
(
B
second
){
this
.
second
=
second
;
}
public
Pair
(
A
first
,
B
second
)
{
this
.
first
=
first
;
this
.
second
=
second
;
...
...
CupPlugin/src/de/tum/in/www2/cupplugin/editors/CupContentOutlinePage.java
View file @
0c1acc13
...
...
@@ -50,6 +50,7 @@ import de.in.tum.www2.cup.ast.Terminal;
import
de.in.tum.www2.cup.ast.TerminalDeclaration
;
import
de.in.tum.www2.cup.ast.TypedNonTerminalDeclaration
;
import
de.in.tum.www2.cup.ast.TypedTerminalDeclaration
;
import
de.tum.in.www2.cupplugin.Pair
;
import
de.tum.in.www2.cupplugin.controller.Controller
;
import
de.tum.in.www2.cupplugin.controller.Controller.JobsToDo
;
import
de.tum.in.www2.cupplugin.controller.IRegisterForControllerChanges
;
...
...
@@ -170,9 +171,15 @@ public class CupContentOutlinePage extends ContentOutlinePage implements
// Even though we expanded before, we want to collapse decls and precs
// and imports
viewer
.
setExpandedState
(
visitor
.
getDecls
(),
false
);
viewer
.
setExpandedState
(
visitor
.
getPrecs
(),
false
);
viewer
.
setExpandedState
(
visitor
.
getImports
(),
false
);
viewer
.
setExpandedState
(
visitor
.
getDecls
(),
false
);
if
(
visitor
.
getPrecs
()
!=
null
){
viewer
.
setExpandedState
(
visitor
.
getPrecs
(),
false
);
}
if
(
visitor
.
getImports
()
!=
null
){
viewer
.
setExpandedState
(
visitor
.
getImports
(),
false
);
}
}
finally
{
viewer
.
getTree
().
setRedraw
(
true
);
...
...
@@ -198,6 +205,7 @@ public class CupContentOutlinePage extends ContentOutlinePage implements
private
List
<
OutlineEntry
>
children
;
private
boolean
_isFolder
;
public
boolean
isFolder
()
{
return
_isFolder
;
}
...
...
@@ -258,7 +266,36 @@ public class CupContentOutlinePage extends ContentOutlinePage implements
private
OutlineEntry
precs
;
private
OutlineEntry
productions
;
private
OutlineEntry
imports
;
// Keeps track of the position of the last production for an NT
private
List
<
Pair
<
String
,
Integer
>>
productionPos
=
new
ArrayList
<>();
// Returns the index at which to insert the production
private
int
getPlaceToAddProductionFor
(
String
nonterminal
){
boolean
found
=
false
;
int
pos
=
productionCount
;
for
(
int
i
=
0
;
i
<
productionPos
.
size
();
i
++){
if
(
found
){
// Increment end position of all following
productionPos
.
get
(
i
).
setSecond
(
productionPos
.
get
(
i
).
getSecond
()+
1
);
}
else
if
(
nonterminal
.
equals
(
productionPos
.
get
(
i
).
getFirst
())){
found
=
true
;
//insert right after current last
pos
=
productionPos
.
get
(
i
).
getSecond
()+
1
;
//increase length
productionPos
.
get
(
i
).
setSecond
(
productionPos
.
get
(
i
).
getSecond
()+
1
);
}
}
if
(
pos
==
productionCount
){
// Not in yet, insert at the very end
productionPos
.
add
(
new
Pair
<>(
nonterminal
,
productionCount
));
}
return
pos
;
}
public
OutlineEntry
getTree
()
{
return
root
;
}
...
...
@@ -321,7 +358,8 @@ public class CupContentOutlinePage extends ContentOutlinePage implements
this
.
productions
=
OutlineEntry
.
folderFromNode
(
"Productions"
);
root
.
children
.
add
(
productions
);
}
productions
.
children
.
add
(
entry
);
productions
.
children
.
add
(
getPlaceToAddProductionFor
(
entry
.
id
),
entry
);
productionCount
++;
}
...
...
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