" _nacts = " << CAST("int") << " " << A() << "[_acts++];\n"
" while ( _nacts-- > 0 ) {\n"
" switch ( " << A() << "[_acts++] ) {\n";
- FROM_STATE_ACTION_SWITCH();
- SWITCH_DEFAULT() <<
+ FROM_STATE_ACTION_SWITCH() <<
" }\n"
" }\n"
"\n";
" while ( _nacts-- > 0 )\n {\n"
" switch ( " << A() << "[_acts++] )\n"
" {\n";
- ACTION_SWITCH();
- SWITCH_DEFAULT() <<
+ ACTION_SWITCH() <<
" }\n"
" }\n"
"\n";
" _nacts = " << CAST("int") << " " << A() << "[_acts++];\n"
" while ( _nacts-- > 0 ) {\n"
" switch ( " << A() << "[_acts++] ) {\n";
- TO_STATE_ACTION_SWITCH();
- SWITCH_DEFAULT() <<
+ TO_STATE_ACTION_SWITCH() <<
" }\n"
" }\n"
"\n";
" int _nacts = " << CAST("int") << " " << A() << "[_acts++];\n"
" while ( _nacts-- > 0 ) {\n"
" switch ( " << A() << "[_acts++] ) {\n";
- EOF_ACTION_SWITCH();
- SWITCH_DEFAULT() <<
+ EOF_ACTION_SWITCH() <<
" }\n"
" }\n"
"\n";
}
}
-string JavaTabCodeGen::PTR_CONST()
-{
- /* Not used in Java code. */
- assert( false );
- return "final";
-}
-
std::ostream &JavaTabCodeGen::OPEN_ARRAY( string type, string name )
{
array_type = type;
return out;
}
-string JavaTabCodeGen::UINT( )
-{
- /* Not used. */
- assert( false );
- return "long";
-}
-
string JavaTabCodeGen::ARR_OFF( string ptr, string offset )
{
return ptr + " + " + offset;
return "-1";
}
-string JavaTabCodeGen::POINTER()
-{
- /* Not used. */
- assert( false );
- return " *";
-}
-
-std::ostream &JavaTabCodeGen::SWITCH_DEFAULT()
-{
- return out;
-}
-
string JavaTabCodeGen::GET_KEY()
{
ostringstream ret;
public:
virtual string NULL_ITEM();
- virtual string POINTER();
- virtual ostream &SWITCH_DEFAULT();
virtual ostream &OPEN_ARRAY( string type, string name );
virtual ostream &START_ARRAY_LINE();
virtual ostream &ARRAY_ITEM( int item, int count, bool last );
virtual ostream &STATIC_VAR( string type, string name );
virtual string ARR_OFF( string ptr, string offset );
virtual string CAST( string type );
- virtual string UINT();
- virtual string PTR_CONST();
virtual string GET_KEY();
virtual string CTRL_FLOW();
<< INDENT_S() << "_nacts -= 1"
<< INDENT_S() << " _acts += 1"
<< INDENT_U() << "case " << A() << "[_acts - 1]" ;
- FROM_STATE_ACTION_SWITCH();
- SWITCH_DEFAULT()
+ FROM_STATE_ACTION_SWITCH()
<< INDENT_D() << "end # from state action switch"
<< INDENT_D() << "end"
<< INDENT_S();
<< INDENT_S() << "_nacts -= 1"
<< INDENT_S() << "_acts += 1"
<< INDENT_U() << "case " << A() << "[_acts - 1]" ;
- ACTION_SWITCH();
- SWITCH_DEFAULT()
+ ACTION_SWITCH()
<< INDENT_D() << "end # action switch"
<< INDENT_D() << "end"
<< INDENT_S();
<< INDENT_S() << "_nacts -= 1"
<< INDENT_S() << "_acts += 1"
<< INDENT_U() << "case " << A() << "[acts - 1]" ;
- TO_STATE_ACTION_SWITCH();
- SWITCH_DEFAULT()
+ TO_STATE_ACTION_SWITCH()
<< INDENT_D() << "end # to state action switch"
<< INDENT_D() << "end"
<< INDENT_S();
<< INDENT_S() << "_nacts -= 1"
<< INDENT_S() << "_acts += 1"
<< INDENT_S() << "case " << A() << "[_acts - 1]" ;
- EOF_ACTION_SWITCH();
- SWITCH_DEFAULT()
+ EOF_ACTION_SWITCH()
<< INDENT_D() << "end # eof action switch"
<< INDENT_D() << "end"
<< INDENT_S();
out << INDENT_D() << "end";
}
-string RubyCodeGen::PTR_CONST()
-{
- /* Not used in Ruby code. */
- assert( false );
- return "final";
-}
-
std::ostream &RubyCodeGen::OPEN_ARRAY( string type, string name )
{
out << "class << self" << endl
return out;
}
-string RubyCodeGen::UINT( )
-{
- /* Not used. */
- assert( false );
- return "long";
-}
-
string RubyCodeGen::ARR_OFF( string ptr, string offset )
{
return ptr + " + " + offset;
}
-string RubyCodeGen::CAST( string type )
-{
- /* No casts on ruby */
- assert( false );
- return "";
-}
-
string RubyCodeGen::NULL_ITEM()
{
return "nil";
}
-string RubyCodeGen::POINTER()
-{
- /* Not used. */
- assert( false );
- return " *";
-}
-
-std::ostream &RubyCodeGen::SWITCH_DEFAULT()
-{
- return out;
-}
-
string RubyCodeGen::GET_KEY()
{
ostringstream ret;
virtual void writeStatement( InputLoc &loc, int nargs, char **args );
virtual string NULL_ITEM();
- virtual string POINTER();
- virtual ostream &SWITCH_DEFAULT();
virtual ostream &OPEN_ARRAY( string type, string name );
virtual ostream &CLOSE_ARRAY();
virtual ostream &STATIC_VAR( string type, string name );
virtual string ARR_OFF( string ptr, string offset );
- virtual string CAST( string type );
- virtual string UINT();
- virtual string PTR_CONST();
virtual string GET_KEY();
virtual string CTRL_FLOW();
virtual void ACTION( ostream &ret, Action *action, int targState, bool inFinish );