00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef CPARSER_H
00012 #define CPARSER_H
00013
00014 #ifdef __GNUG__
00015 #pragma interface
00016 #endif
00017
00018 #include <ctype.h>
00019 #include <fstream.h>
00020 #include <iostream.h>
00021 #include "wx/string.h"
00022 #ifdef __UNIX__
00023 #include <strstream.h>
00024 #else
00025 #include <strstrea.h>
00026 #endif
00027 #include <stdio.h>
00028 #include <string.h>
00029 #include <stdlib.h>
00030
00031 #include "_dl_itr.h"
00032
00033
00034 #include "alias.h"
00035
00037
00079 class CommandParser
00080 {
00081 public:
00082 CommandParser();
00083 virtual ~CommandParser();
00084
00086 bool GetCommand();
00088 bool FlushArg();
00089
00091 wxString GetErrorMes();
00092
00094 bool GetEnv(const wxString& envname, wxString& envstring);
00095
00097 DL_List<const wxString*>* GetArgList();
00099 DL_Iter<const wxString*>* GetArgIter();
00100
00102 wxString GetCommandParsed();
00103
00104 protected:
00105 bool Blanks();
00106 bool Word();
00107 bool MultiPartWord();
00108 bool QuotedString();
00109 bool BracedString();
00110 bool Comment();
00111 bool VarRef(char type);
00112 bool Name();
00113
00114
00115 virtual char PeekNextC()=0;
00116 virtual void IncC()=0;
00117
00118 protected:
00119 char a;
00120 AliasList* _aliaslist;
00121 DL_List<const wxString*>* _arglist;
00122 DL_Iter<const wxString*>* _I;
00123 wxString _commandsofar;
00124
00125 private:
00126 wxString _error_mes;
00127 wxString _b;
00128 wxString _varref;
00129
00130 };
00131
00132
00134
00139 class Evalstring : public CommandParser, public ostrstream
00140 {
00141 public:
00142 Evalstring(AliasList* aliaslist);
00143 ~Evalstring();
00144
00145 bool Parse(wxString& tostring);
00146 const wxString* GetValue(int i);
00147 bool GetNextCommand();
00148
00149
00150 protected:
00151
00152 void IncC();
00153 char PeekNextC();
00154
00155 private:
00156 int _linenumber;
00157 char* _commands;
00158 char* _c;
00159
00160 };
00161
00162 #endif
cparser.h Source File -- Thu Nov 28 21:24:56 2002 -- 28 Nov 2002 -- 1.2.18 -- -- . --