From d8f6df9fa3932acaa7417c0ce52221ccbe7e8667 Mon Sep 17 00:00:00 2001 From: Adrian Thurston Date: Sun, 7 Nov 2021 14:25:02 -0800 Subject: moved writeStatement into InputData in ragel Write statement belongs in ragel, but can't yet move out CodeGenData. It's at the base of many codegen classes that will live in colm. The functionality here needs to be lifted up out of the base. --- src/libfsm/gendata.cc | 85 --------------------------------------------------- src/libfsm/gendata.h | 7 ----- 2 files changed, 92 deletions(-) (limited to 'src') diff --git a/src/libfsm/gendata.cc b/src/libfsm/gendata.cc index 4e3253ad..718b0d38 100644 --- a/src/libfsm/gendata.cc +++ b/src/libfsm/gendata.cc @@ -1645,88 +1645,3 @@ void CodeGenData::collectReferences() out.rdbuf( filt ); } } - -void CodeGenData::writeStatement( InputLoc &loc, int nargs, - std::vector &args, bool generateDot, const HostLang *hostLang ) -{ - /* Start write generation on a fresh line. */ - out << '\n'; - - if ( cleared ) { - red->id->error(loc) << "write statement following a clear is invalid" << std::endl; - return; - } - - genOutputLineDirective( out ); - - if ( args[0] == "data" ) { - for ( int i = 1; i < nargs; i++ ) { - if ( args[i] == "noerror" ) - noError = true; - else if ( args[i] == "noprefix" ) - noPrefix = true; - else if ( args[i] == "nofinal" ) - noFinal = true; - else - write_option_error( loc, args[i] ); - } - - if ( red->id->printStatistics ) { - red->id->stats() << "fsm-name\t" << fsmName << std::endl; - red->id->stats() << "fsm-states\t" << redFsm->stateList.length() << std::endl; - } - - collectReferences(); - writeData(); - statsSummary(); - } - else if ( args[0] == "init" ) { - for ( int i = 1; i < nargs; i++ ) { - if ( args[i] == "nocs" ) - noCS = true; - else - write_option_error( loc, args[i] ); - } - writeInit(); - } - else if ( args[0] == "exec" ) { - for ( int i = 1; i < nargs; i++ ) { - if ( args[i] == "noend" ) - noEnd = true; - else - write_option_error( loc, args[i] ); - } - collectReferences(); - writeExec(); - } - else if ( args[0] == "exports" ) { - for ( int i = 1; i < nargs; i++ ) - write_option_error( loc, args[i] ); - writeExports(); - } - else if ( args[0] == "start" ) { - for ( int i = 1; i < nargs; i++ ) - write_option_error( loc, args[i] ); - writeStart(); - } - else if ( args[0] == "first_final" ) { - for ( int i = 1; i < nargs; i++ ) - write_option_error( loc, args[i] ); - writeFirstFinal(); - } - else if ( args[0] == "error" ) { - for ( int i = 1; i < nargs; i++ ) - write_option_error( loc, args[i] ); - writeError(); - } - else if ( args[0] == "clear" ) { - for ( int i = 1; i < nargs; i++ ) - write_option_error( loc, args[i] ); - writeClear(); - } - else { - /* EMIT An error here. */ - red->id->error(loc) << "unrecognized write command \"" << - args[0] << "\"" << std::endl; - } -} diff --git a/src/libfsm/gendata.h b/src/libfsm/gendata.h index f34f2629..7ba4e683 100644 --- a/src/libfsm/gendata.h +++ b/src/libfsm/gendata.h @@ -420,11 +420,6 @@ struct CodeGenData /* Show some stats after a write data. */ virtual void statsSummary() = 0; - /* This can also be overridden to modify the processing of write - * statements. */ - virtual void writeStatement( InputLoc &loc, int nargs, - std::vector &args, bool generateDot, const HostLang *hostLang ); - /********************/ virtual ~CodeGenData() @@ -439,8 +434,6 @@ struct CodeGenData void collectReferences(); -protected: - Reducer *red; RedFsmAp *redFsm; std::string sourceFileName; -- cgit v1.2.1