/*
- * Copyright 2001-2006 Adrian Thurston <thurston@cs.queensu.ca>
+ * Copyright 2001-2006 Adrian Thurston <thurston@complang.org>
*/
/* This file is part of Ragel.
struct Factor;
struct Expression;
struct Join;
-struct JoinOrLm;
+struct MachineDef;
struct LongestMatch;
struct LongestMatchPart;
struct LmPartList;
struct Range;
+struct LengthDef;
/* Type of augmentation. Describes locations in the machine. */
enum AugType
Action *action;
};
+struct ConditionTest
+{
+ ConditionTest( const InputLoc &loc, AugType type, Action *action, bool sense ) :
+ loc(loc), type(type), action(action), sense(sense) { }
+
+ InputLoc loc;
+ AugType type;
+ Action *action;
+ bool sense;
+};
+
struct Token
{
char *data;
int length;
InputLoc loc;
- void prepareLitString( Token &result, bool &caseInsensitive );
void append( const Token &other );
- void set( char *str, int len );
+ void set( const char *str, int len );
};
+char *prepareLitString( const InputLoc &loc, const char *src, long length,
+ long &resLen, bool &caseInsensitive );
+
/* Store the value and type of a priority augmentation. */
struct PriorityAug
{
*/
struct VarDef
{
- VarDef( char *name, JoinOrLm *joinOrLm )
- : name(name), joinOrLm(joinOrLm) { }
+ VarDef( const char *name, MachineDef *machineDef )
+ : name(name), machineDef(machineDef), isExport(false) { }
/* Parse tree traversal. */
FsmAp *walk( ParseData *pd );
void makeNameTree( const InputLoc &loc, ParseData *pd );
void resolveNameRefs( ParseData *pd );
- char *name;
- JoinOrLm *joinOrLm;
+ const char *name;
+ MachineDef *machineDef;
+ bool isExport;
};
FsmAp *walk( ParseData *pd );
void makeNameTree( ParseData *pd );
void resolveNameRefs( ParseData *pd );
- void runLonestMatch( ParseData *pd, FsmAp *graph );
- Action *newAction( ParseData *pd, const InputLoc &loc, char *name,
+ void transferScannerLeavingActions( FsmAp *graph );
+ void runLongestMatch( ParseData *pd, FsmAp *graph );
+ Action *newAction( ParseData *pd, const InputLoc &loc, const char *name,
InlineList *inlineList );
void makeActions( ParseData *pd );
void findName( ParseData *pd );
InputLoc loc;
LmPartList *longestMatchList;
- char *name;
+ const char *name;
Action *lmActSelect;
bool lmSwitchHandlesError;
/* List of Expressions. */
typedef DList<Expression> ExprList;
-struct JoinOrLm
+struct MachineDef
{
enum Type {
JoinType,
- LongestMatchType
+ LongestMatchType,
+ LengthDefType
};
- JoinOrLm( Join *join ) :
- join(join), type(JoinType) {}
- JoinOrLm( LongestMatch *longestMatch ) :
- longestMatch(longestMatch), type(LongestMatchType) {}
+ MachineDef( Join *join )
+ : join(join), longestMatch(0), lengthDef(0), type(JoinType) {}
+ MachineDef( LongestMatch *longestMatch )
+ : join(0), longestMatch(longestMatch), lengthDef(0), type(LongestMatchType) {}
+ MachineDef( LengthDef *lengthDef )
+ : join(0), longestMatch(0), lengthDef(lengthDef), type(LengthDefType) {}
FsmAp *walk( ParseData *pd );
void makeNameTree( ParseData *pd );
Join *join;
LongestMatch *longestMatch;
+ LengthDef *lengthDef;
Type type;
};
PriorDesc *priorDescs;
Vector<Label> labels;
Vector<EpsilonLink> epsilonLinks;
- Vector<ParserAction> conditions;
+ Vector<ConditionTest> conditions;
FactorWithRep *factorWithRep;
};
~Range();
FsmAp *walk( ParseData *pd );
- bool verifyRangeFsm( FsmAp *rangeEnd );
Literal *lowerLit;
Literal *upperLit;
* ptreetypes, which should be just typedef forwards. */
struct InlineList : public DList<InlineItem> { };
-
-
-#endif /* _PARSETREE_H */
+#endif