summaryrefslogtreecommitdiff
path: root/ragel
diff options
context:
space:
mode:
Diffstat (limited to 'ragel')
-rw-r--r--ragel/cdcodegen.cc5
-rw-r--r--ragel/cdcodegen.h9
-rw-r--r--ragel/cdfflat.h15
-rw-r--r--ragel/cdfgoto.h15
-rw-r--r--ragel/cdflat.h14
-rw-r--r--ragel/cdftable.h15
-rw-r--r--ragel/cdgoto.h16
-rw-r--r--ragel/cdipgoto.h15
-rw-r--r--ragel/cdsplit.h15
-rw-r--r--ragel/cdtable.h14
-rw-r--r--ragel/cscodegen.cc4
-rw-r--r--ragel/cscodegen.h5
-rw-r--r--ragel/csfflat.h4
-rw-r--r--ragel/csfgoto.h3
-rw-r--r--ragel/csflat.h3
-rw-r--r--ragel/csftable.h4
-rw-r--r--ragel/csgoto.h4
-rw-r--r--ragel/csipgoto.h4
-rw-r--r--ragel/cssplit.h3
-rw-r--r--ragel/cstable.h4
-rw-r--r--ragel/dotcodegen.h3
-rw-r--r--ragel/gendata.cc9
-rw-r--r--ragel/gendata.h27
-rw-r--r--ragel/goipgoto.h6
-rw-r--r--ragel/javacodegen.h4
-rw-r--r--ragel/mlcodegen.cc4
-rw-r--r--ragel/mlcodegen.h2
-rw-r--r--ragel/mlfflat.h2
-rw-r--r--ragel/mlflat.h2
-rw-r--r--ragel/mlftable.h2
-rw-r--r--ragel/mlgoto.h2
-rw-r--r--ragel/mltable.h2
-rw-r--r--ragel/parsedata.cc4
-rw-r--r--ragel/rbxgoto.h6
-rw-r--r--ragel/reducedgen.cc143
-rw-r--r--ragel/rubycodegen.h2
-rw-r--r--ragel/rubyfflat.h4
-rw-r--r--ragel/rubyflat.h5
-rw-r--r--ragel/rubyftable.h4
-rw-r--r--ragel/rubytable.h7
-rw-r--r--ragel/xmlcodegen.h14
41 files changed, 228 insertions, 197 deletions
diff --git a/ragel/cdcodegen.cc b/ragel/cdcodegen.cc
index 3d7cafcd..bc583527 100644
--- a/ragel/cdcodegen.cc
+++ b/ragel/cdcodegen.cc
@@ -76,11 +76,10 @@ void FsmCodeGen::genLineDirective( ostream &out )
cdLineDirective( out, filter->fileName, filter->line + 1 );
}
-
/* Init code gen with in parameters. */
-FsmCodeGen::FsmCodeGen( ostream &out )
+FsmCodeGen::FsmCodeGen( const CodeGenArgs &args )
:
- CodeGenData(out)
+ CodeGenData(args)
{
}
diff --git a/ragel/cdcodegen.h b/ragel/cdcodegen.h
index d8fe62dd..0ad2756a 100644
--- a/ragel/cdcodegen.h
+++ b/ragel/cdcodegen.h
@@ -56,7 +56,8 @@ string itoa( int i );
class FsmCodeGen : public CodeGenData
{
public:
- FsmCodeGen( ostream &out );
+ FsmCodeGen( const CodeGenArgs &args );
+
virtual ~FsmCodeGen() {}
virtual void finishRagelDef();
@@ -188,7 +189,7 @@ public:
class CCodeGen : virtual public FsmCodeGen
{
public:
- CCodeGen( ostream &out ) : FsmCodeGen(out) {}
+ CCodeGen( const CodeGenArgs &args ) : FsmCodeGen(args) {}
virtual string NULL_ITEM();
virtual string POINTER();
@@ -209,7 +210,7 @@ public:
class DCodeGen : virtual public FsmCodeGen
{
public:
- DCodeGen( ostream &out ) : FsmCodeGen(out) {}
+ DCodeGen( const CodeGenArgs &args ) : FsmCodeGen(args) {}
virtual string NULL_ITEM();
virtual string POINTER();
@@ -230,7 +231,7 @@ public:
class D2CodeGen : virtual public FsmCodeGen
{
public:
- D2CodeGen( ostream &out ) : FsmCodeGen(out) {}
+ D2CodeGen( const CodeGenArgs &args ) : FsmCodeGen(args) {}
virtual string NULL_ITEM();
virtual string POINTER();
diff --git a/ragel/cdfflat.h b/ragel/cdfflat.h
index e5cbfbd9..cf75fe28 100644
--- a/ragel/cdfflat.h
+++ b/ragel/cdfflat.h
@@ -36,7 +36,8 @@ struct CodeGenData;
class FFlatCodeGen : public FlatCodeGen
{
protected:
- FFlatCodeGen( ostream &out ) : FsmCodeGen(out), FlatCodeGen(out) {}
+ FFlatCodeGen( const CodeGenArgs &args )
+ : FsmCodeGen(args), FlatCodeGen(args) {}
std::ostream &TO_STATE_ACTION_SWITCH();
std::ostream &FROM_STATE_ACTION_SWITCH();
@@ -58,8 +59,8 @@ protected:
struct CFFlatCodeGen
: public FFlatCodeGen, public CCodeGen
{
- CFFlatCodeGen( ostream &out ) :
- FsmCodeGen(out), FFlatCodeGen(out), CCodeGen(out) {}
+ CFFlatCodeGen( const CodeGenArgs &args ) :
+ FsmCodeGen(args), FFlatCodeGen(args), CCodeGen(args) {}
};
/*
@@ -68,8 +69,8 @@ struct CFFlatCodeGen
struct DFFlatCodeGen
: public FFlatCodeGen, public DCodeGen
{
- DFFlatCodeGen( ostream &out ) :
- FsmCodeGen(out), FFlatCodeGen(out), DCodeGen(out) {}
+ DFFlatCodeGen( const CodeGenArgs &args ) :
+ FsmCodeGen(args), FFlatCodeGen(args), DCodeGen(args) {}
};
/*
@@ -78,8 +79,8 @@ struct DFFlatCodeGen
struct D2FFlatCodeGen
: public FFlatCodeGen, public D2CodeGen
{
- D2FFlatCodeGen( ostream &out ) :
- FsmCodeGen(out), FFlatCodeGen(out), D2CodeGen(out) {}
+ D2FFlatCodeGen( const CodeGenArgs &args ) :
+ FsmCodeGen(args), FFlatCodeGen(args), D2CodeGen(args) {}
};
#endif
diff --git a/ragel/cdfgoto.h b/ragel/cdfgoto.h
index 27e980e9..ba113b84 100644
--- a/ragel/cdfgoto.h
+++ b/ragel/cdfgoto.h
@@ -37,7 +37,8 @@ struct CodeGenData;
class FGotoCodeGen : public GotoCodeGen
{
public:
- FGotoCodeGen( ostream &out ) : FsmCodeGen(out), GotoCodeGen(out) {}
+ FGotoCodeGen( const CodeGenArgs &args )
+ : FsmCodeGen(args), GotoCodeGen(args) {}
std::ostream &EXEC_ACTIONS();
std::ostream &TO_STATE_ACTION_SWITCH();
@@ -58,8 +59,8 @@ public:
struct CFGotoCodeGen
: public FGotoCodeGen, public CCodeGen
{
- CFGotoCodeGen( ostream &out ) :
- FsmCodeGen(out), FGotoCodeGen(out), CCodeGen(out) {}
+ CFGotoCodeGen( const CodeGenArgs &args ) :
+ FsmCodeGen(args), FGotoCodeGen(args), CCodeGen(args) {}
};
/*
@@ -68,8 +69,8 @@ struct CFGotoCodeGen
struct DFGotoCodeGen
: public FGotoCodeGen, public DCodeGen
{
- DFGotoCodeGen( ostream &out ) :
- FsmCodeGen(out), FGotoCodeGen(out), DCodeGen(out) {}
+ DFGotoCodeGen( const CodeGenArgs &args ) :
+ FsmCodeGen(args), FGotoCodeGen(args), DCodeGen(args) {}
};
/*
@@ -78,8 +79,8 @@ struct DFGotoCodeGen
struct D2FGotoCodeGen
: public FGotoCodeGen, public D2CodeGen
{
- D2FGotoCodeGen( ostream &out ) :
- FsmCodeGen(out), FGotoCodeGen(out), D2CodeGen(out) {}
+ D2FGotoCodeGen( const CodeGenArgs &args ) :
+ FsmCodeGen(args), FGotoCodeGen(args), D2CodeGen(args) {}
};
#endif
diff --git a/ragel/cdflat.h b/ragel/cdflat.h
index 96c65cb1..f96c1051 100644
--- a/ragel/cdflat.h
+++ b/ragel/cdflat.h
@@ -39,7 +39,7 @@ struct RedStateAp;
class FlatCodeGen : virtual public FsmCodeGen
{
public:
- FlatCodeGen( ostream &out ) : FsmCodeGen(out) {}
+ FlatCodeGen( const CodeGenArgs &args ) : FsmCodeGen(args) {}
virtual ~FlatCodeGen() { }
protected:
@@ -91,8 +91,8 @@ protected:
struct CFlatCodeGen
: public FlatCodeGen, public CCodeGen
{
- CFlatCodeGen( ostream &out ) :
- FsmCodeGen(out), FlatCodeGen(out), CCodeGen(out) {}
+ CFlatCodeGen( const CodeGenArgs &args ) :
+ FsmCodeGen(args), FlatCodeGen(args), CCodeGen(args) {}
};
/*
@@ -101,8 +101,8 @@ struct CFlatCodeGen
struct DFlatCodeGen
: public FlatCodeGen, public DCodeGen
{
- DFlatCodeGen( ostream &out ) :
- FsmCodeGen(out), FlatCodeGen(out), DCodeGen(out) {}
+ DFlatCodeGen( const CodeGenArgs &args ) :
+ FsmCodeGen(args), FlatCodeGen(args), DCodeGen(args) {}
};
/*
@@ -111,8 +111,8 @@ struct DFlatCodeGen
struct D2FlatCodeGen
: public FlatCodeGen, public D2CodeGen
{
- D2FlatCodeGen( ostream &out ) :
- FsmCodeGen(out), FlatCodeGen(out), D2CodeGen(out) {}
+ D2FlatCodeGen( const CodeGenArgs &args ) :
+ FsmCodeGen(args), FlatCodeGen(args), D2CodeGen(args) {}
};
#endif
diff --git a/ragel/cdftable.h b/ragel/cdftable.h
index 4a8264ce..c5c23572 100644
--- a/ragel/cdftable.h
+++ b/ragel/cdftable.h
@@ -37,7 +37,8 @@ struct CodeGenData;
class FTabCodeGen : public TabCodeGen
{
protected:
- FTabCodeGen( ostream &out ) : FsmCodeGen(out), TabCodeGen(out) {}
+ FTabCodeGen( const CodeGenArgs &args )
+ : FsmCodeGen(args), TabCodeGen(args) {}
std::ostream &TO_STATE_ACTION_SWITCH();
std::ostream &FROM_STATE_ACTION_SWITCH();
@@ -60,8 +61,8 @@ protected:
struct CFTabCodeGen
: public FTabCodeGen, public CCodeGen
{
- CFTabCodeGen( ostream &out ) :
- FsmCodeGen(out), FTabCodeGen(out), CCodeGen(out) {}
+ CFTabCodeGen( const CodeGenArgs &args ) :
+ FsmCodeGen(args), FTabCodeGen(args), CCodeGen(args) {}
};
/*
@@ -70,8 +71,8 @@ struct CFTabCodeGen
struct DFTabCodeGen
: public FTabCodeGen, public DCodeGen
{
- DFTabCodeGen( ostream &out ) :
- FsmCodeGen(out), FTabCodeGen(out), DCodeGen(out) {}
+ DFTabCodeGen( const CodeGenArgs &args ) :
+ FsmCodeGen(args), FTabCodeGen(args), DCodeGen(args) {}
};
/*
@@ -80,8 +81,8 @@ struct DFTabCodeGen
struct D2FTabCodeGen
: public FTabCodeGen, public D2CodeGen
{
- D2FTabCodeGen( ostream &out ) :
- FsmCodeGen(out), FTabCodeGen(out), D2CodeGen(out) {}
+ D2FTabCodeGen( const CodeGenArgs &args ) :
+ FsmCodeGen(args), FTabCodeGen(args), D2CodeGen(args) {}
};
#endif
diff --git a/ragel/cdgoto.h b/ragel/cdgoto.h
index e0869c8d..a7db6dc2 100644
--- a/ragel/cdgoto.h
+++ b/ragel/cdgoto.h
@@ -40,7 +40,9 @@ struct GenStateCond;
class GotoCodeGen : virtual public FsmCodeGen
{
public:
- GotoCodeGen( ostream &out ) : FsmCodeGen(out) {}
+ GotoCodeGen( const CodeGenArgs &args )
+ : FsmCodeGen(args) {}
+
std::ostream &TO_STATE_ACTION_SWITCH();
std::ostream &FROM_STATE_ACTION_SWITCH();
std::ostream &EOF_ACTION_SWITCH();
@@ -92,8 +94,8 @@ public:
struct CGotoCodeGen
: public GotoCodeGen, public CCodeGen
{
- CGotoCodeGen( ostream &out ) :
- FsmCodeGen(out), GotoCodeGen(out), CCodeGen(out) {}
+ CGotoCodeGen( const CodeGenArgs &args ) :
+ FsmCodeGen(args), GotoCodeGen(args), CCodeGen(args) {}
};
/*
@@ -102,8 +104,8 @@ struct CGotoCodeGen
struct DGotoCodeGen
: public GotoCodeGen, public DCodeGen
{
- DGotoCodeGen( ostream &out ) :
- FsmCodeGen(out), GotoCodeGen(out), DCodeGen(out) {}
+ DGotoCodeGen( const CodeGenArgs &args ) :
+ FsmCodeGen(args), GotoCodeGen(args), DCodeGen(args) {}
};
/*
@@ -112,8 +114,8 @@ struct DGotoCodeGen
struct D2GotoCodeGen
: public GotoCodeGen, public D2CodeGen
{
- D2GotoCodeGen( ostream &out ) :
- FsmCodeGen(out), GotoCodeGen(out), D2CodeGen(out) {}
+ D2GotoCodeGen( const CodeGenArgs &args ) :
+ FsmCodeGen(args), GotoCodeGen(args), D2CodeGen(args) {}
};
#endif
diff --git a/ragel/cdipgoto.h b/ragel/cdipgoto.h
index c869e1f9..22e75608 100644
--- a/ragel/cdipgoto.h
+++ b/ragel/cdipgoto.h
@@ -36,7 +36,8 @@ struct CodeGenData;
class IpGotoCodeGen : public GotoCodeGen
{
public:
- IpGotoCodeGen( ostream &out ) : FsmCodeGen(out), GotoCodeGen(out) {}
+ IpGotoCodeGen( const CodeGenArgs &args )
+ : FsmCodeGen(args), GotoCodeGen(args) {}
std::ostream &EXIT_STATES();
std::ostream &TRANS_GOTO( RedTransAp *trans, int level );
@@ -78,8 +79,8 @@ protected:
struct CIpGotoCodeGen
: public IpGotoCodeGen, public CCodeGen
{
- CIpGotoCodeGen( ostream &out ) :
- FsmCodeGen(out), IpGotoCodeGen(out), CCodeGen(out) {}
+ CIpGotoCodeGen( const CodeGenArgs &args) :
+ FsmCodeGen(args), IpGotoCodeGen(args), CCodeGen(args) {}
};
/*
@@ -88,8 +89,8 @@ struct CIpGotoCodeGen
struct DIpGotoCodeGen
: public IpGotoCodeGen, public DCodeGen
{
- DIpGotoCodeGen( ostream &out ) :
- FsmCodeGen(out), IpGotoCodeGen(out), DCodeGen(out) {}
+ DIpGotoCodeGen( const CodeGenArgs &args) :
+ FsmCodeGen(args), IpGotoCodeGen(args), DCodeGen(args) {}
};
/*
@@ -98,8 +99,8 @@ struct DIpGotoCodeGen
struct D2IpGotoCodeGen
: public IpGotoCodeGen, public D2CodeGen
{
- D2IpGotoCodeGen( ostream &out ) :
- FsmCodeGen(out), IpGotoCodeGen(out), D2CodeGen(out) {}
+ D2IpGotoCodeGen( const CodeGenArgs &args) :
+ FsmCodeGen(args), IpGotoCodeGen(args), D2CodeGen(args) {}
};
#endif
diff --git a/ragel/cdsplit.h b/ragel/cdsplit.h
index 03dea78b..2d9ebbf2 100644
--- a/ragel/cdsplit.h
+++ b/ragel/cdsplit.h
@@ -27,7 +27,8 @@
class SplitCodeGen : public IpGotoCodeGen
{
public:
- SplitCodeGen( ostream &out ) : FsmCodeGen(out), IpGotoCodeGen(out) {}
+ SplitCodeGen( const CodeGenArgs &args )
+ : FsmCodeGen(args), IpGotoCodeGen(args) {}
bool ptOutLabelUsed;
@@ -53,8 +54,8 @@ public:
struct CSplitCodeGen
: public SplitCodeGen, public CCodeGen
{
- CSplitCodeGen( ostream &out ) :
- FsmCodeGen(out), SplitCodeGen(out), CCodeGen(out) {}
+ CSplitCodeGen( const CodeGenArgs &args ) :
+ FsmCodeGen(args), SplitCodeGen(args), CCodeGen(args) {}
};
/*
@@ -63,8 +64,8 @@ struct CSplitCodeGen
struct DSplitCodeGen
: public SplitCodeGen, public DCodeGen
{
- DSplitCodeGen( ostream &out ) :
- FsmCodeGen(out), SplitCodeGen(out), DCodeGen(out) {}
+ DSplitCodeGen( const CodeGenArgs &args ) :
+ FsmCodeGen(args), SplitCodeGen(args), DCodeGen(args) {}
};
/*
@@ -73,8 +74,8 @@ struct DSplitCodeGen
struct D2SplitCodeGen
: public SplitCodeGen, public D2CodeGen
{
- D2SplitCodeGen( ostream &out ) :
- FsmCodeGen(out), SplitCodeGen(out), D2CodeGen(out) {}
+ D2SplitCodeGen( const CodeGenArgs &args ) :
+ FsmCodeGen(args), SplitCodeGen(args), D2CodeGen(args) {}
};
#endif
diff --git a/ragel/cdtable.h b/ragel/cdtable.h
index b8df71b0..2f05782d 100644
--- a/ragel/cdtable.h
+++ b/ragel/cdtable.h
@@ -39,7 +39,7 @@ struct RedStateAp;
class TabCodeGen : virtual public FsmCodeGen
{
public:
- TabCodeGen( ostream &out ) : FsmCodeGen(out) {}
+ TabCodeGen( const CodeGenArgs &args ) : FsmCodeGen(args) {}
virtual ~TabCodeGen() { }
virtual void writeData();
virtual void writeExec();
@@ -97,8 +97,8 @@ protected:
struct CTabCodeGen
: public TabCodeGen, public CCodeGen
{
- CTabCodeGen( ostream &out ) :
- FsmCodeGen(out), TabCodeGen(out), CCodeGen(out) {}
+ CTabCodeGen( const CodeGenArgs &args ) :
+ FsmCodeGen(args), TabCodeGen(args), CCodeGen(args) {}
};
/*
@@ -107,8 +107,8 @@ struct CTabCodeGen
struct DTabCodeGen
: public TabCodeGen, public DCodeGen
{
- DTabCodeGen( ostream &out ) :
- FsmCodeGen(out), TabCodeGen(out), DCodeGen(out) {}
+ DTabCodeGen( const CodeGenArgs &args ) :
+ FsmCodeGen(args), TabCodeGen(args), DCodeGen(args) {}
};
/*
@@ -117,8 +117,8 @@ struct DTabCodeGen
struct D2TabCodeGen
: public TabCodeGen, public D2CodeGen
{
- D2TabCodeGen( ostream &out ) :
- FsmCodeGen(out), TabCodeGen(out), D2CodeGen(out) {}
+ D2TabCodeGen( const CodeGenArgs &args ) :
+ FsmCodeGen(args), TabCodeGen(args), D2CodeGen(args) {}
};
#endif
diff --git a/ragel/cscodegen.cc b/ragel/cscodegen.cc
index 6de15060..b8d4336f 100644
--- a/ragel/cscodegen.cc
+++ b/ragel/cscodegen.cc
@@ -75,9 +75,9 @@ void CSharpFsmCodeGen::genLineDirective( ostream &out )
/* Init code gen with in parameters. */
-CSharpFsmCodeGen::CSharpFsmCodeGen( ostream &out )
+CSharpFsmCodeGen::CSharpFsmCodeGen( const CodeGenArgs &args )
:
- CodeGenData(out)
+ CodeGenData(args)
{
}
diff --git a/ragel/cscodegen.h b/ragel/cscodegen.h
index 0471ea91..2efcde82 100644
--- a/ragel/cscodegen.h
+++ b/ragel/cscodegen.h
@@ -56,7 +56,7 @@ string itoa( int i );
class CSharpFsmCodeGen : public CodeGenData
{
public:
- CSharpFsmCodeGen( ostream &out );
+ CSharpFsmCodeGen( const CodeGenArgs &args );
virtual ~CSharpFsmCodeGen() {}
virtual void finishRagelDef();
@@ -182,7 +182,8 @@ public:
class CSharpCodeGen : virtual public CSharpFsmCodeGen
{
public:
- CSharpCodeGen( ostream &out ) : CSharpFsmCodeGen(out) {}
+ CSharpCodeGen( const CodeGenArgs &args )
+ : CSharpFsmCodeGen(args) {}
virtual string GET_KEY();
virtual string NULL_ITEM();
diff --git a/ragel/csfflat.h b/ragel/csfflat.h
index b102fe5b..d9f5cf44 100644
--- a/ragel/csfflat.h
+++ b/ragel/csfflat.h
@@ -36,7 +36,9 @@ struct CodeGenData;
class CSharpFFlatCodeGen : public CSharpFlatCodeGen
{
public:
- CSharpFFlatCodeGen( ostream &out ) : CSharpFsmCodeGen(out), CSharpFlatCodeGen(out) {}
+ CSharpFFlatCodeGen( const CodeGenArgs &args )
+ : CSharpFsmCodeGen(args), CSharpFlatCodeGen(args) {}
+
private:
std::ostream &TO_STATE_ACTION_SWITCH();
std::ostream &FROM_STATE_ACTION_SWITCH();
diff --git a/ragel/csfgoto.h b/ragel/csfgoto.h
index fa9447b6..ea245101 100644
--- a/ragel/csfgoto.h
+++ b/ragel/csfgoto.h
@@ -37,7 +37,8 @@ struct CodeGenData;
class CSharpFGotoCodeGen : public CSharpGotoCodeGen
{
public:
- CSharpFGotoCodeGen( ostream &out ) : CSharpFsmCodeGen(out), CSharpGotoCodeGen(out) {}
+ CSharpFGotoCodeGen( const CodeGenArgs &args )
+ : CSharpFsmCodeGen(args), CSharpGotoCodeGen(args) {}
std::ostream &EXEC_ACTIONS();
std::ostream &TO_STATE_ACTION_SWITCH();
diff --git a/ragel/csflat.h b/ragel/csflat.h
index a576cd95..ca172769 100644
--- a/ragel/csflat.h
+++ b/ragel/csflat.h
@@ -39,7 +39,8 @@ struct RedStateAp;
class CSharpFlatCodeGen : virtual public CSharpFsmCodeGen, public CSharpCodeGen
{
public:
- CSharpFlatCodeGen( ostream &out ) : CSharpFsmCodeGen(out), CSharpCodeGen(out) {}
+ CSharpFlatCodeGen( const CodeGenArgs &args )
+ : CSharpFsmCodeGen(args), CSharpCodeGen(args) {}
virtual ~CSharpFlatCodeGen() { }
protected:
diff --git a/ragel/csftable.h b/ragel/csftable.h
index 612ec32f..b1f694ee 100644
--- a/ragel/csftable.h
+++ b/ragel/csftable.h
@@ -37,7 +37,9 @@ struct CodeGenData;
class CSharpFTabCodeGen : public CSharpTabCodeGen
{
public:
- CSharpFTabCodeGen( ostream &out ) : CSharpFsmCodeGen(out), CSharpTabCodeGen(out) {}
+ CSharpFTabCodeGen( const CodeGenArgs &args )
+ : CSharpFsmCodeGen(args), CSharpTabCodeGen(args) {}
+
private:
std::ostream &TO_STATE_ACTION_SWITCH();
std::ostream &FROM_STATE_ACTION_SWITCH();
diff --git a/ragel/csgoto.h b/ragel/csgoto.h
index 74918840..b3b5f279 100644
--- a/ragel/csgoto.h
+++ b/ragel/csgoto.h
@@ -40,7 +40,9 @@ struct GenStateCond;
class CSharpGotoCodeGen : virtual public CSharpFsmCodeGen, public CSharpCodeGen
{
public:
- CSharpGotoCodeGen( ostream &out ) : CSharpFsmCodeGen(out), CSharpCodeGen(out) {}
+ CSharpGotoCodeGen( const CodeGenArgs &args )
+ : CSharpFsmCodeGen(args), CSharpCodeGen(args) {}
+
std::ostream &TO_STATE_ACTION_SWITCH();
std::ostream &FROM_STATE_ACTION_SWITCH();
std::ostream &EOF_ACTION_SWITCH();
diff --git a/ragel/csipgoto.h b/ragel/csipgoto.h
index 4aeb47d9..12e98512 100644
--- a/ragel/csipgoto.h
+++ b/ragel/csipgoto.h
@@ -36,8 +36,8 @@ struct CodeGenData;
class CSharpIpGotoCodeGen : public CSharpGotoCodeGen
{
public:
- CSharpIpGotoCodeGen( ostream &out ) : CSharpFsmCodeGen(out),
- CSharpGotoCodeGen(out) {}
+ CSharpIpGotoCodeGen( const CodeGenArgs &args )
+ : CSharpFsmCodeGen(args), CSharpGotoCodeGen(args) {}
std::ostream &EXIT_STATES();
std::ostream &TRANS_GOTO( RedTransAp *trans, int level );
diff --git a/ragel/cssplit.h b/ragel/cssplit.h
index 9ff2d8f7..111f072a 100644
--- a/ragel/cssplit.h
+++ b/ragel/cssplit.h
@@ -27,7 +27,8 @@
class CSharpSplitCodeGen : public CSharpIpGotoCodeGen
{
public:
- CSharpSplitCodeGen( ostream &out ) : CSharpFsmCodeGen(out), CSharpIpGotoCodeGen(out) {}
+ CSharpSplitCodeGen( const CodeGenArgs &args )
+ : CSharpFsmCodeGen(args), CSharpIpGotoCodeGen(args) {}
bool ptOutLabelUsed;
diff --git a/ragel/cstable.h b/ragel/cstable.h
index a8206fc9..1489386a 100644
--- a/ragel/cstable.h
+++ b/ragel/cstable.h
@@ -39,7 +39,9 @@ struct RedStateAp;
class CSharpTabCodeGen : virtual public CSharpFsmCodeGen, public CSharpCodeGen
{
public:
- CSharpTabCodeGen( ostream &out ) : CSharpFsmCodeGen(out), CSharpCodeGen(out) {}
+ CSharpTabCodeGen( const CodeGenArgs &args )
+ : CSharpFsmCodeGen(args), CSharpCodeGen(args) {}
+
virtual ~CSharpTabCodeGen() { }
virtual void writeData();
virtual void writeExec();
diff --git a/ragel/dotcodegen.h b/ragel/dotcodegen.h
index 54e09f35..6c3ee977 100644
--- a/ragel/dotcodegen.h
+++ b/ragel/dotcodegen.h
@@ -28,7 +28,8 @@
class GraphvizDotGen : public CodeGenData
{
public:
- GraphvizDotGen( ostream &out ) : CodeGenData(out) { }
+ GraphvizDotGen( const CodeGenArgs &args )
+ : CodeGenData(args) { }
/* Print an fsm to out stream. */
void writeTransList( RedStateAp *state );
diff --git a/ragel/gendata.cc b/ragel/gendata.cc
index eb5481db..938a1250 100644
--- a/ragel/gendata.cc
+++ b/ragel/gendata.cc
@@ -107,11 +107,11 @@ void genLineDirective( ostream &out )
/* Total error count. */
/* int gblErrorCount = 0; */
-CodeGenData::CodeGenData( ostream &out )
+CodeGenData::CodeGenData( const CodeGenArgs &args )
:
- sourceFileName(0),
- fsmName(0),
- out(out),
+ sourceFileName(args.sourceFileName),
+ fsmName(args.fsmName),
+ out(args.out),
redFsm(0),
allActions(0),
allActionTables(0),
@@ -143,7 +143,6 @@ CodeGenData::CodeGenData( ostream &out )
noCS(false)
{}
-
void CodeGenData::createMachine()
{
redFsm = new RedFsmAp();
diff --git a/ragel/gendata.h b/ragel/gendata.h
index 94edc2f4..11f703e8 100644
--- a/ragel/gendata.h
+++ b/ragel/gendata.h
@@ -39,6 +39,9 @@ typedef unsigned long ulong;
extern int gblErrorCount;
struct CodeGenData;
+struct InputData;
+struct ParseData;
+struct FsmAp;
typedef AvlMap<char *, CodeGenData*, CmpStr> CodeGenMap;
typedef AvlMapEl<char *, CodeGenData*> CodeGenMapEl;
@@ -56,6 +59,27 @@ string itoa( int i );
/*********************************/
+struct CodeGenArgs
+{
+ CodeGenArgs( InputData &inputData, const char *sourceFileName,
+ char *fsmName, ParseData *pd, FsmAp *fsm, std::ostream &out )
+ :
+ inputData(inputData),
+ sourceFileName(sourceFileName),
+ fsmName(fsmName),
+ pd(pd),
+ fsm(fsm),
+ out(out)
+ {}
+
+ InputData &inputData;
+ const char *sourceFileName;
+ char *fsmName;
+ ParseData *pd;
+ FsmAp *fsm;
+ std::ostream &out;
+};
+
struct CodeGenData
{
/*
@@ -78,7 +102,8 @@ struct CodeGenData
/********************/
- CodeGenData( ostream &out );
+ CodeGenData( const CodeGenArgs &args );
+
virtual ~CodeGenData() {}
/*
diff --git a/ragel/goipgoto.h b/ragel/goipgoto.h
index 8424d064..970d2411 100644
--- a/ragel/goipgoto.h
+++ b/ragel/goipgoto.h
@@ -36,8 +36,8 @@ struct GoIpGotoCodeGen
: public IpGotoCodeGen, public CCodeGen
{
public:
- GoIpGotoCodeGen( ostream &out ) :
- FsmCodeGen(out), IpGotoCodeGen(out), CCodeGen(out) {}
+ GoIpGotoCodeGen( const CodeGenArgs &args ) :
+ FsmCodeGen(args), IpGotoCodeGen(args), CCodeGen(args) {}
void writeExec();
void writeData();
@@ -56,7 +56,7 @@ public:
ostream &STATE_GOTOS();
ostream &STATIC_VAR( string type, string name );
ostream &TRANS_GOTO( RedTransAp *trans, int level );
- void genLineDirective( ostream &out );
+ void genLineDirective( ostream &args );
bool IN_TRANS_ACTIONS( RedStateAp *state );
void ACTION( ostream &ret, GenAction *action, int targState,
bool inFinish, bool csForced );
diff --git a/ragel/javacodegen.h b/ragel/javacodegen.h
index 06914c9c..0cf3e759 100644
--- a/ragel/javacodegen.h
+++ b/ragel/javacodegen.h
@@ -37,8 +37,8 @@ using std::ostream;
*/
struct JavaTabCodeGen : public CodeGenData
{
- JavaTabCodeGen( ostream &out ) :
- CodeGenData(out) {}
+ JavaTabCodeGen( const CodeGenArgs &args ) :
+ CodeGenData(args) {}
std::ostream &TO_STATE_ACTION_SWITCH();
std::ostream &FROM_STATE_ACTION_SWITCH();
diff --git a/ragel/mlcodegen.cc b/ragel/mlcodegen.cc
index f8268d60..4b81144d 100644
--- a/ragel/mlcodegen.cc
+++ b/ragel/mlcodegen.cc
@@ -69,9 +69,9 @@ void OCamlCodeGen::genLineDirective( ostream &out )
/* Init code gen with in parameters. */
-OCamlCodeGen::OCamlCodeGen( ostream &out )
+OCamlCodeGen::OCamlCodeGen( const CodeGenArgs &args )
:
- CodeGenData(out)
+ CodeGenData(args)
{
}
diff --git a/ragel/mlcodegen.h b/ragel/mlcodegen.h
index 3df047b9..2c912547 100644
--- a/ragel/mlcodegen.h
+++ b/ragel/mlcodegen.h
@@ -58,7 +58,7 @@ struct LongestMatchPart;
class OCamlCodeGen : public CodeGenData
{
public:
- OCamlCodeGen( ostream &out );
+ OCamlCodeGen( const CodeGenArgs &args );
virtual ~OCamlCodeGen() {}
virtual void finishRagelDef();
diff --git a/ragel/mlfflat.h b/ragel/mlfflat.h
index 242e6b91..48ff43ae 100644
--- a/ragel/mlfflat.h
+++ b/ragel/mlfflat.h
@@ -36,7 +36,7 @@
class OCamlFFlatCodeGen : public OCamlFlatCodeGen
{
public:
- OCamlFFlatCodeGen( ostream &out ) : OCamlFlatCodeGen(out) {}
+ OCamlFFlatCodeGen( const CodeGenArgs &args ) : OCamlFlatCodeGen(args) {}
private:
std::ostream &TO_STATE_ACTION_SWITCH();
std::ostream &FROM_STATE_ACTION_SWITCH();
diff --git a/ragel/mlflat.h b/ragel/mlflat.h
index 6da18198..181a5243 100644
--- a/ragel/mlflat.h
+++ b/ragel/mlflat.h
@@ -39,7 +39,7 @@
class OCamlFlatCodeGen : public OCamlCodeGen
{
public:
- OCamlFlatCodeGen( ostream &out ) : OCamlCodeGen(out) {}
+ OCamlFlatCodeGen( const CodeGenArgs &args ) : OCamlCodeGen(args) {}
virtual ~OCamlFlatCodeGen() { }
protected:
diff --git a/ragel/mlftable.h b/ragel/mlftable.h
index da88e849..3f2f9e17 100644
--- a/ragel/mlftable.h
+++ b/ragel/mlftable.h
@@ -37,7 +37,7 @@
class OCamlFTabCodeGen : public OCamlTabCodeGen
{
public:
- OCamlFTabCodeGen( ostream &out ) : OCamlTabCodeGen(out) {}
+ OCamlFTabCodeGen( const CodeGenArgs &args ) : OCamlTabCodeGen(args) {}
private:
std::ostream &TO_STATE_ACTION_SWITCH();
std::ostream &FROM_STATE_ACTION_SWITCH();
diff --git a/ragel/mlgoto.h b/ragel/mlgoto.h
index 50aeb32a..46ea9824 100644
--- a/ragel/mlgoto.h
+++ b/ragel/mlgoto.h
@@ -40,7 +40,7 @@
class OCamlGotoCodeGen : virtual public OCamlCodeGen
{
public:
- OCamlGotoCodeGen( ostream &out ) : OCamlCodeGen(out) {}
+ OCamlGotoCodeGen( const CodeGenArgs &args ) : OCamlCodeGen(args) {}
std::ostream &TO_STATE_ACTION_SWITCH();
std::ostream &FROM_STATE_ACTION_SWITCH();
std::ostream &EOF_ACTION_SWITCH();
diff --git a/ragel/mltable.h b/ragel/mltable.h
index 505d378a..6ad6f8c1 100644
--- a/ragel/mltable.h
+++ b/ragel/mltable.h
@@ -41,7 +41,7 @@ struct RedStateAp;
class OCamlTabCodeGen : public OCamlCodeGen
{
public:
- OCamlTabCodeGen( ostream &out ) : OCamlCodeGen(out) {}
+ OCamlTabCodeGen( const CodeGenArgs &args ) : OCamlCodeGen(args) {}
virtual ~OCamlTabCodeGen() { }
virtual void writeData();
virtual void writeExec();
diff --git a/ragel/parsedata.cc b/ragel/parsedata.cc
index 4a8dbf35..d4d5dfbb 100644
--- a/ragel/parsedata.cc
+++ b/ragel/parsedata.cc
@@ -1432,8 +1432,10 @@ void ParseData::generateReduced( InputData &inputData )
{
beginProcessing();
+ CodeGenArgs args( inputData, inputData.inputFileName, sectionName, this, sectionGraph, *inputData.outStream );
+
/* Make the generator. */
- ReducedGen reducedGen( inputData, sectionName, this, sectionGraph );
+ ReducedGen reducedGen( args );
/* Write out with it. */
cgd = reducedGen.make();
diff --git a/ragel/rbxgoto.h b/ragel/rbxgoto.h
index 291b6560..b6ef7450 100644
--- a/ragel/rbxgoto.h
+++ b/ragel/rbxgoto.h
@@ -32,8 +32,10 @@ using std::string;
class RbxGotoCodeGen : public RubyCodeGen
{
public:
- RbxGotoCodeGen( ostream &out ) : RubyCodeGen(out) {}
- virtual ~RbxGotoCodeGen() {}
+ RbxGotoCodeGen( const CodeGenArgs &args )
+ : RubyCodeGen(args) {}
+
+ virtual ~RbxGotoCodeGen() {}
std::ostream &TO_STATE_ACTION_SWITCH();
std::ostream &FROM_STATE_ACTION_SWITCH();
diff --git a/ragel/reducedgen.cc b/ragel/reducedgen.cc
index 941e9648..129a8a56 100644
--- a/ragel/reducedgen.cc
+++ b/ragel/reducedgen.cc
@@ -123,44 +123,46 @@ void GenBase::reduceActionTables()
}
}
-ReducedGen::ReducedGen( InputData &inputData, char *fsmName, ParseData *pd, FsmAp *fsm )
+CodeGenData *makeCodeGen( const CodeGenArgs &args );
+
+ReducedGen::ReducedGen( const CodeGenArgs &args )
:
- GenBase(fsmName, pd, fsm),
+ GenBase(args.fsmName, args.pd, args.fsm),
cgd(0)
{
- cgd = makeCodeGen( inputData.inputFileName, fsmName, *inputData.outStream );
+ cgd = makeCodeGen( args );
}
/* Invoked by the parser when a ragel definition is opened. */
-CodeGenData *ReducedGen::cdMakeCodeGen( const char *sourceFileName, const char *fsmName, ostream &out )
+CodeGenData *cdMakeCodeGen( const CodeGenArgs &args )
{
CodeGenData *codeGen = 0;
switch ( hostLang->lang ) {
case HostLang::C:
switch ( codeStyle ) {
case GenTables:
- codeGen = new CTabCodeGen(out);
+ codeGen = new CTabCodeGen(args);
break;
case GenFTables:
- codeGen = new CFTabCodeGen(out);
+ codeGen = new CFTabCodeGen(args);
break;
case GenFlat:
- codeGen = new CFlatCodeGen(out);
+ codeGen = new CFlatCodeGen(args);
break;
case GenFFlat:
- codeGen = new CFFlatCodeGen(out);
+ codeGen = new CFFlatCodeGen(args);
break;
case GenGoto:
- codeGen = new CGotoCodeGen(out);
+ codeGen = new CGotoCodeGen(args);
break;
case GenFGoto:
- codeGen = new CFGotoCodeGen(out);
+ codeGen = new CFGotoCodeGen(args);
break;
case GenIpGoto:
- codeGen = new CIpGotoCodeGen(out);
+ codeGen = new CIpGotoCodeGen(args);
break;
case GenSplit:
- codeGen = new CSplitCodeGen(out);
+ codeGen = new CSplitCodeGen(args);
break;
}
break;
@@ -168,28 +170,28 @@ CodeGenData *ReducedGen::cdMakeCodeGen( const char *sourceFileName, const char *
case HostLang::D:
switch ( codeStyle ) {
case GenTables:
- codeGen = new DTabCodeGen(out);
+ codeGen = new DTabCodeGen(args);
break;
case GenFTables:
- codeGen = new DFTabCodeGen(out);
+ codeGen = new DFTabCodeGen(args);
break;
case GenFlat:
- codeGen = new DFlatCodeGen(out);
+ codeGen = new DFlatCodeGen(args);
break;
case GenFFlat:
- codeGen = new DFFlatCodeGen(out);
+ codeGen = new DFFlatCodeGen(args);
break;
case GenGoto:
- codeGen = new DGotoCodeGen(out);
+ codeGen = new DGotoCodeGen(args);
break;
case GenFGoto:
- codeGen = new DFGotoCodeGen(out);
+ codeGen = new DFGotoCodeGen(args);
break;
case GenIpGoto:
- codeGen = new DIpGotoCodeGen(out);
+ codeGen = new DIpGotoCodeGen(args);
break;
case GenSplit:
- codeGen = new DSplitCodeGen(out);
+ codeGen = new DSplitCodeGen(args);
break;
}
break;
@@ -197,28 +199,28 @@ CodeGenData *ReducedGen::cdMakeCodeGen( const char *sourceFileName, const char *
case HostLang::D2:
switch ( codeStyle ) {
case GenTables:
- codeGen = new D2TabCodeGen(out);
+ codeGen = new D2TabCodeGen(args);
break;
case GenFTables:
- codeGen = new D2FTabCodeGen(out);
+ codeGen = new D2FTabCodeGen(args);
break;
case GenFlat:
- codeGen = new D2FlatCodeGen(out);
+ codeGen = new D2FlatCodeGen(args);
break;
case GenFFlat:
- codeGen = new D2FFlatCodeGen(out);
+ codeGen = new D2FFlatCodeGen(args);
break;
case GenGoto:
- codeGen = new D2GotoCodeGen(out);
+ codeGen = new D2GotoCodeGen(args);
break;
case GenFGoto:
- codeGen = new D2FGotoCodeGen(out);
+ codeGen = new D2FGotoCodeGen(args);
break;
case GenIpGoto:
- codeGen = new D2IpGotoCodeGen(out);
+ codeGen = new D2IpGotoCodeGen(args);
break;
case GenSplit:
- codeGen = new D2SplitCodeGen(out);
+ codeGen = new D2SplitCodeGen(args);
break;
}
break;
@@ -226,31 +228,25 @@ CodeGenData *ReducedGen::cdMakeCodeGen( const char *sourceFileName, const char *
default: break;
}
- codeGen->sourceFileName = sourceFileName;
- codeGen->fsmName = fsmName;
-
return codeGen;
}
/* Invoked by the parser when a ragel definition is opened. */
-CodeGenData *ReducedGen::javaMakeCodeGen( const char *sourceFileName, const char *fsmName, ostream &out )
+CodeGenData *javaMakeCodeGen( const CodeGenArgs &args )
{
- CodeGenData *codeGen = new JavaTabCodeGen(out);
-
- codeGen->sourceFileName = sourceFileName;
- codeGen->fsmName = fsmName;
+ CodeGenData *codeGen = new JavaTabCodeGen(args);
return codeGen;
}
/* Invoked by the parser when a ragel definition is opened. */
-CodeGenData *ReducedGen::goMakeCodeGen( const char *sourceFileName, const char *fsmName, ostream &out )
+CodeGenData *goMakeCodeGen( const CodeGenArgs &args )
{
CodeGenData *codeGen;
switch ( codeStyle ) {
case GenIpGoto:
- codeGen = new GoIpGotoCodeGen(out);
+ codeGen = new GoIpGotoCodeGen(args);
break;
default:
cerr << "I only support the -G2 output style for Go. Please "
@@ -258,32 +254,29 @@ CodeGenData *ReducedGen::goMakeCodeGen( const char *sourceFileName, const char *
exit(1);
}
- codeGen->sourceFileName = sourceFileName;
- codeGen->fsmName = fsmName;
-
return codeGen;
}
/* Invoked by the parser when a ragel definition is opened. */
-CodeGenData *ReducedGen::rubyMakeCodeGen( const char *sourceFileName, const char *fsmName, ostream &out )
+CodeGenData *rubyMakeCodeGen( const CodeGenArgs &args )
{
CodeGenData *codeGen = 0;
switch ( codeStyle ) {
case GenTables:
- codeGen = new RubyTabCodeGen(out);
+ codeGen = new RubyTabCodeGen(args);
break;
case GenFTables:
- codeGen = new RubyFTabCodeGen(out);
+ codeGen = new RubyFTabCodeGen(args);
break;
case GenFlat:
- codeGen = new RubyFlatCodeGen(out);
+ codeGen = new RubyFlatCodeGen(args);
break;
case GenFFlat:
- codeGen = new RubyFFlatCodeGen(out);
+ codeGen = new RubyFFlatCodeGen(args);
break;
case GenGoto:
if ( rubyImpl == Rubinius ) {
- codeGen = new RbxGotoCodeGen(out);
+ codeGen = new RbxGotoCodeGen(args);
} else {
cerr << "Goto style is still _very_ experimental "
"and only supported using Rubinius.\n"
@@ -297,102 +290,94 @@ CodeGenData *ReducedGen::rubyMakeCodeGen( const char *sourceFileName, const char
exit(1);
break;
}
- codeGen->sourceFileName = sourceFileName;
- codeGen->fsmName = fsmName;
return codeGen;
}
/* Invoked by the parser when a ragel definition is opened. */
-CodeGenData *ReducedGen::csharpMakeCodeGen( const char *sourceFileName, const char *fsmName, ostream &out )
+CodeGenData *csharpMakeCodeGen( const CodeGenArgs &args )
{
CodeGenData *codeGen = 0;
switch ( codeStyle ) {
case GenTables:
- codeGen = new CSharpTabCodeGen(out);
+ codeGen = new CSharpTabCodeGen(args);
break;
case GenFTables:
- codeGen = new CSharpFTabCodeGen(out);
+ codeGen = new CSharpFTabCodeGen(args);
break;
case GenFlat:
- codeGen = new CSharpFlatCodeGen(out);
+ codeGen = new CSharpFlatCodeGen(args);
break;
case GenFFlat:
- codeGen = new CSharpFFlatCodeGen(out);
+ codeGen = new CSharpFFlatCodeGen(args);
break;
case GenGoto:
- codeGen = new CSharpGotoCodeGen(out);
+ codeGen = new CSharpGotoCodeGen(args);
break;
case GenFGoto:
- codeGen = new CSharpFGotoCodeGen(out);
+ codeGen = new CSharpFGotoCodeGen(args);
break;
case GenIpGoto:
- codeGen = new CSharpIpGotoCodeGen(out);
+ codeGen = new CSharpIpGotoCodeGen(args);
break;
case GenSplit:
- codeGen = new CSharpSplitCodeGen(out);
+ codeGen = new CSharpSplitCodeGen(args);
break;
}
- codeGen->sourceFileName = sourceFileName;
- codeGen->fsmName = fsmName;
-
return codeGen;
}
/* Invoked by the parser when a ragel definition is opened. */
-CodeGenData *ReducedGen::ocamlMakeCodeGen( const char *sourceFileName, const char *fsmName, ostream &out )
+CodeGenData *ocamlMakeCodeGen( const CodeGenArgs &args )
{
CodeGenData *codeGen = 0;
switch ( codeStyle ) {
case GenTables:
- codeGen = new OCamlTabCodeGen(out);
+ codeGen = new OCamlTabCodeGen(args);
break;
case GenFTables:
- codeGen = new OCamlFTabCodeGen(out);
+ codeGen = new OCamlFTabCodeGen(args);
break;
case GenFlat:
- codeGen = new OCamlFlatCodeGen(out);
+ codeGen = new OCamlFlatCodeGen(args);
break;
case GenFFlat:
- codeGen = new OCamlFFlatCodeGen(out);
+ codeGen = new OCamlFFlatCodeGen(args);
break;
case GenGoto:
- codeGen = new OCamlGotoCodeGen(out);
+ codeGen = new OCamlGotoCodeGen(args);
break;
default:
cerr << "I only support the -T0 -T1 -F0 -F1 and -G0 output styles for OCaml.\n";
exit(1);
}
- codeGen->sourceFileName = sourceFileName;
- codeGen->fsmName = fsmName;
-
return codeGen;
}
-CodeGenData *ReducedGen::makeCodeGen( const char *sourceFileName, const char *fsmName, ostream &out )
+CodeGenData *makeCodeGen( const CodeGenArgs &args )
{
CodeGenData *cgd = 0;
if ( hostLang == &hostLangC )
- cgd = cdMakeCodeGen( sourceFileName, fsmName, out );
+ cgd = cdMakeCodeGen( args );
else if ( hostLang == &hostLangD )
- cgd = cdMakeCodeGen( sourceFileName, fsmName, out );
+ cgd = cdMakeCodeGen( args );
else if ( hostLang == &hostLangD2 )
- cgd = cdMakeCodeGen( sourceFileName, fsmName, out );
+ cgd = cdMakeCodeGen( args );
else if ( hostLang == &hostLangGo )
- cgd = goMakeCodeGen( sourceFileName, fsmName, out );
+ cgd = goMakeCodeGen( args );
else if ( hostLang == &hostLangJava )
- cgd = javaMakeCodeGen( sourceFileName, fsmName, out );
+ cgd = javaMakeCodeGen( args );
else if ( hostLang == &hostLangRuby )
- cgd = rubyMakeCodeGen( sourceFileName, fsmName, out );
+ cgd = rubyMakeCodeGen( args );
else if ( hostLang == &hostLangCSharp )
- cgd = csharpMakeCodeGen( sourceFileName, fsmName, out );
+ cgd = csharpMakeCodeGen( args );
else if ( hostLang == &hostLangOCaml )
- cgd = ocamlMakeCodeGen( sourceFileName, fsmName, out );
+ cgd = ocamlMakeCodeGen( args );
return cgd;
}
diff --git a/ragel/rubycodegen.h b/ragel/rubycodegen.h
index 4e3a30d6..5dffdb6c 100644
--- a/ragel/rubycodegen.h
+++ b/ragel/rubycodegen.h
@@ -33,7 +33,7 @@
class RubyCodeGen : public CodeGenData
{
public:
- RubyCodeGen( ostream &out ) : CodeGenData(out) { }
+ RubyCodeGen( const CodeGenArgs &args ) : CodeGenData(args) { }
virtual ~RubyCodeGen() {}
protected:
ostream &START_ARRAY_LINE();
diff --git a/ragel/rubyfflat.h b/ragel/rubyfflat.h
index 4ac412f9..8df9ada2 100644
--- a/ragel/rubyfflat.h
+++ b/ragel/rubyfflat.h
@@ -29,8 +29,8 @@
class RubyFFlatCodeGen : public RubyFlatCodeGen
{
public:
- RubyFFlatCodeGen( ostream &out ) :
- RubyFlatCodeGen(out) {}
+ RubyFFlatCodeGen( const CodeGenArgs &args ) :
+ RubyFlatCodeGen(args) {}
protected:
std::ostream &TO_STATE_ACTION_SWITCH();
diff --git a/ragel/rubyflat.h b/ragel/rubyflat.h
index 51367910..e1bed2b4 100644
--- a/ragel/rubyflat.h
+++ b/ragel/rubyflat.h
@@ -36,8 +36,9 @@ using std::ostream;
class RubyFlatCodeGen : public RubyCodeGen
{
public:
- RubyFlatCodeGen( ostream &out ) :
- RubyCodeGen(out) {};
+ RubyFlatCodeGen( const CodeGenArgs &args )
+ : RubyCodeGen(args) {};
+
virtual ~RubyFlatCodeGen() {}
protected:
diff --git a/ragel/rubyftable.h b/ragel/rubyftable.h
index 91d7fe50..95fb104e 100644
--- a/ragel/rubyftable.h
+++ b/ragel/rubyftable.h
@@ -28,7 +28,9 @@
class RubyFTabCodeGen : public RubyTabCodeGen
{
public:
- RubyFTabCodeGen( ostream &out ): RubyTabCodeGen(out) {}
+ RubyFTabCodeGen( const CodeGenArgs &args )
+ : RubyTabCodeGen(args) {}
+
protected:
std::ostream &TO_STATE_ACTION_SWITCH();
std::ostream &FROM_STATE_ACTION_SWITCH();
diff --git a/ragel/rubytable.h b/ragel/rubytable.h
index 76b847fd..0c11a48e 100644
--- a/ragel/rubytable.h
+++ b/ragel/rubytable.h
@@ -40,9 +40,10 @@ using std::ostream;
class RubyTabCodeGen : public RubyCodeGen
{
public:
- RubyTabCodeGen( ostream &out ) :
- RubyCodeGen(out) {}
- virtual ~RubyTabCodeGen() {}
+ RubyTabCodeGen( const CodeGenArgs &args )
+ : RubyCodeGen(args) {}
+
+ virtual ~RubyTabCodeGen() {}
public:
void BREAK( ostream &ret, int targState );
diff --git a/ragel/xmlcodegen.h b/ragel/xmlcodegen.h
index 121afa0d..6d31f3d2 100644
--- a/ragel/xmlcodegen.h
+++ b/ragel/xmlcodegen.h
@@ -138,22 +138,16 @@ private:
std::ostream &out;
};
+CodeGenData *makeCodeGen( InputData &inputData, char *fsmName, ParseData *pd, FsmAp *fsm );
+struct CodeGenArgs;
+
class ReducedGen : protected GenBase
{
public:
- ReducedGen( InputData &inputData, char *fsmName, ParseData *pd, FsmAp *fsm );
+ ReducedGen( const CodeGenArgs &args );
CodeGenData *make();
private:
- /* Invoked by the parser when a ragel definition is opened. */
- CodeGenData *cdMakeCodeGen( const char *sourceFileName, const char *fsmName, ostream &out );
- CodeGenData *javaMakeCodeGen( const char *sourceFileName, const char *fsmName, ostream &out );
- CodeGenData *goMakeCodeGen( const char *sourceFileName, const char *fsmName, ostream &out );
- CodeGenData *rubyMakeCodeGen( const char *sourceFileName, const char *fsmName, ostream &out );
- CodeGenData *csharpMakeCodeGen( const char *sourceFileName, const char *fsmName, ostream &out );
- CodeGenData *ocamlMakeCodeGen( const char *sourceFileName, const char *fsmName, ostream &out );
- CodeGenData *makeCodeGen( const char *sourceFileName, const char *fsmName, ostream &out );
-
void makeGenInlineList( GenInlineList *outList, InlineList *inList );
void makeKey( GenInlineList *outList, Key key );
void makeText( GenInlineList *outList, InlineItem *item );