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

Simplify null handling a bit in alternative code generation

parent 25dc7c45
No related branches found
No related tags found
No related merge requests found
......@@ -80,7 +80,7 @@ public class GenerateAlternativeCodeForParser extends DepthFirstAdapter
{
if("null".equals(typeName))
{
throw new IllegalArgumentException("Null values have no variable name");
return "null";
}
else if(typeName.startsWith("L"))
{
......@@ -156,16 +156,8 @@ public class GenerateAlternativeCodeForParser extends DepthFirstAdapter
position = CG.getTermNumbers().get(term);
if("null".equals(type_name))
{
macros.apply(file, "ParserNewBodyListAddNull", null);
}
else
{
macros.apply(file, "ParserNewBodyListAdd", new String[] {getVariableName(type_name, position)});
}
}
if (popCount > 0) {
// The nodeArrayList variables are numbered starting at 1, so the first popped variable has the number popCount and not popCount-1.
macros.apply(file, "ParserNewCheck", new String[] {String.valueOf(popCount)});
......@@ -344,14 +336,7 @@ public class GenerateAlternativeCodeForParser extends DepthFirstAdapter
type_name = lookupInternalTypeName(term);
position = CG.getTermNumbers().get(term);
if(type_name.equals("null"))
{
macros.apply(file, "ParserNewBodyParam", new String[] {isNotTheFirstParam+"null"});
}
else
{
macros.apply(file, "ParserNewBodyParam", new String[] {isNotTheFirstParam + getVariableName(type_name, position)});
}
isNotTheFirstParam = ", ";
}
......
......@@ -386,11 +386,6 @@ Macro:ParserNewBodyListAdd
$
Macro:ParserNewBodyListAddNull
nodeList.add(null);
$
Macro:ParserNewCheck
checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList$0$);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment