www.pudn.com > cppcc.rar > basic_dfa_spec.cc


/*
 *  File:       basic_dfa_spec.cc
 *              $Id: basic_dfa_spec.cc,v 1.2 2002/07/09 03:04:58 alec Exp $
 *
 *  Author:     Alec Panoviciu (alecu@email.com)
 * 
 *  Comments:
 *
 *  Revision history:
 *
 *  $Log: basic_dfa_spec.cc,v $
 *  Revision 1.2  2002/07/09 03:04:58  alec
 *  OWN_STRINGS bu*beep*it finally vanished
 *  gcc 3.1&mingw - related cleanups
 *
 *  Revision 1.1  2002/05/01 16:34:01  alec
 *  *** empty log message ***
 *
 */

/*
  Copyright (C) 2002 Alexandru Panoviciu (alecu@email.com)

  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 2 of the License, or
  (at your option) any later version.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program; if not, write to the Free Software
  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

 */


#include "basic_dfa_spec.hh"

#ifdef DEBUG

#include 

void BasicDfaSpec::dump (ostream &os)
{
  os << "DFA : " << name << endl;

  for (int i = 0; i < states.size(); i++) {
    os << "State #" << i << ": ";
    states[i].dump(os);
  }
}

void BasicDfaSpec::State::dump(ostream &os)
{
  if (isFinal) os << "(Final =>" << tokId << ") " << endl;
  else os << endl;

  for (int i = 0; i < transitions.size(); i++)
    os << "\t\t\'" << transitions[i].on << "\' -> " << transitions[i].to << endl;
}

#endif