Scanner EOF transitions are now taken (C/D code only).
authorthurston <thurston@052ea7fc-9027-0410-9066-f65837a77df0>
Fri, 28 Sep 2007 22:12:39 +0000 (22:12 +0000)
committerthurston <thurston@052ea7fc-9027-0410-9066-f65837a77df0>
Fri, 28 Sep 2007 22:12:39 +0000 (22:12 +0000)
git-svn-id: http://svn.complang.org/ragel/trunk@292 052ea7fc-9027-0410-9066-f65837a77df0

20 files changed:
redfsm/gendata.cpp
redfsm/redfsm.cpp
redfsm/redfsm.h
rlgen-cd/fflatcodegen.cpp
rlgen-cd/fgotocodegen.cpp
rlgen-cd/flatcodegen.cpp
rlgen-cd/flatcodegen.h
rlgen-cd/fsmcodegen.h
rlgen-cd/ftabcodegen.cpp
rlgen-cd/gotocodegen.cpp
rlgen-cd/ipgotocodegen.cpp
rlgen-cd/tabcodegen.cpp
rlgen-cd/tabcodegen.h
test/checkeofact.txl
test/cppscan3.rl
test/cppscan5.rl
test/cppscan6.rl
test/lmgoto.rl
test/rlscan.rl
test/tokstart1.rl

index 24dbd07..a656041 100644 (file)
@@ -655,6 +655,9 @@ void CodeGenData::analyzeMachine()
                
                if ( st->stateCondList.length() > 0 )
                        redFsm->bAnyConditions = true;
+
+               if ( st->eofTrans != 0 )
+                       redFsm->bAnyEofTrans = true;
        }
 
        /* Assign ids to actions that are referenced. */
index 2eadcd2..658ef90 100644 (file)
@@ -54,6 +54,7 @@ RedFsmAp::RedFsmAp()
        bAnyFromStateActions(false),
        bAnyRegActions(false),
        bAnyEofActions(false),
+       bAnyEofTrans(false),
        bAnyActionGotos(false),
        bAnyActionCalls(false),
        bAnyActionRets(false),
index b4af46b..8e53b9e 100644 (file)
@@ -422,6 +422,7 @@ struct RedFsmAp
        bool bAnyFromStateActions;
        bool bAnyRegActions;
        bool bAnyEofActions;
+       bool bAnyEofTrans;
        bool bAnyActionGotos;
        bool bAnyActionCalls;
        bool bAnyActionRets;
@@ -456,6 +457,7 @@ struct RedFsmAp
        bool anyFromStateActions()      { return bAnyFromStateActions; }
        bool anyRegActions()            { return bAnyRegActions; }
        bool anyEofActions()            { return bAnyEofActions; }
+       bool anyEofTrans()              { return bAnyEofTrans; }
        bool anyActionGotos()           { return bAnyActionGotos; }
        bool anyActionCalls()           { return bAnyActionCalls; }
        bool anyActionRets()            { return bAnyActionRets; }
index 0e6f041..71975e8 100644 (file)
@@ -226,6 +226,13 @@ void FFlatCodeGen::writeData()
                "\n";
        }
 
+       if ( redFsm->anyEofTrans() ) {
+               OPEN_ARRAY( ARRAY_TYPE(redFsm->maxIndex+1), ET() );
+               EOF_TRANS();
+               CLOSE_ARRAY() <<
+               "\n";
+       }
+
        STATE_IDS();
 }
 
@@ -288,6 +295,9 @@ void FFlatCodeGen::writeExec()
                COND_TRANSLATE();
 
        LOCATE_TRANS();
+
+       if ( redFsm->anyEofTrans() )
+               out << "_eof_trans:\n";
        
        if ( redFsm->anyRegCurStateRef() )
                out << "        _ps = " << CS() << ";\n";
@@ -341,14 +351,28 @@ void FFlatCodeGen::writeExec()
        if ( testEofUsed )
                out << "        _test_eof: {}\n";
 
-       if ( redFsm->anyEofActions() ) {
+       if ( redFsm->anyEofTrans() || redFsm->anyEofActions() ) {
                out <<
                        "       if ( " << P() << " == " << EOFV() << " )\n"
-                       "       {\n"
-                       "       switch ( " << EA() << "[" << CS() << "] ) {\n";
-                       EOF_ACTION_SWITCH();
-                       SWITCH_DEFAULT() <<
-                       "       }\n"
+                       "       {\n";
+
+               if ( redFsm->anyEofTrans() ) {
+                       out <<
+                               "       if ( " << ET() << "[" << CS() << "] > 0 ) {\n"
+                               "               _trans = " << ET() << "[" << CS() << "] - 1;\n"
+                               "               goto _eof_trans;\n"
+                               "       }\n";
+               }
+
+               if ( redFsm->anyEofActions() ) {
+                       out <<
+                               "       switch ( " << EA() << "[" << CS() << "] ) {\n";
+                               EOF_ACTION_SWITCH();
+                               SWITCH_DEFAULT() <<
+                               "       }\n";
+               }
+
+               out <<
                        "       }\n"
                        "\n";
        }
index b3b497b..2e1f195 100644 (file)
@@ -258,14 +258,33 @@ void FGotoCodeGen::writeExec()
        if ( testEofUsed )
                out << "        _test_eof: {}\n";
 
-       if ( redFsm->anyEofActions() ) {
+       if ( redFsm->anyEofTrans() || redFsm->anyEofActions() ) {
                out <<
                        "       if ( " << P() << " == " << EOFV() << " )\n"
-                       "       {\n"
-                       "       switch ( " << EA() << "[" << CS() << "] ) {\n";
-                       EOF_ACTION_SWITCH();
+                       "       {\n";
+
+               if ( redFsm->anyEofTrans() ) {
+                       out <<
+                               "       switch ( " << CS() << " ) {\n";
+
+                       for ( RedStateList::Iter st = redFsm->stateList; st.lte(); st++ ) {
+                               if ( st->eofTrans != 0 )
+                                       out << "        case " << st->id << ": goto tr" << st->eofTrans->id << ";\n";
+                       }
+
                        SWITCH_DEFAULT() <<
-                       "       }\n"
+                               "       }\n";
+               }
+
+               if ( redFsm->anyEofActions() ) {
+                       out <<
+                               "       switch ( " << EA() << "[" << CS() << "] ) {\n";
+                               EOF_ACTION_SWITCH();
+                               SWITCH_DEFAULT() <<
+                               "       }\n";
+               }
+
+               out <<
                        "       }\n"
                        "\n";
        }
index 7be6097..eb8e377 100644 (file)
@@ -228,6 +228,29 @@ std::ostream &FlatCodeGen::EOF_ACTIONS()
        return out;
 }
 
+std::ostream &FlatCodeGen::EOF_TRANS()
+{
+       out << "\t";
+       int totalStateNum = 0;
+       for ( RedStateList::Iter st = redFsm->stateList; st.lte(); st++ ) {
+               /* Write any eof action. */
+
+               long trans = 0;
+               if ( st->eofTrans != 0 )
+                       trans = st->eofTrans->id+1;
+               out << trans;
+
+               if ( !st.last() ) {
+                       out << ", ";
+                       if ( ++totalStateNum % IALL == 0 )
+                               out << "\n\t";
+               }
+       }
+       out << "\n";
+       return out;
+}
+
+
 std::ostream &FlatCodeGen::COND_KEYS()
 {
        out << '\t';
@@ -595,6 +618,13 @@ void FlatCodeGen::writeData()
                "\n";
        }
 
+       if ( redFsm->anyEofTrans() ) {
+               OPEN_ARRAY( ARRAY_TYPE(redFsm->maxIndex+1), ET() );
+               EOF_TRANS();
+               CLOSE_ARRAY() <<
+               "\n";
+       }
+
        STATE_IDS();
 }
 
@@ -713,6 +743,9 @@ void FlatCodeGen::writeExec()
 
        LOCATE_TRANS();
 
+       if ( redFsm->anyEofTrans() )
+               out << "_eof_trans:\n";
+
        if ( redFsm->anyRegCurStateRef() )
                out << "        _ps = " << CS() << ";\n";
 
@@ -774,24 +807,38 @@ void FlatCodeGen::writeExec()
        if ( testEofUsed )
                out << "        _test_eof: {}\n";
 
-       if ( redFsm->anyEofActions() ) {
+       if ( redFsm->anyEofTrans() || redFsm->anyEofActions() ) {
                out << 
                        "       if ( " << P() << " == " << EOFV() << " )\n"
-                       "       {\n"
-                       "       " << PTR_CONST() << ARRAY_TYPE(redFsm->maxActArrItem) << POINTER() << "__acts = " << 
-                                       ARR_OFF( A(), EA() + "[" + CS() + "]" ) << ";\n"
-                       "       " << UINT() << " __nacts = " << CAST(UINT()) << " *__acts++;\n"
-                       "       while ( __nacts-- > 0 ) {\n"
-                       "               switch ( *__acts++ ) {\n";
-                       EOF_ACTION_SWITCH();
-                       SWITCH_DEFAULT() <<
-                       "               }\n"
-                       "       }\n"
+                       "       {\n";
+
+               if ( redFsm->anyEofTrans() ) {
+                       out <<
+                               "       if ( " << ET() << "[" << CS() << "] > 0 ) {\n"
+                               "               _trans = " << ET() << "[" << CS() << "] - 1;\n"
+                               "               goto _eof_trans;\n"
+                               "       }\n";
+               }
+
+               if ( redFsm->anyEofActions() ) {
+                       out <<
+                               "       " << PTR_CONST() << ARRAY_TYPE(redFsm->maxActArrItem) << 
+                                               POINTER() << "__acts = " << 
+                                               ARR_OFF( A(), EA() + "[" + CS() + "]" ) << ";\n"
+                               "       " << UINT() << " __nacts = " << CAST(UINT()) << " *__acts++;\n"
+                               "       while ( __nacts-- > 0 ) {\n"
+                               "               switch ( *__acts++ ) {\n";
+                               EOF_ACTION_SWITCH();
+                               SWITCH_DEFAULT() <<
+                               "               }\n"
+                               "       }\n";
+               }
+
+               out <<
                        "       }\n"
                        "\n";
        }
 
-
        if ( outLabelUsed )
                out << "        _out: {}\n";
 
index 4497b24..651f30c 100644 (file)
@@ -54,6 +54,7 @@ protected:
        std::ostream &TO_STATE_ACTIONS();
        std::ostream &FROM_STATE_ACTIONS();
        std::ostream &EOF_ACTIONS();
+       std::ostream &EOF_TRANS();
        std::ostream &TRANS_TARGS();
        std::ostream &TRANS_ACTIONS();
        void LOCATE_TRANS();
index 9a82169..30eaa8f 100644 (file)
@@ -120,6 +120,7 @@ protected:
        string TSA() { return "_" + DATA_PREFIX() + "to_state_actions"; }
        string FSA() { return "_" + DATA_PREFIX() + "from_state_actions"; }
        string EA() { return "_" + DATA_PREFIX() + "eof_actions"; }
+       string ET() { return "_" + DATA_PREFIX() + "eof_trans"; }
        string SP() { return "_" + DATA_PREFIX() + "key_spans"; }
        string CSP() { return "_" + DATA_PREFIX() + "cond_key_spans"; }
        string START() { return DATA_PREFIX() + "start"; }
index ed49cd7..f2c484c 100644 (file)
@@ -280,6 +280,13 @@ void FTabCodeGen::writeData()
                "\n";
        }
 
+       if ( redFsm->anyEofTrans() ) {
+               OPEN_ARRAY( ARRAY_TYPE(redFsm->maxIndex+1), ET() );
+               EOF_TRANS();
+               CLOSE_ARRAY() <<
+               "\n";
+       }
+
        STATE_IDS();
 }
 
@@ -337,12 +344,15 @@ void FTabCodeGen::writeExec()
 
        out << "_match:\n";
 
-       if ( redFsm->anyRegCurStateRef() )
-               out << "        _ps = " << CS() << ";\n";
-
        if ( useIndicies )
                out << "        _trans = " << I() << "[_trans];\n";
 
+       if ( redFsm->anyEofTrans() )
+               out << "_eof_trans:\n";
+
+       if ( redFsm->anyRegCurStateRef() )
+               out << "        _ps = " << CS() << ";\n";
+
        out <<
                "       " << CS() << " = " << TT() << "[_trans];\n"
                "\n";
@@ -393,14 +403,28 @@ void FTabCodeGen::writeExec()
        if ( testEofUsed )
                out << "        _test_eof: {}\n";
 
-       if ( redFsm->anyEofActions() ) {
+       if ( redFsm->anyEofTrans() || redFsm->anyEofActions() ) {
                out <<
                        "       if ( " << P() << " == " << EOFV() << " )\n"
-                       "       {\n"
-                       "       switch ( " << EA() << "[" << CS() << "] ) {\n";
-                       EOF_ACTION_SWITCH();
-                       SWITCH_DEFAULT() <<
-                       "       }\n"
+                       "       {\n";
+
+               if ( redFsm->anyEofTrans() ) {
+                       out <<
+                               "       if ( " << ET() << "[" << CS() << "] > 0 ) {\n"
+                               "               _trans = " << ET() << "[" << CS() << "] - 1;\n"
+                               "               goto _eof_trans;\n"
+                               "       }\n";
+               }
+
+               if ( redFsm->anyEofActions() ) {
+                       out <<
+                               "       switch ( " << EA() << "[" << CS() << "] ) {\n";
+                               EOF_ACTION_SWITCH();
+                               SWITCH_DEFAULT() <<
+                               "       }\n";
+               }
+
+               out << 
                        "       }\n"
                        "\n";
        }
index ea4337e..d163013 100644 (file)
@@ -757,19 +757,39 @@ void GotoCodeGen::writeExec()
        if ( testEofUsed )
                out << "        _test_eof: {}\n";
 
-       if ( redFsm->anyEofActions() ) {
+       if ( redFsm->anyEofTrans() || redFsm->anyEofActions() ) {
                out << 
                        "       if ( " << P() << " == " << EOFV() << " )\n"
-                       "       {\n"
-                       "       " << PTR_CONST() << ARRAY_TYPE(redFsm->maxActArrItem) << POINTER() << "__acts = " << 
-                                       ARR_OFF( A(), EA() + "[" + CS() + "]" ) << ";\n"
-                       "       " << UINT() << " __nacts = " << CAST(UINT()) << " *__acts++;\n"
-                       "       while ( __nacts-- > 0 ) {\n"
-                       "               switch ( *__acts++ ) {\n";
-                       EOF_ACTION_SWITCH();
+                       "       {\n";
+
+               if ( redFsm->anyEofTrans() ) {
+                       out <<
+                               "       switch ( " << CS() << " ) {\n";
+
+                       for ( RedStateList::Iter st = redFsm->stateList; st.lte(); st++ ) {
+                               if ( st->eofTrans != 0 )
+                                       out << "        case " << st->id << ": goto tr" << st->eofTrans->id << ";\n";
+                       }
+
                        SWITCH_DEFAULT() <<
-                       "               }\n"
-                       "       }\n"
+                               "       }\n";
+               }
+
+               if ( redFsm->anyEofActions() ) {
+                       out <<
+                               "       " << PTR_CONST() << ARRAY_TYPE(redFsm->maxActArrItem) << 
+                                               POINTER() << "__acts = " << 
+                                               ARR_OFF( A(), EA() + "[" + CS() + "]" ) << ";\n"
+                               "       " << UINT() << " __nacts = " << CAST(UINT()) << " *__acts++;\n"
+                               "       while ( __nacts-- > 0 ) {\n"
+                               "               switch ( *__acts++ ) {\n";
+                               EOF_ACTION_SWITCH();
+                               SWITCH_DEFAULT() <<
+                               "               }\n"
+                               "       }\n";
+               }
+
+               out <<
                        "       }\n"
                        "\n";
        }
index 42659e3..0a35601 100644 (file)
@@ -266,6 +266,11 @@ std::ostream &IpGotoCodeGen::FINISH_CASES()
                }
        }
 
+       for ( RedStateList::Iter st = redFsm->stateList; st.lte(); st++ ) {
+               if ( st->eofTrans != 0 )
+                       out << "        case " << st->id << ": goto tr" << st->eofTrans->id << ";\n";
+       }
+
        for ( ActionTableMap::Iter act = redFsm->actionMap; act.lte(); act++ ) {
                if ( act->eofRefs != 0 ) {
                        for ( IntSet::Iter pst = *act->eofRefs; pst.lte(); pst++ )
@@ -409,7 +414,7 @@ void IpGotoCodeGen::writeExec()
        if ( testEofUsed ) 
                out << "        _test_eof: {}\n";
 
-       if ( redFsm->anyEofActions() ) {
+       if ( redFsm->anyEofTrans() || redFsm->anyEofActions() ) {
                out <<
                        "       if ( " << P() << " == " << EOFV() << " )\n"
                        "       {\n"
index 0787640..ee22831 100644 (file)
@@ -327,6 +327,29 @@ std::ostream &TabCodeGen::EOF_ACTIONS()
        return out;
 }
 
+std::ostream &TabCodeGen::EOF_TRANS()
+{
+       out << "\t";
+       int totalStateNum = 0;
+       for ( RedStateList::Iter st = redFsm->stateList; st.lte(); st++ ) {
+               /* Write any eof action. */
+
+               long trans = 0;
+               if ( st->eofTrans != 0 )
+                       trans = st->eofTrans->id+1;
+               out << trans;
+
+               if ( !st.last() ) {
+                       out << ", ";
+                       if ( ++totalStateNum % IALL == 0 )
+                               out << "\n\t";
+               }
+       }
+       out << "\n";
+       return out;
+}
+
+
 std::ostream &TabCodeGen::COND_KEYS()
 {
        out << '\t';
@@ -809,6 +832,13 @@ void TabCodeGen::writeData()
                "\n";
        }
 
+       if ( redFsm->anyEofTrans() ) {
+               OPEN_ARRAY( ARRAY_TYPE(redFsm->maxIndex+1), ET() );
+               EOF_TRANS();
+               CLOSE_ARRAY() <<
+               "\n";
+       }
+
        STATE_IDS();
 }
 
@@ -932,11 +962,14 @@ void TabCodeGen::writeExec()
 
        out << "_match:\n";
 
-       if ( redFsm->anyRegCurStateRef() )
-               out << "        _ps = " << CS() << ";\n";
-
        if ( useIndicies )
                out << "        _trans = " << I() << "[_trans];\n";
+       
+       if ( redFsm->anyEofTrans() )
+               out << "_eof_trans:\n";
+
+       if ( redFsm->anyRegCurStateRef() )
+               out << "        _ps = " << CS() << ";\n";
 
        out <<
                "       " << CS() << " = " << TT() << "[_trans];\n"
@@ -996,19 +1029,34 @@ void TabCodeGen::writeExec()
        if ( testEofUsed )
                out << "        _test_eof: {}\n";
        
-       if ( redFsm->anyEofActions() ) {
+       if ( redFsm->anyEofTrans() || redFsm->anyEofActions() ) {
                out << 
                        "       if ( " << P() << " == " << EOFV() << " )\n"
-                       "       {\n"
-                       "       " << PTR_CONST() << ARRAY_TYPE(redFsm->maxActArrItem) << 
-                                       POINTER() << "__acts = " << ARR_OFF( A(), EA() + "[" + CS() + "]" ) << ";\n"
-                       "       " << UINT() << " __nacts = " << CAST(UINT()) << " *__acts++;\n"
-                       "       while ( __nacts-- > 0 ) {\n"
-                       "               switch ( *__acts++ ) {\n";
-                       EOF_ACTION_SWITCH();
-                       SWITCH_DEFAULT() <<
-                       "               }\n"
-                       "       }\n"
+                       "       {\n";
+
+               if ( redFsm->anyEofTrans() ) {
+                       out <<
+                               "       if ( " << ET() << "[" << CS() << "] > 0 ) {\n"
+                               "               _trans = " << ET() << "[" << CS() << "] - 1;\n"
+                               "               goto _eof_trans;\n"
+                               "       }\n";
+               }
+
+               if ( redFsm->anyEofActions() ) {
+                       out <<
+                               "       " << PTR_CONST() << ARRAY_TYPE(redFsm->maxActArrItem) << 
+                                               POINTER() << "__acts = " << 
+                                               ARR_OFF( A(), EA() + "[" + CS() + "]" ) << ";\n"
+                               "       " << UINT() << " __nacts = " << CAST(UINT()) << " *__acts++;\n"
+                               "       while ( __nacts-- > 0 ) {\n"
+                               "               switch ( *__acts++ ) {\n";
+                               EOF_ACTION_SWITCH();
+                               SWITCH_DEFAULT() <<
+                               "               }\n"
+                               "       }\n";
+               }
+               
+               out << 
                        "       }\n"
                        "\n";
        }
index ea4d6d9..177896e 100644 (file)
@@ -63,6 +63,7 @@ protected:
        std::ostream &TO_STATE_ACTIONS();
        std::ostream &FROM_STATE_ACTIONS();
        std::ostream &EOF_ACTIONS();
+       std::ostream &EOF_TRANS();
        std::ostream &TRANS_TARGS();
        std::ostream &TRANS_ACTIONS();
        std::ostream &TRANS_TARGS_WI();
index d01f788..8189013 100644 (file)
@@ -66,6 +66,11 @@ rule findEof12
                '<> 'eof _ [repeat machine_expr_item]
 end rule
 
+rule findScanner
+       match [machine_expr_item]
+               '|* _ [repeat scanner_item] '*|
+end rule
+
 function findEof P [program]
        replace [program]
                _ [program]
@@ -75,6 +80,7 @@ function findEof P [program]
                        [findEof4] [findEof5] [findEof6]
                        [findEof7] [findEof8] [findEof9]
                        [findEof10] [findEof11] [findEof12]
+                       [findScanner]
        by
                'yes
 end function
index 02c96be..1dacb1f 100644 (file)
@@ -141,6 +141,7 @@ void Scanner::execute( char *data, int len )
 {
        char *p = data;
        char *pe = data + len;
+       char *eof = pe;
 
        %% write exec;
 
@@ -193,8 +194,7 @@ int main()
                "44. 44\n"
                "44 . 44\n"
                "44.44\n"
-               "_hithere22\n"
-               "\n"
+               "_hithere22"
        );
 
        test(
@@ -208,7 +208,7 @@ int main()
                "0x98\n"
                "0x\n"
                "//\n"
-               "/* * */\n"
+               "/* * */"
        );
 
        test(
@@ -246,7 +246,7 @@ int main()
 <241> 
 
 <195> _hithere22
-P: 53
+P: 51
 <193> '\''
 <192> "\n\d'\""
 <241> 
@@ -279,7 +279,7 @@ P: 53
 <242> //
 
 <242> /* * */
-P: 56
+P: 55
 P: 1
 PARSE ERROR
 #endif
index dcbb715..b7378f1 100644 (file)
@@ -142,6 +142,7 @@ class Scanner
        {
                char *p = data;
                char *pe = data + len;
+               char *eof = pe;
 
                %% write exec;
        }
@@ -185,8 +186,7 @@ int main()
                "44. 44\n"
                "44 . 44\n"
                "44.44\n"
-               "_hithere22\n"
-               "\n"
+               "_hithere22"
        );
 
        test(
@@ -200,7 +200,7 @@ int main()
                "0x98\n"
                "0x\n"
                "//\n"
-               "/* * */\n"
+               "/* * */"
        );
 
        test(
index c0fde39..f699ca0 100644 (file)
@@ -288,8 +288,8 @@ int token;
        *|;
 }%%
 /* _____INPUT_____
-"\"\\\"hi\" /!\n!/\n44 .44\n44. 44\n44 . 44\n44.44\n_hithere22\n\n"
-"'\\''\"\\n\\d'\\\"\"\nhi\n99\n.99\n99e-4\n->*\n||\n0x98\n0x\n//\n/! * !/\n"
+"\"\\\"hi\" /!\n!/\n44 .44\n44. 44\n44 . 44\n44.44\n_hithere22"
+"'\\''\"\\n\\d'\\\"\"\nhi\n99\n.99\n99e-4\n->*\n||\n0x98\n0x\n//\n/! * !/"
 "'\n'\n"
 _____INPUT_____ */
 /* _____OUTPUT_____
index 4d9dac4..36a5e78 100644 (file)
@@ -156,6 +156,7 @@ void Scanner::run( char *buf )
        %% write init;
        char *p = buf;
        char *pe = buf + len;
+       char *eof = pe;
        %% write exec;
 
        if ( cs == Scanner_error ) {
@@ -169,7 +170,7 @@ int main()
        Scanner scanner;
        scanner.run(
                "//hello*/\n"
-               "/*hi there*/ hello 0x88\n"
+               "/*hi there*/ hello 0x88"
        );
        return 0;
 }
index 24861b6..27cd655 100644 (file)
@@ -258,6 +258,7 @@ void test( char *data )
        /* Read in a block. */
        char *p = data;
        char *pe = data + strlen( data );
+       char *eof = pe;
        %% write exec;
 
        if ( cs == RagelScan_error ) {
index cdf916d..52e9544 100644 (file)
@@ -106,15 +106,11 @@ int Scanner::execute( char *data, int len )
 {
        char *p = data;
        char *pe = data + len;
+       char *eof = pe;
 
        %% write exec;
 
-       int have = 0;
-       if ( tokstart != 0 ) {
-               have = pe - tokstart;
-               memmove( data, tokstart, have );
-       }
-       return have;
+       return 0;
 }
 
 int Scanner::finish( )
@@ -237,4 +233,6 @@ from: fc =
  tokstart = 30
 to:   fc = 
  tokstart = 30
+to:   fc = 
+ tokstart = -1
 #endif