//  FILE. . . . . /home/hak/ilt/src/ilog/old-rif/ParserCode.grm
//  EDIT BY . . . Hassan Ait-Kaci
//  ON MACHINE. . 4j4zn71
//  STARTED ON. . Fri Mar 16 12:53:10 2007

//  Last modified on Thu Mar 29 08:32:21 2007 by hak

%import java.io.PrintStream;
%import ilog.language.tools.Misc;

%{
  long start;
  boolean quiet = true;
  PrintStream out = System.out;

  void setStart ()
    {
      start = System.currentTimeMillis();
    }

  void setQuiet (boolean flag)
    {
      quiet = flag;
    }

  void setOutputStream (PrintStream stream)
    {
      out = stream;
    }

  /*
   * A function to show what happened.
   */
  void showXml ()
    {
      out.println("*** Total parsing time = "
                 +(System.currentTimeMillis()-start)
                 +" ms");

      if (!quiet)
        {
          errorManager().tallyErrors();
          if (Misc.askYesNo("*** Do you want to see the XML serialization"))
            {
              out.println();
	      try
		{
		  writeXml(currentNode(),System.out);
		}
	      catch (Exception e)
		{
		  e.printStackTrace();
		}	      
//               currentNode().display();
              out.println();
            }
        }
    }
%}
