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 "DicFile.h"
00032
00042 class DICParser : public DICScanner
00043 {
00044 public:
00066 DICParser(DicFile* dicFileP, CifFile* ddlFileP, bool verbose = false);
00067
00085 void Parse(const string& fileName, string& diagnostics);
00086
00100 virtual ~DICParser();
00101
00106 void Error(const char*);
00107
00112 void Clear();
00113
00118 void Reset();
00119
00124 void ProcessAssignments(void);
00125
00130 void ProcessOneAssignment(void);
00131
00136 void ProcessItemNameListLoop(void);
00137
00142 void ProcessItemNameListName(void);
00143
00148 void ProcessValueListItem(void);
00149
00154 void ProcessItemName(void);
00155
00160 void ProcessLoop(void);
00161
00166 void ProcessItemValue(void);
00167
00172 void ProcessLsItemValue(void);
00173
00178 void ProcessUnknownValue(void);
00179
00184 void ProcessMissingValue(void);
00185
00190 void ProcessSaveBegin(void);
00191
00196 void ProcessSaveEnd(void);
00197
00202 void ProcessDataBlockName(void);
00203
00204 private:
00205 DicFile *_fobj;
00206 ISTable *_tbl;
00207 int _afterLoop;
00208 CifFile *_saveobj;
00209 ISTable *_savetbl;
00210 ISTable *_prevtbl;
00211 ISTable * format;
00212 ISTable * cattbl;
00213 ISTable * itemtbl;
00214 CifFile *ddl;
00215 int itemColIndex;
00216 int catColIndex;
00217 int colIndex2;
00218 vector<string> listcat, listitem;
00219 vector<string> listitem2;
00220 int _nTablesInBlock;
00221 int _curItemNo, _curValueNo, _numDataBlocks, _fieldListAlloc, _curRow;
00222 vector<string> _fieldList;
00223 string _pBufValue;
00224 string _tBufKeyword;
00225 string _curCategoryName;
00226 string _curDataBlockName;
00227 string _prevDataBlockName;
00228 int _nTablesInBlockSave;
00229 int _curItemNoSave, _curValueNoSave;
00230 int _numDataBlocksSave, _fieldListAllocSave;
00231 int _curRowSave;
00232 vector<string> _fieldListSave;
00233 string _curCategoryNameSave;
00234 string _curDataBlockNameSave;
00235 string _prevDataBlockNameSave;
00236 string _tmpDataBlockNameSave;
00237 string errorLog;
00238 void ProcessLoopDeclaration(void);
00239 void ProcessItemNameList(void);
00240 void ProcessValueList(void);
00241 void ProcessItemValuePair(void);
00242 void ProcessLoopDeclarationSave(void);
00243 void ProcessItemNameListSave(void);
00244 void ProcessValueListSave(void);
00245 void ProcessItemValuePairSave(void);
00246 void CheckDDL(void);
00247
00248 void AfterParseProcessing();
00249
00250 void InsertImplicitOrdinalItems();
00251 };
00252
00253 #endif