00001 //$$FILE$$ 00002 //$$VERSION$$ 00003 //$$DATE$$ 00004 //$$LICENSE$$ 00005 00006 00014 /* 00015 PURPOSE: DDL 2.1 compliant CIF file lexer ... 00016 */ 00017 00018 00019 #ifndef CIFSCANNERBASE_H 00020 #define CIFSCANNERBASE_H 00021 00022 00023 /* 00024 #if !defined(FLEX_LEXER_INCLUDED) 00025 #undef yyFlexLexer 00026 #define yyFlexLexer CifFlexLexer 00027 #include "FlexLexer.h" 00028 #endif 00029 */ 00030 00031 #include <string> 00032 00033 00034 #include <fstream> 00035 #include <stdio.h> 00036 #include <string.h> 00037 00038 #ifndef DEBUG 00039 #define DEBUG 0 00040 #endif 00041 00042 00048 class CifScanner // : public CifFlexLexer 00049 { 00050 protected: 00051 00052 std::string *_tBuf; 00053 int _isText; 00054 int _i, _j, _len; 00055 00056 protected: 00057 std::ofstream log; 00058 std::string errorLog; 00059 bool _verbose; 00060 void alt_yymore(void); 00061 void OpenLog(const std::string& logName, bool verboseLevel); 00062 00063 public: 00064 int NDBlineNo; 00065 CifScanner(std::istream *yyin); 00066 CifScanner(); 00067 int ProcessNone(); 00068 void ProcessWhiteSpace(); 00069 int ProcessData(); 00070 int ProcessLoopScanner(); 00071 void ProcessStop(); 00072 int ProcessDot(); 00073 int ProcessQuestion(); 00074 void ProcessComment(); 00075 int ProcessUnderscore(); 00076 int ProcessBadStrings(); 00077 int ProcessSQuotedStrings(); 00078 int ProcessDQuotedStrings(); 00079 int ProcessEof(); 00080 void Clear(); 00081 void Reset(); 00082 virtual int yylex(); 00083 virtual ~CifScanner() {Reset();}; 00084 }; 00085 00086 #endif /* CIFSCANNERBASE_H */