/*
- * Copyright 2001-2006 Adrian Thurston <thurston@cs.queensu.ca>
+ * Copyright 2001-2008 Adrian Thurston <thurston@complang.org>
*/
/* This file is part of Ragel.
#include <iostream>
#include <limits.h>
+#include <sstream>
#include "avlmap.h"
#include "bstmap.h"
#include "vector.h"
struct ReOrBlock;
struct ReOrItem;
struct LongestMatch;
+struct InputData;
+struct CodeGenData;
typedef DList<LongestMatch> LmList;
NameInst *prevLocalScope;
};
+struct LengthDef
+{
+ LengthDef( char *name )
+ : name(name) {}
+
+ char *name;
+ LengthDef *prev, *next;
+};
+
+typedef DList<LengthDef> LengthDefList;
+
/* Class to collect information about the machine during the
* parse of input. */
struct ParseData
{
/* Create a new parse data object. This is done at the beginning of every
* fsm specification. */
- ParseData( char *fileName, char *sectionName, const InputLoc §ionLoc );
+ ParseData( const char *fileName, char *sectionName, const InputLoc §ionLoc );
~ParseData();
/*
void prepareMachineGen( GraphDictEl *graphDictEl );
void prepareMachineGenTBWrapped( GraphDictEl *graphDictEl );
void generateXML( ostream &out );
+ void generateReduced( InputData &inputData );
FsmAp *sectionGraph;
bool generatingSectionSubset;
InputLoc rangeLowLoc, rangeHighLoc;
/* The name of the file the fsm is from, and the spec name. */
- char *fileName;
+ const char *fileName;
char *sectionName;
InputLoc sectionLoc;
KeyOps thisKeyOps;
ExportList exportList;
+ LengthDefList lengthDefList;
+
+ CodeGenData *cgd;
};
void afterOpMinimize( FsmAp *fsm, bool lastInSeq = true );
void errorStateLabels( const NameSet &locations );
-/* Data used by the parser specific to the current file. Supports the include
- * system, since a new parser is executed for each included file. */
-struct InputData
-{
- InputData( char *fileName, char *includeSpec, char *includeTo ) :
- pd(0), sectionName(0), defaultParseData(0),
- first_line(1), first_column(1),
- last_line(1), last_column(0),
- fileName(fileName), includeSpec(includeSpec),
- includeTo(includeTo), active(true)
- {}
-
- /* For collecting a name references. */
- NameRef nameRef;
- NameRefList nameRefList;
-
- /* The parse data. For each fsm spec, the parser collects things that it parses
- * in data structures in here. */
- ParseData *pd;
-
- char *sectionName;
- ParseData *defaultParseData;
-
- int first_line;
- int first_column;
- int last_line;
- int last_column;
-
- char *fileName;
-
- /* If this is an included file, this contains the specification to search
- * for. IncludeTo will contain the spec name that does the includng. */
- char *includeSpec;
- char *includeTo;
-
- bool active;
- InputLoc sectionLoc;
-};
-
-struct Parser;
-
-typedef AvlMap<char*, Parser *, CmpStr> ParserDict;
-typedef AvlMapEl<char*, Parser *> ParserDictEl;
-
-extern ParserDict parserDict;
-
-#endif /* _PARSEDATA_H */
+#endif