Fixes for ruby 1.9.
authorthurston <thurston@052ea7fc-9027-0410-9066-f65837a77df0>
Sat, 5 Jan 2008 21:05:44 +0000 (21:05 +0000)
committerthurston <thurston@052ea7fc-9027-0410-9066-f65837a77df0>
Sat, 5 Jan 2008 21:05:44 +0000 (21:05 +0000)
git-svn-id: http://svn.complang.org/ragel/trunk@379 052ea7fc-9027-0410-9066-f65837a77df0

rlgen-ruby/ruby-tabcodegen.cpp
test/atoi1.rl
test/atoi2.rl
test/cond1.rl
test/langtrans_ruby.sh
test/langtrans_ruby.txl

index b979682..42fd479 100644 (file)
@@ -158,7 +158,7 @@ void RubyTabCodeGen::COND_TRANSLATE()
 
        for ( CondSpaceList::Iter csi = condSpaceList; csi.lte(); csi++ ) {
                CondSpace *condSpace = csi;
-               out << "        when " << condSpace->condSpaceId << ":" ;
+               out << "        when " << condSpace->condSpaceId << " then" ;
                out << "        _widec = " << KEY(condSpace->baseKey) << 
                                "+ (" << GET_KEY() << " - " << KEY(keyOps->minKey) << ")\n";
 
@@ -447,7 +447,7 @@ std::ostream &RubyTabCodeGen::FROM_STATE_ACTION_SWITCH()
                /* Write out referenced actions. */
                if ( act->numFromStateRefs > 0 ) {
                        /* Write the case label, the action */
-                       out << "                        when " << act->actionId << ":\n";
+                       out << "                        when " << act->actionId << " then\n";
                        ACTION( out, act, 0, false );
                }
        }
@@ -464,7 +464,7 @@ std::ostream &RubyTabCodeGen::TO_STATE_ACTION_SWITCH()
                /* Write out referenced actions. */
                if ( act->numToStateRefs > 0 ) {
                        /* Write the case label, the action and the case break. */
-                       out << "when " << act->actionId << "\n";
+                       out << "when " << act->actionId << " then\n";
                        ACTION( out, act, 0, false );
                }
        }
@@ -480,7 +480,7 @@ std::ostream &RubyTabCodeGen::EOF_ACTION_SWITCH()
                /* Write out referenced actions. */
                if ( act->numEofRefs > 0 ) {
                        /* Write the case label, the action and the case break. */
-                       out << "when " << act->actionId << ":\n";
+                       out << "when " << act->actionId << " then\n";
                        ACTION( out, act, 0, true );
                }
        }
@@ -496,7 +496,7 @@ std::ostream &RubyTabCodeGen::ACTION_SWITCH()
                /* Write out referenced actions. */
                if ( act->numTransRefs > 0 ) {
                        /* Write the case label, the action and the case break. */
-                       out << "when " << act->actionId << ":\n";
+                       out << "when " << act->actionId << " then\n";
                        ACTION( out, act, 0, false );
                }
        }
index 60fc959..ea706c8 100644 (file)
@@ -19,7 +19,7 @@ neg = false;
        }
 
        action add_digit { 
-               val = val * 10 + (fc - '0');
+               val = val * 10 + (fc - 48);
        }
 
        action finish {
index e16380a..923e88f 100644 (file)
@@ -20,7 +20,7 @@ neg = false;
        }
 
        action add_digit { 
-               val = val * 10 + (fc - '0');
+               val = val * 10 + (fc - 48);
        }
 
        action finish {
index 620ea5e..8d6796a 100644 (file)
@@ -16,9 +16,9 @@ bool k;
        action two { prints "  two\n";}
        action three { prints "  three\n";}
 
-       action seti { if ( fc == '0' ) i = false; else i = true; }
-       action setj { if ( fc == '0' ) j = false; else j = true; }
-       action setk { if ( fc == '0' ) k = false; else k = true; }
+       action seti { if ( fc == 48 ) i = false; else i = true; }
+       action setj { if ( fc == 48 ) j = false; else j = true; }
+       action setk { if ( fc == 48 ) k = false; else k = true; }
 
        action break {fbreak;}
 
index 3caa660..ab3282b 100755 (executable)
@@ -74,7 +74,7 @@ END {
 cat << EOF
 
        inp.each { |str| 
-               run_machine(str)
+               run_machine(str.unpack("c*"))
        }
 
 EOF
index 5c1ce1a..6acfb5a 100644 (file)
@@ -258,7 +258,8 @@ function alStmtToRuby4d AlStmt [action_lang_stmt]
                'print_token ';
        replace [repeat ruby_lang_stmt]
        by
-               'print '( 'data '[tokstart..tokend-1] ') ';
+               '_m = 'data '[tokstart..tokend-1] ';
+               'print '( '_m '. 'pack '( '"c*" ') ') ';
 end function
 
 function alStmtToRuby5 AlStmt [action_lang_stmt]