00001 //$$FILE$$ 00002 //$$VERSION$$ 00003 //$$DATE$$ 00004 //$$LICENSE$$ 00005 00006 00014 /* 00015 PURPOSE: A DDL 2.1 compliant CIF file parser. 00016 */ 00017 00018 00019 #ifndef DDL_PARSER_BASE_H 00020 #define DDL_PARSER_BASE_H 00021 00022 00023 #include <iostream> 00024 #include <stdio.h> 00025 #include <stdlib.h> 00026 #include <string.h> 00027 #include "DDLScannerBase.h" 00028 #include "DDLParserInt.h" 00029 #include "CifFileReadDef.h" 00030 #include "ISTable.h" 00031 #include "DdlFile.h" 00032 00033 00043 class DDLParser : public DDLScanner 00044 { 00045 public: 00063 DDLParser(DdlFile* ddlFileP, bool verbose = false); 00064 00082 void Parse(const string& fileName, string& diagnostics); 00083 00097 virtual ~DDLParser(); 00098 00103 void Clear(); 00104 00109 void Error(const char*); 00110 00115 void Reset(); 00116 00121 void ProcessLoopDeclaration(void); 00122 00127 void ProcessItemNameList(void); 00128 00133 void ProcessValueList(void); 00134 00139 void ProcessItemValuePair(void); 00140 00145 void ProcessLoopDeclarationSave(void); 00146 00151 void ProcessItemNameListSave(void); 00152 00157 void ProcessValueListSave(void); 00158 00163 void ProcessItemValuePairSave(void); 00164 00169 void ProcessAssignments(void); 00170 00175 void ProcessOneAssignment(void); 00176 00181 void ProcessItemNameListLoop(void); 00182 00187 void ProcessItemNameListName(void); 00188 00193 void ProcessValueListItem(void); 00194 00199 void ProcessItemName(void); 00200 00205 void ProcessLoop(void); 00206 00211 void ProcessItemValue(void); 00212 00217 void ProcessLsItemValue(void); 00218 00223 void ProcessUnknownValue(void); 00224 00229 void ProcessMissingValue(void); 00230 00235 void ProcessSaveBegin(void); 00236 00241 void ProcessSaveEnd(void); 00242 00247 void ProcessDataBlockName(void); 00248 00249 private: 00250 DdlFile *_fobj; 00251 ISTable *_tbl; 00252 int _afterLoop; 00253 DdlFile *_saveobj; 00254 ISTable *_savetbl; 00255 ISTable * format; 00256 int _nTablesInBlock; 00257 int _curItemNo, _curValueNo, _numDataBlocks, _fieldListAlloc, _curRow; 00258 vector<string> _fieldList; 00259 string _pBufValue; 00260 string _tBufKeyword; 00261 string _curCategoryName; 00262 string _curDataBlockName; 00263 string _prevDataBlockName; 00264 int _nTablesInBlockSave; 00265 int _curItemNoSave, _curValueNoSave; 00266 int _numDataBlocksSave, _fieldListAllocSave; 00267 int _curRowSave; 00268 vector<string> _fieldListSave; 00269 string _curCategoryNameSave; 00270 string _curDataBlockNameSave; 00271 string _prevDataBlockNameSave; 00272 string errorLog; 00273 00274 }; 00275 00276 #endif /* DDL_PARSER_BASE_H */