00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef DIC_PARSER_BASE_H
00010 #define DIC_PARSER_BASE_H
00011
00012 #include <iostream>
00013 #include <stdio.h>
00014 #include <stdlib.h>
00015 #include <string.h>
00016 #include "DICScannerBase.h"
00017 #include "DICParserInt.h"
00018 #include "CifFileReadDef.h"
00019 #include "ISTable.h"
00020 #include "TableFile.h"
00021
00022
00023 class DICParser:public DICScanner
00024 {
00025 private:
00026 string _uString;
00027 string _mString;
00028 TableFile *_fobj;
00029 ISTable *_tbl;
00030 int _afterLoop;
00031 TableFile *_saveobj;
00032 ISTable *_savetbl;
00033 ISTable *_prevtbl;
00034 ISTable * format;
00035 ISTable * cattbl;
00036 ISTable * itemtbl;
00037 TableFile *ddl;
00038 int itemColIndex;
00039 int catColIndex;
00040 int colIndex2;
00041 vector<string> listcat, listitem;
00042 vector<string> listitem2;
00043 int _nTablesInBlock;
00044 int _curItemNo, _curValueNo, _numDataBlocks, _fieldListAlloc, _curRow, _curCol;
00045 vector<string> _fieldList;
00046 string _pBufValue;
00047 vector<string> * _rowBuf;
00048 string _tBufKeyword;
00049 string _curCategoryName;
00050 string _curDataBlockName;
00051 string _prevDataBlockName;
00052 int _nTablesInBlockSave;
00053 int _curItemNoSave, _curValueNoSave;
00054 int _numDataBlocksSave, _fieldListAllocSave;
00055 int _curRowSave, _curColSave;
00056 vector<string> _fieldListSave;
00057 vector<string> * _rowBufSave;
00058 string _curCategoryNameSave;
00059 string _curDataBlockNameSave;
00060 string _prevDataBlockNameSave;
00061 string _tmpDataBlockNameSave;
00062 string _tmpDataBlockNameSaveL;
00063 void ProcessLoopDeclaration(void);
00064 void ProcessItemNameList(void);
00065 void ProcessValueList(void);
00066 void ProcessItemValuePair(void);
00067 void ProcessLoopDeclarationSave(void);
00068 void ProcessItemNameListSave(void);
00069 void ProcessValueListSave(void);
00070 void ProcessItemValuePairSave(void);
00071 void CheckDDL(void);
00072 public:
00073 DICParser(TableFile *fo, TableFile *ddl_in, ISTable *format2,
00074 int verbose);
00075 void Parse(const string& fileName, string& diagnostics);
00076 void Error(const char*);
00077 void Clear();
00078 void Reset();
00079 void ProcessAssignments(void);
00080 void ProcessOneAssignment(void);
00081 void ProcessItemNameListLoop(void);
00082 void ProcessItemNameListName(void);
00083 void ProcessValueListItem(void);
00084 void ProcessItemName(void);
00085 void ProcessLoop(void);
00086 void ProcessItemValue(void);
00087 void ProcessLsItemValue(void);
00088 void ProcessUnknownValue(void);
00089 void ProcessMissingValue(void);
00090 void ProcessSaveBegin(void);
00091 void ProcessSaveEnd(void);
00092 void ProcessDataBlockName(void);
00093 string errorLog;
00094 virtual ~DICParser();
00095 };
00096
00097 #endif