cdfflat.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /*
  2. * Copyright 2004-2006 Adrian Thurston <thurston@complang.org>
  3. * 2004 Erich Ocean <eric.ocean@ampede.com>
  4. * 2005 Alan West <alan@alanz.com>
  5. */
  6. /* This file is part of Ragel.
  7. *
  8. * Ragel is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation; either version 2 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * Ragel is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with Ragel; if not, write to the Free Software
  20. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  21. */
  22. #ifndef _CDFFLAT_H
  23. #define _CDFFLAT_H
  24. #include <iostream>
  25. #include "cdflat.h"
  26. /* Forwards. */
  27. struct CodeGenData;
  28. /*
  29. * FFlatCodeGen
  30. */
  31. class FFlatCodeGen : public FlatCodeGen
  32. {
  33. protected:
  34. FFlatCodeGen( ostream &out ) : FsmCodeGen(out), FlatCodeGen(out) {}
  35. std::ostream &TO_STATE_ACTION_SWITCH();
  36. std::ostream &FROM_STATE_ACTION_SWITCH();
  37. std::ostream &EOF_ACTION_SWITCH();
  38. std::ostream &ACTION_SWITCH();
  39. virtual std::ostream &TO_STATE_ACTION( RedStateAp *state );
  40. virtual std::ostream &FROM_STATE_ACTION( RedStateAp *state );
  41. virtual std::ostream &EOF_ACTION( RedStateAp *state );
  42. virtual std::ostream &TRANS_ACTION( RedTransAp *trans );
  43. virtual void writeData();
  44. virtual void writeExec();
  45. };
  46. /*
  47. * CFFlatCodeGen
  48. */
  49. struct CFFlatCodeGen
  50. : public FFlatCodeGen, public CCodeGen
  51. {
  52. CFFlatCodeGen( ostream &out ) :
  53. FsmCodeGen(out), FFlatCodeGen(out), CCodeGen(out) {}
  54. };
  55. /*
  56. * DFFlatCodeGen
  57. */
  58. struct DFFlatCodeGen
  59. : public FFlatCodeGen, public DCodeGen
  60. {
  61. DFFlatCodeGen( ostream &out ) :
  62. FsmCodeGen(out), FFlatCodeGen(out), DCodeGen(out) {}
  63. };
  64. /*
  65. * D2FFlatCodeGen
  66. */
  67. struct D2FFlatCodeGen
  68. : public FFlatCodeGen, public D2CodeGen
  69. {
  70. D2FFlatCodeGen( ostream &out ) :
  71. FsmCodeGen(out), FFlatCodeGen(out), D2CodeGen(out) {}
  72. };
  73. #endif