private boolean makeAppl(IContext env, IStrategoString nameTerm, IStrategoTerm argsTerm) { if (argsTerm.getTermType() != IStrategoTerm.LIST) return false; String name = nameTerm.stringValue(); for (int i = 0; i < name.length(); i++) { char c = name.charAt(i); if (!(Character.isLetterOrDigit(c) || c == '_' || c == '-' || c == '+' || c == '*' || c == '$')) { name = name.substring(0, i); break; } } IStrategoList args = (IStrategoList) argsTerm; if (name.length() == 0) { // tuple env.setCurrent(env.getFactory().makeTuple(args.getAllSubterms())); } else { IStrategoConstructor cons = env.getFactory().makeConstructor(name, args.size()); env.setCurrent(env.getFactory().makeAppl(cons, args.getAllSubterms())); } return true; }
private boolean makeString(IContext env, IStrategoString input) { String value = input.stringValue(); if (!value.startsWith("\"")) return false; env.setCurrent(env.getFactory().parseFromString(value + "\"")); return true; }