summaryrefslogtreecommitdiff
path: root/ragel
diff options
context:
space:
mode:
authorAdrian Thurston <thurston@complang.org>2011-09-11 06:25:30 +0000
committerAdrian Thurston <thurston@complang.org>2011-09-11 06:25:30 +0000
commit491fbfaceb79c0208b15a098cd2cb1565e7e08fd (patch)
tree0106f48e4a2c19e384ffc081603c7e83e4f5d902 /ragel
parent7d1e2cb03b39300c02089a0c2bab67dc1991f36e (diff)
downloadcolm-491fbfaceb79c0208b15a098cd2cb1565e7e08fd.tar.gz
Now have CodeGenData inheriting ReducedGen. Unified in interface, but not yet
in implementation. refs #321
Diffstat (limited to 'ragel')
-rw-r--r--ragel/gendata.cc5
-rw-r--r--ragel/gendata.h3
-rw-r--r--ragel/parsedata.cc9
-rw-r--r--ragel/reducedgen.cc5
-rw-r--r--ragel/xmlcodegen.h3
5 files changed, 17 insertions, 8 deletions
diff --git a/ragel/gendata.cc b/ragel/gendata.cc
index 938a1250..3af4e1cc 100644
--- a/ragel/gendata.cc
+++ b/ragel/gendata.cc
@@ -109,6 +109,7 @@ void genLineDirective( ostream &out )
CodeGenData::CodeGenData( const CodeGenArgs &args )
:
+ ReducedGen(args),
sourceFileName(args.sourceFileName),
fsmName(args.fsmName),
out(args.out),
@@ -141,7 +142,9 @@ CodeGenData::CodeGenData( const CodeGenArgs &args )
noFinal(false),
noError(false),
noCS(false)
-{}
+{
+ ReducedGen::cgd = this;
+}
void CodeGenData::createMachine()
{
diff --git a/ragel/gendata.h b/ragel/gendata.h
index 11f703e8..b5b6d6a4 100644
--- a/ragel/gendata.h
+++ b/ragel/gendata.h
@@ -26,6 +26,7 @@
#include "config.h"
#include "redfsm.h"
#include "common.h"
+#include "xmlcodegen.h"
using std::ostream;
@@ -80,7 +81,7 @@ struct CodeGenArgs
std::ostream &out;
};
-struct CodeGenData
+struct CodeGenData : public ReducedGen
{
/*
* The interface to the code generator.
diff --git a/ragel/parsedata.cc b/ragel/parsedata.cc
index d4d5dfbb..dd6826c8 100644
--- a/ragel/parsedata.cc
+++ b/ragel/parsedata.cc
@@ -1428,17 +1428,18 @@ void ParseData::prepareMachineGenTBWrapped( GraphDictEl *graphDictEl )
sectionGraph->setStateNumbers( 0 );
}
+CodeGenData *makeCodeGen2( const CodeGenArgs &args );
+
void ParseData::generateReduced( InputData &inputData )
{
beginProcessing();
CodeGenArgs args( inputData, inputData.inputFileName, sectionName, this, sectionGraph, *inputData.outStream );
- /* Make the generator. */
- ReducedGen reducedGen( args );
-
/* Write out with it. */
- cgd = reducedGen.make();
+ cgd = makeCodeGen2( args );
+
+ cgd->make();
if ( printStatistics ) {
cerr << "fsm name : " << sectionName << endl;
diff --git a/ragel/reducedgen.cc b/ragel/reducedgen.cc
index 129a8a56..90e0b908 100644
--- a/ragel/reducedgen.cc
+++ b/ragel/reducedgen.cc
@@ -124,13 +124,16 @@ void GenBase::reduceActionTables()
}
CodeGenData *makeCodeGen( const CodeGenArgs &args );
+CodeGenData *makeCodeGen2( const CodeGenArgs &args )
+{
+ return makeCodeGen( args );
+}
ReducedGen::ReducedGen( const CodeGenArgs &args )
:
GenBase(args.fsmName, args.pd, args.fsm),
cgd(0)
{
- cgd = makeCodeGen( args );
}
/* Invoked by the parser when a ragel definition is opened. */
diff --git a/ragel/xmlcodegen.h b/ragel/xmlcodegen.h
index 6d31f3d2..77605d28 100644
--- a/ragel/xmlcodegen.h
+++ b/ragel/xmlcodegen.h
@@ -180,7 +180,6 @@ private:
void finishGen();
- CodeGenData *cgd;
/* Collected during parsing. */
int curAction;
@@ -190,6 +189,8 @@ private:
int curCondSpace;
int curStateCond;
+protected:
+ CodeGenData *cgd;
};
#endif