A fix to the documentation makefile from John D. Mitchell.
[ragel.git] / rlgen-ruby / rbx-gotocodegen.h
blobe779f0a6fe5625b8e2b4a06bba35a6acfea15600
1 /*
2 * Copyright 2007 Victor Hugo Borja <vic@rubyforge.org>
3 * 2006-2007 Adrian Thurston <thurston@cs.queensu.ca>
4 */
6 /* This file is part of Ragel.
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.
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.
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
23 #ifndef _RBX_GOTOCODEGEN_H
24 #define _RBX_GOTOCODEGEN_H
26 #include <iostream>
27 #include <string>
28 #include "ruby-codegen.h"
30 using std::string;
32 class RbxGotoCodeGen : public RubyCodeGen
34 public:
35 RbxGotoCodeGen( ostream &out ) : RubyCodeGen(out) {}
36 virtual ~RbxGotoCodeGen() {}
38 std::ostream &TO_STATE_ACTION_SWITCH();
39 std::ostream &FROM_STATE_ACTION_SWITCH();
40 std::ostream &EOF_ACTION_SWITCH();
41 std::ostream &ACTION_SWITCH();
42 std::ostream &STATE_GOTOS();
43 std::ostream &TRANSITIONS();
44 std::ostream &EXEC_FUNCS();
45 std::ostream &FINISH_CASES();
47 void GOTO( ostream &ret, int gotoDest, bool inFinish );
48 void CALL( ostream &ret, int callDest, int targState, bool inFinish );
49 void NEXT( ostream &ret, int nextDest, bool inFinish );
50 void GOTO_EXPR( ostream &ret, GenInlineItem *ilItem, bool inFinish );
51 void NEXT_EXPR( ostream &ret, GenInlineItem *ilItem, bool inFinish );
52 void CALL_EXPR( ostream &ret, GenInlineItem *ilItem, int targState, bool inFinish );
53 void CURS( ostream &ret, bool inFinish );
54 void TARGS( ostream &ret, bool inFinish, int targState );
55 void RET( ostream &ret, bool inFinish );
56 void BREAK( ostream &ret, int targState );
58 int TO_STATE_ACTION( RedStateAp *state );
59 int FROM_STATE_ACTION( RedStateAp *state );
60 int EOF_ACTION( RedStateAp *state );
62 void COND_TRANSLATE( GenStateCond *stateCond, int level );
63 void emitCondBSearch( RedStateAp *state, int level, int low, int high );
64 void STATE_CONDS( RedStateAp *state, bool genDefault );
66 virtual std::ostream &TRANS_GOTO( RedTransAp *trans, int level );
68 void emitSingleSwitch( RedStateAp *state );
69 void emitRangeBSearch( RedStateAp *state, int level, int low, int high );
71 /* Called from STATE_GOTOS just before writing the gotos */
72 virtual void GOTO_HEADER( RedStateAp *state );
73 virtual void STATE_GOTO_ERROR();
75 virtual void writeData();
76 virtual void writeEOF();
77 virtual void writeExec();
80 std::ostream &TO_STATE_ACTIONS();
81 std::ostream &FROM_STATE_ACTIONS();
82 std::ostream &EOF_ACTIONS();
84 private:
85 ostream &rbxGoto(ostream &out, string label);
86 ostream &rbxLabel(ostream &out, string label);
90 * Local Variables:
91 * mode: c++
92 * indent-tabs-mode: 1
93 * c-file-style: "bsd"
94 * End:
97 #endif