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
Branches
Tags
No related merge requests found
Pipeline #118022 passed
Source diff could not be displayed: it is too large. Options to address this: view the blob.
......@@ -7,9 +7,9 @@ import java.util.List;
final class 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.nodes = nodes;
......
......@@ -45,7 +45,7 @@ public class Parser implements IParser
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<?>) {
/*
* special case: this is a list of nodes, for example an identifier
......@@ -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);
if (first instanceof List<?>) {
List<?> list2 = (List<?>) first;
......@@ -101,7 +101,7 @@ public class Parser implements IParser
return (PositionedNode)first;
}
private PositionedNode findEndNode(final List<Object> list) {
private PositionedNode findEndNode(final List<?> list) {
Object last = list.get(list.size() - 1);
if (last instanceof List<?>) {
final List<?> list2 = (List<?>) last;
......@@ -111,7 +111,7 @@ public class Parser implements IParser
return (PositionedNode)last;
}
private void push(int numstate, List<Object> listNode)
private void push(int numstate, List<?> listNode)
{
if(!this.stack.hasNext())
{
......@@ -161,7 +161,7 @@ public class Parser implements IParser
return s.state;
}
private List<Object> pop()
private List<?> pop()
{
return this.stack.previous().nodes;
}
......@@ -221,7 +221,7 @@ public class Parser implements IParser
{
case SHIFT:
{
List<Object> list = Collections.<Object>singletonList(this.lexer.next());
List<?> list = Collections.singletonList(this.lexer.next());
push(destination, list);
}
break;
......@@ -234,7 +234,7 @@ $
Macro:ParserParseReduce
case $0$: /* reduce $2$ */
{
List<Object> list = new$0$();
List<?> list = new$0$();
push(goTo($1$), list);
}
break;
......@@ -264,13 +264,13 @@ $
Macro:ParserNewHeader
private List<Object> new$0$() /* reduce $1$ */
private List<?> new$0$() /* reduce $1$ */
{
$
Macro:ParserNewBodyDecl
List<Object> nodeArrayList$0$ = pop();
List<?> nodeArrayList$0$ = pop();
$
......@@ -352,7 +352,7 @@ Macro:ParserNewTailEmpty
$
Macro:ParserNewTailSingle
return Collections.<Object>singletonList($0$);
return Collections.singletonList($0$);
}
$
......@@ -583,9 +583,9 @@ import java.util.List;
final class 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.nodes = nodes;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment