* Computes the union of two grammars.
*/
private Grammar union( Grammar g1, Grammar g2 ) {
// either g1.getPool() or g2.getPool() is OK.
// this is just a metter of performance problem.
final ExpressionPool pool = g1.getPool();
final Expression top = pool.createChoice(g1.getTopLevel(),g2.getTopLevel());
return new Grammar() {
public ExpressionPool getPool() {
return pool;
}