cstable.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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 _TABCODEGEN_H
  23. #define _TABCODEGEN_H
  24. #include <iostream>
  25. #include "cscodegen.h"
  26. /* Forwards. */
  27. struct CodeGenData;
  28. struct NameInst;
  29. struct RedTransAp;
  30. struct RedStateAp;
  31. /*
  32. * TabCodeGen
  33. */
  34. class CSharpTabCodeGen : virtual public CSharpFsmCodeGen, public CSharpCodeGen
  35. {
  36. public:
  37. CSharpTabCodeGen( ostream &out ) : CSharpFsmCodeGen(out), CSharpCodeGen(out) {}
  38. virtual ~CSharpTabCodeGen() { }
  39. virtual void writeData();
  40. virtual void writeExec();
  41. protected:
  42. std::ostream &TO_STATE_ACTION_SWITCH();
  43. std::ostream &FROM_STATE_ACTION_SWITCH();
  44. std::ostream &EOF_ACTION_SWITCH();
  45. std::ostream &ACTION_SWITCH();
  46. std::ostream &COND_KEYS();
  47. std::ostream &COND_SPACES();
  48. std::ostream &KEYS();
  49. std::ostream &INDICIES();
  50. std::ostream &COND_OFFSETS();
  51. std::ostream &KEY_OFFSETS();
  52. std::ostream &INDEX_OFFSETS();
  53. std::ostream &COND_LENS();
  54. std::ostream &SINGLE_LENS();
  55. std::ostream &RANGE_LENS();
  56. std::ostream &TO_STATE_ACTIONS();
  57. std::ostream &FROM_STATE_ACTIONS();
  58. std::ostream &EOF_ACTIONS();
  59. std::ostream &EOF_TRANS();
  60. std::ostream &TRANS_TARGS();
  61. std::ostream &TRANS_ACTIONS();
  62. std::ostream &TRANS_TARGS_WI();
  63. std::ostream &TRANS_ACTIONS_WI();
  64. void LOCATE_TRANS();
  65. void COND_TRANSLATE();
  66. void GOTO( ostream &ret, int gotoDest, bool inFinish );
  67. void CALL( ostream &ret, int callDest, int targState, bool inFinish );
  68. void NEXT( ostream &ret, int nextDest, bool inFinish );
  69. void GOTO_EXPR( ostream &ret, GenInlineItem *ilItem, bool inFinish );
  70. void NEXT_EXPR( ostream &ret, GenInlineItem *ilItem, bool inFinish );
  71. void CALL_EXPR( ostream &ret, GenInlineItem *ilItem, int targState, bool inFinish );
  72. void CURS( ostream &ret, bool inFinish );
  73. void TARGS( ostream &ret, bool inFinish, int targState );
  74. void RET( ostream &ret, bool inFinish );
  75. void BREAK( ostream &ret, int targState );
  76. virtual std::ostream &TO_STATE_ACTION( RedStateAp *state );
  77. virtual std::ostream &FROM_STATE_ACTION( RedStateAp *state );
  78. virtual std::ostream &EOF_ACTION( RedStateAp *state );
  79. virtual std::ostream &TRANS_ACTION( RedTransAp *trans );
  80. virtual void calcIndexSize();
  81. void initVarTypes();
  82. string klenType;
  83. string keysType;
  84. string signedKeysType;
  85. string transType;
  86. };
  87. #endif