00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef _WXCPARSER_H
00024 #define _WXCPARSER_H
00025
00026 #ifndef WX_PRECOMP
00027 #include "wx/wx.h"
00028 #endif
00029
00030 #include "wx/defs.h"
00031 #include <ctype.h>
00032
00033 #include <stdio.h>
00034 #include <stdlib.h>
00035
00036 #include <wx/stream.h>
00037 #include <wx/mstream.h>
00038 #include <wx/wfstream.h>
00039 #include <wx/string.h>
00040
00041 #include "wx/general/gen.h"
00042 #include "wx/docview/doccom.h"
00043 #include "wx/docview/docviewref.h"
00044 #include "wx/xmlparse/genxmlpars.h"
00045
00046
00047
00048
00049 class A2DDOCVIEWDLLEXP a2dCommand_Error
00050 {
00051
00052 public:
00053 a2dCommand_Error( const wxString& message = wxT(""), const wxString& header = wxT("") );
00054 a2dCommand_Error( const a2dCommand_Error& a );
00055
00056 wxString& GetMessage() { return m_message; }
00057 wxString& GetHeader(){ return m_header; }
00058
00059 protected:
00060 wxString m_message;
00061 wxString m_header;
00062
00063 };
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134 class A2DDOCVIEWDLLEXP a2dCommandParser
00135 {
00136 public:
00137
00138 a2dCommandParser();
00139
00140 virtual ~a2dCommandParser();
00141
00142
00143 bool GetCommand();
00144
00145
00146 bool FlushArg();
00147
00148
00149 wxString GetErrorMes();
00150
00151 wxUint32 GetLineNumber() { return m_linenumber; }
00152
00153
00154 bool GetEnv(const wxString& envname, wxString& envstring);
00155
00156
00157 a2dVariablesArray& GetArgumentList() { return m_argumentlist; }
00158
00159
00160
00161
00162
00163 wxString GetItem( int i);
00164
00165
00166
00167
00168
00169 a2dNamedProperty* GetProperty( int i);
00170
00171
00172 int GetCount() { return m_argumentlist.GetCount(); }
00173
00174
00175
00176
00177
00178
00179 wxString GetNextItem();
00180
00181
00182 a2dNamedProperty* GetNextProp();
00183
00184
00185 bool GetNextItemBool();
00186
00187
00188 int GetNextItemInt();
00189
00190
00191 double GetNextItemDouble();
00192
00193
00194
00195
00196
00197 bool HasMoreItems() { return m_item < m_argumentlist.GetCount(); }
00198
00199
00200 wxString GetCommandParsed();
00201
00202 protected:
00203
00204 bool Blanks();
00205 bool Word();
00206 bool Number( const wxString& number );
00207 bool MultiPartWord();
00208 bool QuotedString();
00209 bool BracedString();
00210 bool Comment();
00211 bool VarRef( wxChar type);
00212 bool Name();
00213
00214
00215 virtual wxChar PeekNextC()=0;
00216 virtual void IncC()=0;
00217
00218 wxChar a;
00219 a2dVariablesHash m_aliaslist;
00220
00221 a2dVariablesArray m_argumentlist;
00222
00223 wxString m_commandsofar;
00224
00225 wxString m_error_mes;
00226 wxString m_b;
00227 wxString m_varref;
00228
00229 int m_item;
00230
00231
00232 wxUint32 m_linenumber;
00233 };
00234
00235
00236
00237
00238
00239
00240
00241 class A2DDOCVIEWDLLEXP a2dEvalCommandString : public a2dCommandParser, public wxMemoryInputStream
00242 {
00243
00244 public:
00245
00246 a2dEvalCommandString( const wxString& commandString, a2dVariablesHash& aliaslist );
00247
00248 ~a2dEvalCommandString();
00249
00250 bool ParseNextCommand();
00251
00252 const wxString& GetEvaluatedString() const { return m_evaluated; }
00253
00254 void Reset();
00255
00256 void ResetEvaluatedString();
00257
00258 protected:
00259
00260 void IncC();
00261 wxChar PeekNextC();
00262
00263 private:
00264
00265 int m_linenumber;
00266 const wxChar* m_commands;
00267 const wxChar* m_c;
00268
00269 wxString m_evaluated;
00270 };
00271
00272
00273
00274
00275 class A2DDOCVIEWDLLEXP a2dFileLineParser : public a2dCommandParser , public wxFileInputStream
00276 {
00277 public:
00278
00279
00280 a2dFileLineParser( const wxString& the_file, a2dVariablesHash& aliaslist );
00281
00282
00283 ~a2dFileLineParser();
00284
00285
00286 bool ReadItem( const wxString& type );
00287
00288
00289 int GetLineNumber() { return m_linenumber; }
00290
00291
00292 wxString& GetFileName(){return m_line_file;}
00293
00294
00295 void Reset();
00296
00297
00298 bool ParseNextCommand();
00299
00300 wxString& LastReadCommand() { return m_keyword; }
00301
00302 protected:
00303
00304 void IncC();
00305
00306
00307 wxChar PeekNextC();
00308
00309
00310 int m_linenumber;
00311
00312
00313 wxString m_line_file;
00314
00315
00316 wxString m_keyword;
00317
00318
00319 bool m_back;
00320 };
00321
00322
00323 #endif