Skip to content
Snippets Groups Projects
Commit 825f5dab authored by dgelessus's avatar dgelessus
Browse files

Weaken type of parser state lists from List<Object> to List<?>

parent f9083efa
No related branches found
No related tags found
No related merge requests found
Pipeline #118022 passed
This diff is collapsed.
...@@ -7,9 +7,9 @@ import java.util.List; ...@@ -7,9 +7,9 @@ import java.util.List;
final class State final class State
{ {
int state; int state;
List<Object> nodes; // elements are of type Node or List<Node> List<?> nodes; // elements are of type Node or List<Node>
State(int state, List<Object> nodes) State(int state, List<?> nodes)
{ {
this.state = state; this.state = state;
this.nodes = nodes; this.nodes = nodes;
......
...@@ -45,7 +45,7 @@ public class Parser implements IParser ...@@ -45,7 +45,7 @@ public class Parser implements IParser
this.lexer = lexer; this.lexer = lexer;
} }
private void checkResult(Object elementToCheck, List<Object> beginNodeList, List<Object> endNodeList) { private void checkResult(Object elementToCheck, List<?> beginNodeList, List<?> endNodeList) {
if (elementToCheck instanceof List<?>) { if (elementToCheck instanceof List<?>) {
/* /*
* special case: this is a list of nodes, for example an identifier * special case: this is a list of nodes, for example an identifier
...@@ -86,7 +86,7 @@ public class Parser implements IParser ...@@ -86,7 +86,7 @@ public class Parser implements IParser
} }
} }
private PositionedNode findBeginNode(final List<Object> list) { private PositionedNode findBeginNode(final List<?> list) {
Object first = list.get(0); Object first = list.get(0);
if (first instanceof List<?>) { if (first instanceof List<?>) {
List<?> list2 = (List<?>) first; List<?> list2 = (List<?>) first;
...@@ -101,7 +101,7 @@ public class Parser implements IParser ...@@ -101,7 +101,7 @@ public class Parser implements IParser
return (PositionedNode)first; return (PositionedNode)first;
} }
private PositionedNode findEndNode(final List<Object> list) { private PositionedNode findEndNode(final List<?> list) {
Object last = list.get(list.size() - 1); Object last = list.get(list.size() - 1);
if (last instanceof List<?>) { if (last instanceof List<?>) {
final List<?> list2 = (List<?>) last; final List<?> list2 = (List<?>) last;
...@@ -111,7 +111,7 @@ public class Parser implements IParser ...@@ -111,7 +111,7 @@ public class Parser implements IParser
return (PositionedNode)last; return (PositionedNode)last;
} }
private void push(int numstate, List<Object> listNode) private void push(int numstate, List<?> listNode)
{ {
if(!this.stack.hasNext()) if(!this.stack.hasNext())
{ {
...@@ -161,7 +161,7 @@ public class Parser implements IParser ...@@ -161,7 +161,7 @@ public class Parser implements IParser
return s.state; return s.state;
} }
private List<Object> pop() private List<?> pop()
{ {
return this.stack.previous().nodes; return this.stack.previous().nodes;
} }
...@@ -221,7 +221,7 @@ public class Parser implements IParser ...@@ -221,7 +221,7 @@ public class Parser implements IParser
{ {
case SHIFT: case SHIFT:
{ {
List<Object> list = Collections.<Object>singletonList(this.lexer.next()); List<?> list = Collections.singletonList(this.lexer.next());
push(destination, list); push(destination, list);
} }
break; break;
...@@ -234,7 +234,7 @@ $ ...@@ -234,7 +234,7 @@ $
Macro:ParserParseReduce Macro:ParserParseReduce
case $0$: /* reduce $2$ */ case $0$: /* reduce $2$ */
{ {
List<Object> list = new$0$(); List<?> list = new$0$();
push(goTo($1$), list); push(goTo($1$), list);
} }
break; break;
...@@ -264,13 +264,13 @@ $ ...@@ -264,13 +264,13 @@ $
Macro:ParserNewHeader Macro:ParserNewHeader
private List<Object> new$0$() /* reduce $1$ */ private List<?> new$0$() /* reduce $1$ */
{ {
$ $
Macro:ParserNewBodyDecl Macro:ParserNewBodyDecl
List<Object> nodeArrayList$0$ = pop(); List<?> nodeArrayList$0$ = pop();
$ $
...@@ -352,7 +352,7 @@ Macro:ParserNewTailEmpty ...@@ -352,7 +352,7 @@ Macro:ParserNewTailEmpty
$ $
Macro:ParserNewTailSingle Macro:ParserNewTailSingle
return Collections.<Object>singletonList($0$); return Collections.singletonList($0$);
} }
$ $
...@@ -583,9 +583,9 @@ import java.util.List; ...@@ -583,9 +583,9 @@ import java.util.List;
final class State final class State
{ {
int state; int state;
List<Object> nodes; // elements are of type Node or List<Node> List<?> nodes; // elements are of type Node or List<Node>
State(int state, List<Object> nodes) State(int state, List<?> nodes)
{ {
this.state = state; this.state = state;
this.nodes = nodes; this.nodes = nodes;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment