dotcodegen.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*
  2. * Copyright 2001-2007 Adrian Thurston <thurston@complang.org>
  3. */
  4. /* This file is part of Ragel.
  5. *
  6. * Ragel is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * Ragel is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with Ragel; if not, write to the Free Software
  18. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  19. */
  20. #ifndef _GVDOTGEN_H
  21. #define _GVDOTGEN_H
  22. #include <iostream>
  23. #include "gendata.h"
  24. class GraphvizDotGen : public CodeGenData
  25. {
  26. public:
  27. GraphvizDotGen( ostream &out ) : CodeGenData(out) { }
  28. /* Print an fsm to out stream. */
  29. void writeTransList( RedStateAp *state );
  30. void writeDotFile( );
  31. virtual void finishRagelDef();
  32. virtual bool writeStatement( InputLoc &, int, char ** );
  33. private:
  34. /* Writing labels and actions. */
  35. std::ostream &ONCHAR( Key lowKey, Key highKey );
  36. std::ostream &TRANS_ACTION( RedStateAp *fromState, RedTransAp *trans );
  37. std::ostream &ACTION( RedAction *action );
  38. std::ostream &KEY( Key key );
  39. };
  40. #endif