Permalink
Browse files

Wrap lists with constructor if a constructor is defined in production…

… in JSGLR2 imploding
  • Loading branch information...
jasperdenkers committed Jun 18, 2018
1 parent d62e39f commit be4d6328ece94c6558502a5eac9cef5c147a51da
@@ -154,9 +154,14 @@ protected Tree createContextFreeTerm(IProduction production, List<Tree> childAST
IToken rightToken) {
String constructor = production.constructor();
if(production.isList())
return treeFactory.createList(production.sort(), childASTs, leftToken, rightToken);
else if(production.isOptional())
if(production.isList()) {
Tree list = treeFactory.createList(production.sort(), childASTs, leftToken, rightToken);
if(constructor == null)
return list;
else
return treeFactory.createNonTerminal(production.sort(), constructor, Arrays.asList(list), leftToken, rightToken);
} else if(production.isOptional())
return treeFactory.createOptional(production.sort(), childASTs, leftToken, rightToken);
else if(constructor != null)
return treeFactory.createNonTerminal(production.sort(), constructor, childASTs, leftToken, rightToken);

0 comments on commit be4d632

Please sign in to comment.