00001
00002
00003
00004
00005
00006
00014
00015
00016
00017
00018
00019 #ifndef DIC_PARSER_BASE_H
00020 #define DIC_PARSER_BASE_H
00021
00022
00023 #include <iostream>
00024 #include <stdio.h>
00025 #include <stdlib.h>
00026 #include <string.h>
00027 #include "DICScannerBase.h"
00028 #include "DICParserInt.h"
00029 #include "CifFileReadDef.h"
00030 #include "ISTable.h"
00031 #include "DdlFile.h"
00032 #include "DicFile.h"
00033
00043 class DICParser : public DICScanner
00044 {
00045 public:
00067 DICParser(DicFile* dicFileP, DdlFile* ddlFileP, bool verbose = false);
00068
00086 void Parse(const string& fileName, string& diagnostics);
00087
00101 virtual ~DICParser();
00102
00107 void Error(const char*);
00108
00113 void Clear();
00114
00119 void Reset();
00120
00125 void ProcessAssignments(void);
00126
00131 void ProcessOneAssignment(void);
00132
00137 void ProcessItemNameListLoop(void);
00138
00143 void ProcessItemNameListName(void);
00144
00149 void ProcessValueListItem(void);
00150
00155 void ProcessItemName(void);
00156
00161 void ProcessLoop(void);
00162
00167 void ProcessItemValue(void);
00168
00173 void ProcessLsItemValue(void);
00174
00179 void ProcessUnknownValue(void);
00180
00185 void ProcessMissingValue(void);
00186
00191 void ProcessSaveBegin(void);
00192
00197 void ProcessSaveEnd(void);
00198
00203 void ProcessDataBlockName(void);
00204
00205 private:
00206 string _uString;
00207 string _mString;
00208 DicFile *_fobj;
00209 ISTable *_tbl;
00210 int _afterLoop;
00211 DicFile *_saveobj;
00212 ISTable *_savetbl;
00213 ISTable *_prevtbl;
00214 ISTable * format;
00215 ISTable * cattbl;
00216 ISTable * itemtbl;
00217 DdlFile *ddl;
00218 int itemColIndex;
00219 int catColIndex;
00220 int colIndex2;
00221 vector<string> listcat, listitem;
00222 vector<string> listitem2;
00223 int _nTablesInBlock;
00224 int _curItemNo, _curValueNo, _numDataBlocks, _fieldListAlloc,
00225 _curRow, _curCol;
00226 vector<string> _fieldList;
00227 string _pBufValue;
00228 vector<string> * _rowBuf;
00229 string _tBufKeyword;
00230 string _curCategoryName;
00231 string _curDataBlockName;
00232 string _prevDataBlockName;
00233 int _nTablesInBlockSave;
00234 int _curItemNoSave, _curValueNoSave;
00235 int _numDataBlocksSave, _fieldListAllocSave;
00236 int _curRowSave, _curColSave;
00237 vector<string> _fieldListSave;
00238 vector<string> * _rowBufSave;
00239 string _curCategoryNameSave;
00240 string _curDataBlockNameSave;
00241 string _prevDataBlockNameSave;
00242 string _tmpDataBlockNameSave;
00243 string _tmpDataBlockNameSaveL;
00244 string errorLog;
00245 void ProcessLoopDeclaration(void);
00246 void ProcessItemNameList(void);
00247 void ProcessValueList(void);
00248 void ProcessItemValuePair(void);
00249 void ProcessLoopDeclarationSave(void);
00250 void ProcessItemNameListSave(void);
00251 void ProcessValueListSave(void);
00252 void ProcessItemValuePairSave(void);
00253 void CheckDDL(void);
00254 };
00255
00256 #endif