Automaton automaton = type.automaton();
HashMap<String, Integer> roots = new HashMap<String, Integer>();
HashMap<Integer,Integer> visited = new HashMap<Integer,Integer>();
ArrayList<Automaton.State> states = new ArrayList<Automaton.State>();
for(int i=0;i!=automaton.nStates();++i) {
states.add(automaton.get(i).clone());
}
int root = expand(automaton.getRoot(0), states, visited,
roots, macros);
automaton = new Automaton(states.toArray(new Automaton.State[states.size()]));