final Environment local = actorEnv.newFrame();
final InputPattern[] inputPatterns = action.getInputPatterns();
for (int i = 0; i < inputPatterns.length; i++) {
final InputPattern inputPattern = inputPatterns[i];
final String[] vars = inputPattern.getVariables();
final Expression repExpr = inputPattern.getRepeatExpr();
if (repExpr == null) {
for (int j = 0; j < vars.length; j++) {
final InputChannel channel = ((InputPort) (inputPortMap
.get(inputPattern.getPortname()))).getChannel(0); // FIXME
local.bind(vars[j], new SingleTokenReaderThunk(channel, j));
}
} else {
SimpleThunk repExprThunk = new SimpleThunk(repExpr, context,
local);
local.bind(new EnvironmentKey(inputPattern.getPortname()),
repExprThunk);
for (int j = 0; j < vars.length; j++) {
final InputChannel channel = ((InputPort) (inputPortMap
.get(inputPattern.getPortname()))).getChannel(0); // FIXME
local.bind(vars[j], new MultipleTokenReaderThunk(channel,
j, vars.length, repExprThunk, context));
}
}
}