rubyflat.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. /*
  2. * 2007 Victor Hugo Borja <vic@rubyforge.org>
  3. * Copyright 2001-2007 Adrian Thurston <thurston@complang.org>
  4. */
  5. /* This file is part of Ragel.
  6. *
  7. * Ragel is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 2 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * Ragel is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with Ragel; if not, write to the Free Software
  19. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  20. */
  21. #ifndef _RUBY_FLATCODEGEN_H
  22. #define _RUBY_FLATCODEGEN_H
  23. #include <iostream>
  24. #include "rubycodegen.h"
  25. using std::string;
  26. using std::ostream;
  27. /*
  28. * FlatCodeGen
  29. */
  30. class RubyFlatCodeGen : public RubyCodeGen
  31. {
  32. public:
  33. RubyFlatCodeGen( ostream &out ) :
  34. RubyCodeGen(out) {};
  35. virtual ~RubyFlatCodeGen() {}
  36. protected:
  37. std::ostream &TO_STATE_ACTION_SWITCH();
  38. std::ostream &FROM_STATE_ACTION_SWITCH();
  39. std::ostream &EOF_ACTION_SWITCH();
  40. std::ostream &ACTION_SWITCH();
  41. std::ostream &KEYS();
  42. std::ostream &INDICIES();
  43. std::ostream &FLAT_INDEX_OFFSET();
  44. std::ostream &KEY_SPANS();
  45. std::ostream &TO_STATE_ACTIONS();
  46. std::ostream &FROM_STATE_ACTIONS();
  47. std::ostream &EOF_ACTIONS();
  48. std::ostream &EOF_TRANS();
  49. std::ostream &TRANS_TARGS();
  50. std::ostream &TRANS_ACTIONS();
  51. void LOCATE_TRANS();
  52. std::ostream &COND_INDEX_OFFSET();
  53. void COND_TRANSLATE();
  54. std::ostream &CONDS();
  55. std::ostream &COND_KEYS();
  56. std::ostream &COND_KEY_SPANS();
  57. void GOTO( ostream &ret, int gotoDest, bool inFinish );
  58. void CALL( ostream &ret, int callDest, int targState, bool inFinish );
  59. void NEXT( ostream &ret, int nextDest, bool inFinish );
  60. void GOTO_EXPR( ostream &ret, GenInlineItem *ilItem, bool inFinish );
  61. void NEXT_EXPR( ostream &ret, GenInlineItem *ilItem, bool inFinish );
  62. void CALL_EXPR( ostream &ret, GenInlineItem *ilItem, int targState, bool inFinish );
  63. void CURS( ostream &ret, bool inFinish );
  64. void TARGS( ostream &ret, bool inFinish, int targState );
  65. void RET( ostream &ret, bool inFinish );
  66. void BREAK( ostream &ret, int targState );
  67. virtual int TO_STATE_ACTION( RedStateAp *state );
  68. virtual int FROM_STATE_ACTION( RedStateAp *state );
  69. virtual int EOF_ACTION( RedStateAp *state );
  70. virtual int TRANS_ACTION( RedTransAp *trans );
  71. virtual void writeData();
  72. virtual void writeExec();
  73. };
  74. #endif
  75. /*
  76. * Local Variables:
  77. * mode: c++
  78. * indent-tabs-mode: 1
  79. * c-file-style: "bsd"
  80. * End:
  81. */