update(add) packaging directory and spec file from OBSTF:Private, OBS
[external/ragel.git] / ragel / rlparse.kh
index a829d78..899bbbc 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  Copyright 2001-2007 Adrian Thurston <thurston@cs.queensu.ca>
+ *  Copyright 2001-2007 Adrian Thurston <thurston@complang.org>
  */
 
 /*  This file is part of Ragel.
@@ -19,8 +19,8 @@
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
  */
 
-#ifndef RLPARSE_H
-#define RLPARSE_H
+#ifndef _RLPARSE_H
+#define _RLPARSE_H
 
 #include <iostream>
 #include "avltree.h"
 /* This is used for tracking the include files/machine pairs. */
 struct IncludeHistoryItem
 {
-       IncludeHistoryItem( char *fileName, char *sectionName )
+       IncludeHistoryItem( const char *fileName, const char *sectionName )
                : fileName(fileName), sectionName(sectionName) {}
 
-       char *fileName;
-       char *sectionName;
+       const char *fileName;
+       const char *sectionName;
 };
 
 typedef Vector<IncludeHistoryItem> IncludeHistory;
@@ -93,7 +93,7 @@ struct Parser
        token KW_Machine, KW_Include, KW_Import, KW_Write, KW_Action, KW_AlphType,
                KW_Range, KW_GetKey, KW_Include, KW_Write, KW_Machine, KW_InWhen,
                KW_When, KW_OutWhen, KW_Eof, KW_Err, KW_Lerr, KW_To, KW_From,
-               KW_Export, KW_PrePush, KW_PostPop;
+               KW_Export, KW_PrePush, KW_PostPop, KW_Length;
 
        # Specials in code blocks.
        token KW_Break, KW_Exec, KW_Hold, KW_PChar, KW_Char, KW_Goto, KW_Call,
@@ -106,16 +106,18 @@ struct Parser
        void init();
        int parseLangEl( int type, const Token *token );
 
-       Parser( char *fileName, char *sectionName, InputLoc &sectionLoc )
+       Parser( const char *fileName, char *sectionName, InputLoc &sectionLoc )
                : sectionName(sectionName)
        {
                pd = new ParseData( fileName, sectionName, sectionLoc );
                exportContext.append( false );
+               includeHistory.append( IncludeHistoryItem( 
+                               fileName, sectionName ) );
        }
 
        int token( InputLoc &loc, int tokId, char *tokstart, int toklen );
        void tryMachineDef( InputLoc &loc, char *name, 
-               JoinOrLm *joinOrLm, bool isInstance );
+               MachineDef *machineDef, bool isInstance );
 
        /* Report an error encountered by the parser. */
        ostream &parse_error( int tokId, Token &token );
@@ -130,6 +132,8 @@ struct Parser
 
        Vector<bool> exportContext;
        IncludeHistory includeHistory;
+
+       Parser *prev, *next;
 };
 
 %% write token_defs;