return vf.constructor(Factory.Symbol_Seq, list);
}
if (name.equals("opt")) {
IConstructor arg = x.getArguments().get(0).accept(this);
return vf.constructor(Factory.Symbol_Opt, arg);
}
if (name.equals("alt")) {
ISet set = vf.set(Factory.Symbol);
Expression.Set arg = (Set) x.getArguments().get(0);
for(Expression y: arg.getElements()){
set = set.insert(y.accept(this));
}
return vf.constructor(Factory.Symbol_Alt, set);
}
if (name.equals("tuple")) {
java.util.List<Expression> args = x.getArguments();
IConstructor head = args.get(0).accept(this);
IList rest = vf.list(Factory.Symbol);
for (Expression arg: ((Expression.List)args.get(1)).getElements()) {
rest = rest.append(arg.accept(this));
}
return vf.constructor(Factory.Symbol_Tuple, head, rest);
}
if (name.equals("sort")) {
StringConstant.Lexical arg = (org.rascalmpl.ast.StringConstant.Lexical)
x.getArguments().get(0).getLiteral().getStringLiteral().getConstant();
String str = arg.getString();
str = str.substring(1, str.length() - 1);
return vf.constructor(Factory.Symbol_Sort, vf.string(str));
}
if (name.equals("layouts")) {
StringConstant.Lexical arg = (org.rascalmpl.ast.StringConstant.Lexical)
x.getArguments().get(0).getLiteral().getStringLiteral().getConstant();
String str = arg.getString();
str = str.substring(1, str.length() - 1);
return vf.constructor(Factory.Symbol_LayoutX, vf.string(str));
}
if (name.equals("iter")) {
IConstructor arg = x.getArguments().get(0).accept(this);
return vf.constructor(Factory.Symbol_IterPlus, arg);
}
if (name.equals("iter-star")) {
IConstructor arg = x.getArguments().get(0).accept(this);
return vf.constructor(Factory.Symbol_IterStar, arg);
}
if (name.equals("iter-star-seps")) {
IConstructor arg = x.getArguments().get(0).accept(this);
Expression.List args = (Expression.List) x.getArguments().get(1);
IList seps = vf.list(Factory.Args);
for (Expression elem: args.getElements()) {
seps = seps.append(elem.accept(this));
}
return vf.constructor(Factory.Symbol_IterStarSepX, arg, seps);
}
if (name.equals("iter-seps")) {
IConstructor arg = x.getArguments().get(0).accept(this);
Expression.List args = (Expression.List) x.getArguments().get(1);
IList seps = vf.list(Factory.Args);
for (Expression elem: args.getElements()) {
seps = seps.append(elem.accept(this));
}
return vf.constructor(Factory.Symbol_IterSepX, arg, seps);
}
if (name.equals("parameterized-sort")) {
java.util.List<Expression> args = x.getArguments();
StringConstant.Lexical sort = (org.rascalmpl.ast.StringConstant.Lexical)
x.getArguments().get(0).getLiteral().getStringLiteral().getConstant();
IList rest = vf.list(Factory.Symbol);
for (Expression arg: ((Expression.List)args.get(1)).getElements()) {
rest = rest.append(arg.accept(this));
}
return vf.constructor(Factory.Symbol_ParameterizedSort, vf.string(sort.getString()), rest);
}
if (name.equals("lit")) {
StringConstant.Lexical arg = (org.rascalmpl.ast.StringConstant.Lexical)
x.getArguments().get(0).getLiteral().getStringLiteral().getConstant();
// TODO: escaping etc.
return vf.constructor(Factory.Symbol_Lit, vf.string(arg.getString()));
}
if (name.equals("char-class")) {
java.util.List<Expression> args = x.getArguments();
IList ranges = vf.list(Factory.CharRange);
for (Expression arg: ((Expression.List)args.get(0)).getElements()) {
ranges = ranges.append(arg.accept(this));
}
return vf.constructor(Factory.Symbol_CharClass, ranges);
}
if (name.equals("single")) {