ruleMap.put(new Pattern("*/computation/literal"), new LiteralAction());
ruleMap.put(new Pattern("*/computation/add"), new AddAction());
ruleMap.put(new Pattern("*/computation/multiply"), new MultiplyAction());
Context context = new ContextBase();
SimpleConfigurator simpleConfigurator = new SimpleConfigurator(ruleMap);
// link the configurator with its context
simpleConfigurator.setContext(context);
try {
simpleConfigurator.doConfigure(args[0]);
} catch (JoranException e) {
// Print any errors that might have occured.
StatusPrinter.print(context);
}
}