cdftable.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. /*
  2. * Copyright 2001-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 _CDFTABLE_H
  23. #define _CDFTABLE_H
  24. #include <iostream>
  25. #include "cdtable.h"
  26. /* Forwards. */
  27. struct CodeGenData;
  28. /*
  29. * FTabCodeG\verb|e
  30. */
  31. class FTabCodeGen : public TabCodeGen
  32. {
  33. protected:
  34. FTabCodeGen( ostream &out ) : FsmCodeGen(out), TabCodeGen(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. virtual void calcIndexSize();
  46. };
  47. /*
  48. * CFTabCodeGen
  49. */
  50. struct CFTabCodeGen
  51. : public FTabCodeGen, public CCodeGen
  52. {
  53. CFTabCodeGen( ostream &out ) :
  54. FsmCodeGen(out), FTabCodeGen(out), CCodeGen(out) {}
  55. };
  56. /*
  57. * class DFTabCodeGen
  58. */
  59. struct DFTabCodeGen
  60. : public FTabCodeGen, public DCodeGen
  61. {
  62. DFTabCodeGen( ostream &out ) :
  63. FsmCodeGen(out), FTabCodeGen(out), DCodeGen(out) {}
  64. };
  65. /*
  66. * class D2FTabCodeGen
  67. */
  68. struct D2FTabCodeGen
  69. : public FTabCodeGen, public D2CodeGen
  70. {
  71. D2FTabCodeGen( ostream &out ) :
  72. FsmCodeGen(out), FTabCodeGen(out), D2CodeGen(out) {}
  73. };
  74. #endif