summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Thurston <thurston@colm.net>2021-11-07 14:25:02 -0800
committerAdrian Thurston <thurston@colm.net>2021-11-07 14:25:02 -0800
commitd8f6df9fa3932acaa7417c0ce52221ccbe7e8667 (patch)
tree2e79725512059400e1298a99dffd85729a1f30a0
parent9f0ac141731d635fbdc963c16c198d5de920f31d (diff)
downloadcolm-d8f6df9fa3932acaa7417c0ce52221ccbe7e8667.tar.gz
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.
-rw-r--r--src/libfsm/gendata.cc85
-rw-r--r--src/libfsm/gendata.h7
2 files changed, 0 insertions, 92 deletions
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<std::string> &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<std::string> &args, bool generateDot, const HostLang *hostLang );
-
/********************/
virtual ~CodeGenData()
@@ -439,8 +434,6 @@ struct CodeGenData
void collectReferences();
-protected:
-
Reducer *red;
RedFsmAp *redFsm;
std::string sourceFileName;