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 DicFile *_fobj;
00207 ISTable *_tbl;
00208 int _afterLoop;
00209 DicFile *_saveobj;
00210 ISTable *_savetbl;
00211 ISTable *_prevtbl;
00212 ISTable * format;
00213 ISTable * cattbl;
00214 ISTable * itemtbl;
00215 DdlFile *ddl;
00216 int itemColIndex;
00217 int catColIndex;
00218 int colIndex2;
00219 vector<string> listcat, listitem;
00220 vector<string> listitem2;
00221 int _nTablesInBlock;
00222 int _curItemNo, _curValueNo, _numDataBlocks, _fieldListAlloc, _curRow;
00223 vector<string> _fieldList;
00224 string _pBufValue;
00225 string _tBufKeyword;
00226 string _curCategoryName;
00227 string _curDataBlockName;
00228 string _prevDataBlockName;
00229 int _nTablesInBlockSave;
00230 int _curItemNoSave, _curValueNoSave;
00231 int _numDataBlocksSave, _fieldListAllocSave;
00232 int _curRowSave;
00233 vector<string> _fieldListSave;
00234 string _curCategoryNameSave;
00235 string _curDataBlockNameSave;
00236 string _prevDataBlockNameSave;
00237 string _tmpDataBlockNameSave;
00238 string _tmpDataBlockNameSaveL;
00239 string errorLog;
00240 void ProcessLoopDeclaration(void);
00241 void ProcessItemNameList(void);
00242 void ProcessValueList(void);
00243 void ProcessItemValuePair(void);
00244 void ProcessLoopDeclarationSave(void);
00245 void ProcessItemNameListSave(void);
00246 void ProcessValueListSave(void);
00247 void ProcessItemValuePairSave(void);
00248 void CheckDDL(void);
00249 };
00250
00251 #endif