Some cleanup of code. These functions are not needed in Java and Ruby code
authorthurston <thurston@052ea7fc-9027-0410-9066-f65837a77df0>
Sun, 4 Feb 2007 18:27:10 +0000 (18:27 +0000)
committerthurston <thurston@052ea7fc-9027-0410-9066-f65837a77df0>
Sun, 4 Feb 2007 18:27:10 +0000 (18:27 +0000)
generation.

git-svn-id: http://svn.complang.org/ragel/trunk@76 052ea7fc-9027-0410-9066-f65837a77df0

rlgen-java/javacodegen.cpp
rlgen-java/javacodegen.h
rlgen-ruby/rubycodegen.cpp
rlgen-ruby/rubycodegen.h

index ad74c73..996ac38 100644 (file)
@@ -998,8 +998,7 @@ void JavaTabCodeGen::writeOutExec()
                        "       _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";
@@ -1030,8 +1029,7 @@ void JavaTabCodeGen::writeOutExec()
                        "       while ( _nacts-- > 0 )\n        {\n"
                        "               switch ( " << A() << "[_acts++] )\n"
                        "               {\n";
-                       ACTION_SWITCH();
-                       SWITCH_DEFAULT() <<
+                       ACTION_SWITCH() <<
                        "               }\n"
                        "       }\n"
                        "\n";
@@ -1046,8 +1044,7 @@ void JavaTabCodeGen::writeOutExec()
                        "       _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";
@@ -1082,21 +1079,13 @@ void JavaTabCodeGen::writeOutEOF()
                        "       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;
@@ -1159,13 +1148,6 @@ std::ostream &JavaTabCodeGen::STATIC_VAR( string type, string name )
        return out;
 }
 
-string JavaTabCodeGen::UINT( )
-{
-       /* Not used. */
-       assert( false );
-       return "long";
-}
-
 string JavaTabCodeGen::ARR_OFF( string ptr, string offset )
 {
        return ptr + " + " + offset;
@@ -1182,18 +1164,6 @@ string JavaTabCodeGen::NULL_ITEM()
        return "-1";
 }
 
-string JavaTabCodeGen::POINTER()
-{
-       /* Not used. */
-       assert( false );
-       return " *";
-}
-
-std::ostream &JavaTabCodeGen::SWITCH_DEFAULT()
-{
-       return out;
-}
-
 string JavaTabCodeGen::GET_KEY()
 {
        ostringstream ret;
index 3efa83e..66000a9 100644 (file)
@@ -96,8 +96,6 @@ private:
 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 );
@@ -106,8 +104,6 @@ public:
        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();
 
index ad7d11b..b35ecbf 100644 (file)
@@ -223,8 +223,7 @@ void RubyCodeGen::writeOutExec()
                        << 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();
@@ -253,8 +252,7 @@ void RubyCodeGen::writeOutExec()
                        << 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();
@@ -272,8 +270,7 @@ void RubyCodeGen::writeOutExec()
                        << 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();
@@ -297,8 +294,7 @@ void RubyCodeGen::writeOutEOF()
                        << 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();
@@ -389,13 +385,6 @@ void RubyCodeGen::writeOutInit()
        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
@@ -420,42 +409,16 @@ std::ostream &RubyCodeGen::STATIC_VAR( string type, string name )
        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;
index f864e9c..31d9377 100644 (file)
@@ -186,15 +186,10 @@ public:
        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 );