"eof" is no longer a write command.
[external/ragel.git] / ragel / parsetree.h
index f208452..54a8671 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  Copyright 2001-2006 Adrian Thurston <thurston@cs.queensu.ca>
+ *  Copyright 2001-2006 Adrian Thurston <thurston@complang.org>
  */
 
 /*  This file is part of Ragel.
@@ -181,17 +181,30 @@ struct ParserAction
        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
 {
@@ -208,16 +221,17 @@ struct PriorityAug
  */
 struct VarDef
 {
-       VarDef( char *name, JoinOrLm *joinOrLm )
-               : name(name), joinOrLm(joinOrLm) { }
+       VarDef( const char *name, JoinOrLm *joinOrLm )
+               : name(name), joinOrLm(joinOrLm), isExport(false) { }
        
        /* Parse tree traversal. */
        FsmAp *walk( ParseData *pd );
        void makeNameTree( const InputLoc &loc, ParseData *pd );
        void resolveNameRefs( ParseData *pd );
 
-       char *name;
+       const char *name;
        JoinOrLm *joinOrLm;
+       bool isExport;
 };
 
 
@@ -286,8 +300,9 @@ struct LongestMatch
        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 );
@@ -295,7 +310,7 @@ struct LongestMatch
 
        InputLoc loc;
        LmPartList *longestMatchList;
-       char *name;
+       const char *name;
 
        Action *lmActSelect;
        bool lmSwitchHandlesError;
@@ -315,9 +330,9 @@ struct JoinOrLm
        };
 
        JoinOrLm( Join *join ) : 
-               join(join), type(JoinType) {}
+               join(join), longestMatch(0), type(JoinType) {}
        JoinOrLm( LongestMatch *longestMatch ) :
-               longestMatch(longestMatch), type(LongestMatchType) {}
+               join(0), longestMatch(longestMatch), type(LongestMatchType) {}
 
        FsmAp *walk( ParseData *pd );
        void makeNameTree( ParseData *pd );
@@ -453,7 +468,7 @@ struct FactorWithAug
        PriorDesc *priorDescs;
        Vector<Label> labels;
        Vector<EpsilonLink> epsilonLinks;
-       Vector<ParserAction> conditions;
+       Vector<ConditionTest> conditions;
 
        FactorWithRep *factorWithRep;
 };
@@ -480,8 +495,8 @@ struct FactorWithRep
                factorWithNeg(0), lowerRep(lowerRep), 
                upperRep(upperRep), type(type) { }
        
-       FactorWithRep( const InputLoc &loc, FactorWithNeg *factorWithNeg )
-               : loc(loc), factorWithNeg(factorWithNeg), type(FactorWithNegType) { }
+       FactorWithRep( FactorWithNeg *factorWithNeg )
+               : factorWithNeg(factorWithNeg), type(FactorWithNegType) { }
 
        ~FactorWithRep();
 
@@ -512,8 +527,8 @@ struct FactorWithNeg
        FactorWithNeg( const InputLoc &loc, FactorWithNeg *factorWithNeg, Type type) :
                loc(loc), factorWithNeg(factorWithNeg), factor(0), type(type) { }
 
-       FactorWithNeg( const InputLoc &loc, Factor *factor ) :
-               loc(loc), factorWithNeg(0), factor(factor), type(FactorType) { }
+       FactorWithNeg( Factor *factor ) :
+               factorWithNeg(0), factor(factor), type(FactorType) { }
 
        ~FactorWithNeg();
 
@@ -600,7 +615,6 @@ struct Range
 
        ~Range();
        FsmAp *walk( ParseData *pd );
-       bool verifyRangeFsm( FsmAp *rangeEnd );
 
        Literal *lowerLit;
        Literal *upperLit;