00001 /*************************************************************************** 00002 parser.h 00003 ------------------- 00004 begin : 2004-04-17 00005 copyright : (C) 2004-2005 by Michael Menne 00006 email : menne@users.sourceforge.net 00007 ***************************************************************************/ 00008 00009 /*************************************************************************** 00010 This program is free software; you can redistribute it and/or 00011 modify it under the terms of the GNU General Public License 00012 as published by the Free Software Foundation; either version 2 00013 of the License, or (at your option) any later version. 00014 00015 This program is distributed in the hope that it will be useful, 00016 but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00018 GNU General Public License for more details. 00019 00020 You should have received a copy of the GNU General Public License 00021 along with this program; if not, write to the Free Software 00022 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00023 ***************************************************************************/ 00024 00025 #ifndef PARSER_H 00026 #define PARSER_H 00027 00028 #define MAXTOKEN 1024 00029 00030 00035 class CParser 00036 { 00037 public: 00038 CParser(); 00039 ~CParser(); 00040 00041 bool NextToken(bool bCrossline); 00042 void StartParseBuffer( const unsigned char *pBuffer, const int nSize ); 00043 void StartParseString( const char *szString ); 00044 bool StartParseFile ( const char *szFile ); 00045 00046 int SkipLine( ); 00047 00048 const char* Token() { return m_szToken; } 00049 int Scriptline() { return m_nScriptLine; } 00050 00051 00052 protected: 00053 char m_szToken[MAXTOKEN];// buffer for tokens 00054 int m_nScriptLine; 00055 00056 const unsigned char *m_pBuffer; 00057 const unsigned char *m_pBufEnd; 00058 00059 unsigned char *m_pFileMem; 00060 }; 00061 00062 #endif // PARSER_H 00063 00064 // kate: space-indent off; tab-width 4; replace-tabs off;