summaryrefslogtreecommitdiff
path: root/src/gotoexp.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/gotoexp.cc')
-rw-r--r--src/gotoexp.cc208
1 files changed, 0 insertions, 208 deletions
diff --git a/src/gotoexp.cc b/src/gotoexp.cc
deleted file mode 100644
index dea9029c..00000000
--- a/src/gotoexp.cc
+++ /dev/null
@@ -1,208 +0,0 @@
-/*
- * Copyright 2001-2018 Adrian Thurston <thurston@colm.net>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#include "ragel.h"
-#include "gotoexp.h"
-#include "redfsm.h"
-#include "gendata.h"
-#include "bstmap.h"
-#include "parsedata.h"
-#include "inputdata.h"
-
-std::ostream &GotoExp::EXEC_FUNCS()
-{
- /* Loop the actions. */
- for ( GenActionTableMap::Iter redAct = redFsm->actionMap; redAct.lte(); redAct++ ) {
- if ( redAct->numTransRefs > 0 ) {
- /* We are at the start of a glob, write the case. */
- out << "f" << redAct->actListId << ":\n";
-
- if ( redFsm->anyRegNbreak() )
- out << nbreak << " = 0;\n";
-
- /* Write each action in the list of action items. */
- for ( GenActionTable::Iter item = redAct->key; item.lte(); item++ )
- ACTION( out, item->value, IlOpts( 0, false, false ) );
-
- if ( redFsm->anyRegNbreak() ) {
- out <<
- " if ( " << nbreak << " == 1 )\n"
- " goto " << _out << ";\n";
- }
-
-
- out << "goto " << _again << ";\n";
- }
- }
- return out;
-}
-
-/* Write out the function switch. This switch is keyed on the values
- * of the func index. */
-std::ostream &GotoExp::TO_STATE_ACTION_SWITCH()
-{
- /* Loop the actions. */
- for ( GenActionTableMap::Iter redAct = redFsm->actionMap; redAct.lte(); redAct++ ) {
- if ( redAct->numToStateRefs > 0 ) {
- /* Write the entry label. */
- out << "\t" << CASE( STR( redAct->actListId+1 ) ) << "{\n";
-
- /* Write each action in the list of action items. */
- for ( GenActionTable::Iter item = redAct->key; item.lte(); item++ )
- ACTION( out, item->value, IlOpts( 0, false, false ) );
-
- out << "\n\t" << CEND() << "\n}\n";
- }
- }
-
- return out;
-}
-
-/* Write out the function switch. This switch is keyed on the values
- * of the func index. */
-std::ostream &GotoExp::FROM_STATE_ACTION_SWITCH()
-{
- /* Loop the actions. */
- for ( GenActionTableMap::Iter redAct = redFsm->actionMap; redAct.lte(); redAct++ ) {
- if ( redAct->numFromStateRefs > 0 ) {
- /* Write the entry label. */
- out << "\t" << CASE( STR( redAct->actListId+1 ) ) << "{\n";
-
- /* Write each action in the list of action items. */
- for ( GenActionTable::Iter item = redAct->key; item.lte(); item++ )
- ACTION( out, item->value, IlOpts( 0, false, false ) );
-
- out << "\n\t" << CEND() << "\n}\n";
- }
- }
-
- return out;
-}
-
-std::ostream &GotoExp::EOF_ACTION_SWITCH()
-{
- /* Loop the actions. */
- for ( GenActionTableMap::Iter redAct = redFsm->actionMap; redAct.lte(); redAct++ ) {
- if ( redAct->numEofRefs > 0 ) {
- /* Write the entry label. */
- out << "\t" << CASE( STR( redAct->actListId+1 ) ) << "{\n";
-
- /* Write each action in the list of action items. */
- for ( GenActionTable::Iter item = redAct->key; item.lte(); item++ )
- ACTION( out, item->value, IlOpts( 0, true, false ) );
-
- out << "\n\t" << CEND() << "\n}\n";
- }
- }
-
- return out;
-}
-
-unsigned int GotoExp::TO_STATE_ACTION( RedStateAp *state )
-{
- int act = 0;
- if ( state->toStateAction != 0 )
- act = state->toStateAction->actListId+1;
- return act;
-}
-
-unsigned int GotoExp::FROM_STATE_ACTION( RedStateAp *state )
-{
- int act = 0;
- if ( state->fromStateAction != 0 )
- act = state->fromStateAction->actListId+1;
- return act;
-}
-
-unsigned int GotoExp::EOF_ACTION( RedStateAp *state )
-{
- int act = 0;
- if ( state->eofAction != 0 )
- act = state->eofAction->actListId+1;
- return act;
-}
-
-void GotoExp::NFA_PUSH_ACTION( RedNfaTarg *targ )
-{
- int act = 0;
- if ( targ->push != 0 )
- act = targ->push->actListId+1;
- nfaPushActions.value( act );
-}
-
-void GotoExp::NFA_POP_TEST( RedNfaTarg *targ )
-{
- int act = 0;
- if ( targ->popTest != 0 )
- act = targ->popTest->actListId+1;
- nfaPopTrans.value( act );
-}
-
-
-void GotoExp::NFA_FROM_STATE_ACTION_EXEC()
-{
- if ( redFsm->anyFromStateActions() ) {
- out <<
- " switch ( " << ARR_REF( fromStateActions ) << "[nfa_bp[nfa_len].state] ) {\n";
- FROM_STATE_ACTION_SWITCH() <<
- " }\n"
- "\n";
- }
-}
-
-void GotoExp::FROM_STATE_ACTIONS()
-{
- if ( redFsm->anyFromStateActions() ) {
- out <<
- " switch ( " << ARR_REF( fromStateActions ) << "[" << vCS() << "] ) {\n";
- FROM_STATE_ACTION_SWITCH() <<
- " }\n"
- "\n";
- }
-}
-
-void GotoExp::TO_STATE_ACTIONS()
-{
- if ( redFsm->anyToStateActions() ) {
- out <<
- " switch ( " << ARR_REF( toStateActions ) << "[" << vCS() << "] ) {\n";
- TO_STATE_ACTION_SWITCH() <<
- " }\n"
- "\n";
- }
-}
-
-void GotoExp::REG_ACTIONS()
-{
-
-}
-
-void GotoExp::EOF_ACTIONS()
-{
- if ( redFsm->anyEofActions() ) {
- out <<
- " switch ( " << ARR_REF( eofActions ) << "[" << vCS() << "] ) {\n";
- EOF_ACTION_SWITCH() <<
- " }\n";
- }
-
-}