From: <net...@us...> - 2004-01-13 22:30:09
|
Update of /cvsroot/cpptool/rfta/include/rfta/parser In directory sc8-pr-cvs1:/tmp/cvs-serv10795/include/rfta/parser Modified Files: PreProcessor.h Log Message: preprocessor implementation Index: PreProcessor.h =================================================================== RCS file: /cvsroot/cpptool/rfta/include/rfta/parser/PreProcessor.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** PreProcessor.h 16 Dec 2003 13:46:59 -0000 1.1 --- PreProcessor.h 13 Jan 2004 22:30:05 -0000 1.2 *************** *** 10,14 **** #include <rfta/parser/Config.h> ! #include "MacroReplaceListener.h" namespace Refactoring --- 10,15 ---- #include <rfta/parser/Config.h> ! #include "PreProcessorContext.h" ! #include <set> namespace Refactoring *************** *** 16,21 **** class RFTAPARSER_API PreProcessor { ! public: ! PreProcessor( const std::string &textToPreProcess); /** --- 17,22 ---- class RFTAPARSER_API PreProcessor { ! public: ! PreProcessor( const SourcePtr source, PreProcessorContext& context ); /** *************** *** 23,29 **** * whenever a replacement takes place the listener will be called. */ ! std::string process(MacroReplaceListener& listener); private: ! std::string toPreProcess_; }; } --- 24,83 ---- * whenever a replacement takes place the listener will be called. */ ! std::string process(); ! ! enum OptionType { ! skipIncludes ! }; ! ! /** ! * set pre processor options ! */ ! void setOption(OptionType); ! ! bool isOptionSet(OptionType); ! private: ! PreProcessorContext context_; ! ! std::string toPreProcess_; ! SourcePtr source_; ! ! typedef std::set<OptionType> OptionSet; ! OptionSet options_; ! ! static bool isEol( char c ); ! const char *deleteUntilEol( const char *current ); ! const char *deleteCComment( const char *current ); ! const char *blanksNewLine( const char *current ); ! const char *blanksString( const char *current, ! char endOfStringChar ); ! const char *blanksPreprocessorDirective( const char *current ); ! void blanksStringsAndPreprocessorDirectives( ); ! ! const char *parseDirective( const char *first,const char *last ); ! ! bool checkIfDef(const char * start, const char * end); ! const char * skipUntilElseEndIf(const char * start); ! ! const char *textStart_; ! const char *textEnd_; ! ! std::string blanked_; ! bool newLine_; ! const char* current_; ! int offset_diff; ! ! // hide copy constructor ! PreProcessor(const PreProcessor&); ! ! void addSpaceReplacement(const int start, const int len); ! void addTextDeletion(const int start, const int len); ! void addTextReplacement(const int start, const int len, std::string text); ! ! const char * handleDefine(const char *first, const char *last ); ! const char * handleInclude(const char *first, const char *last ); ! ! static bool checkNoneWhiteSpace(const std::string& text); ! }; } |