Update of /cvsroot/cpptool/rfta/src/astdumper
In directory sc8-pr-cvs1:/tmp/cvs-serv10043/astdumper
Modified Files:
ASTDumper.h Main.cpp ASTDumper.cpp
Log Message:
-- integrated preprocessor (replaced all NonSemanticBlanker)
Index: ASTDumper.h
===================================================================
RCS file: /cvsroot/cpptool/rfta/src/astdumper/ASTDumper.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** ASTDumper.h 1 May 2003 09:08:09 -0000 1.3
--- ASTDumper.h 13 Jan 2004 22:27:35 -0000 1.4
***************
*** 28,31 ****
--- 28,32 ----
bool dump( const std::string &source,
+ const boost::filesystem::path &sourceDir,
const boost::filesystem::path &logDir,
const std::string &title );
***************
*** 33,36 ****
--- 34,38 ----
private:
bool writeAST( const std::string &source,
+ const boost::filesystem::path &sourcePath,
HTMLWriter &writer );
};
Index: Main.cpp
===================================================================
RCS file: /cvsroot/cpptool/rfta/src/astdumper/Main.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** Main.cpp 26 May 2003 21:13:52 -0000 1.5
--- Main.cpp 13 Jan 2004 22:27:35 -0000 1.6
***************
*** 49,54 ****
else
{
! try
! {
boost::filesystem::path path( argv[1],
boost::filesystem::native );
--- 49,54 ----
else
{
! //try
! {
boost::filesystem::path path( argv[1],
boost::filesystem::native );
***************
*** 59,65 ****
Refactoring::ASTDumper dumper;
! return dumper.dump( source, outputPath, path.string() ) ? 0 : 2;
}
! catch ( std::exception &e )
{
std::cerr << "Fatal error:\n"
--- 59,65 ----
Refactoring::ASTDumper dumper;
! return dumper.dump( source, path.branch_path(), outputPath, path.string() ) ? 0 : 2;
}
! /* catch ( std::exception &e )
{
std::cerr << "Fatal error:\n"
***************
*** 68,72 ****
<< e.what() << std::endl;
return 2;
! }
}
}
\ No newline at end of file
--- 68,72 ----
<< e.what() << std::endl;
return 2;
! }*/
}
}
\ No newline at end of file
Index: ASTDumper.cpp
===================================================================
RCS file: /cvsroot/cpptool/rfta/src/astdumper/ASTDumper.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** ASTDumper.cpp 20 Dec 2003 09:03:49 -0000 1.10
--- ASTDumper.cpp 13 Jan 2004 22:27:35 -0000 1.11
***************
*** 12,21 ****
#include <rfta/parser/ASTNodeVisitor.h>
#include <rfta/parser/MaxLODMutator.h>
! #include <rfta/parser/NonSemanticBlanker.h>
#include <rfta/parser/ParseContext.h>
#include <rfta/parser/ParserError.h>
#include <rfta/parser/SourceASTNode.h>
#include <rfta/parser/DeclarationListParser.h>
!
namespace Refactoring
--- 12,23 ----
#include <rfta/parser/ASTNodeVisitor.h>
#include <rfta/parser/MaxLODMutator.h>
! #include <rfta/parser/PreProcessor.h>
#include <rfta/parser/ParseContext.h>
#include <rfta/parser/ParserError.h>
#include <rfta/parser/SourceASTNode.h>
#include <rfta/parser/DeclarationListParser.h>
! #include <rfta/parser/FileSourceManager.h>
! #include <rfta/parser/Source.h>
! #include <rfta/parser/PlainTextDocument.h>
namespace Refactoring
***************
*** 90,94 ****
writer_.write( node->getType().getName() );
writer_.lineBreak();
! writer_.writePreformated( node->getOriginalText() );
}
--- 92,97 ----
writer_.write( node->getType().getName() );
writer_.lineBreak();
! //writer_.writePreformated( node->getOriginalText() );
! writer_.writePreformated( node->getBlankedText() );
}
***************
*** 135,138 ****
--- 138,142 ----
bool
ASTDumper::dump( const std::string &source,
+ const boost::filesystem::path &sourcePath,
const boost::filesystem::path &filePath,
const std::string &title )
***************
*** 156,160 ****
anchorTagger.end();
writer.writeH2( "Abstract syntax tree:" );
! bool succeed = writeAST( source, writer );
writer.writeFooter();
--- 160,164 ----
anchorTagger.end();
writer.writeH2( "Abstract syntax tree:" );
! bool succeed = writeAST( source, sourcePath, writer );
writer.writeFooter();
***************
*** 166,177 ****
bool
ASTDumper::writeAST( const std::string &source,
HTMLWriter &writer )
{
! PPDirectiveListenerPtr nullListener( new NullPPDirectiveListener() );
! std::string blankedSource;
! NonSemanticBlanker blanker( source, blankedSource, nullListener );
! blanker.blank();
! SourceASTNodePtr sourceAST = SourceASTNode::create( blankedSource, source );
ParseContext context( sourceAST );
DeclarationListParser parser( context,
--- 170,194 ----
bool
ASTDumper::writeAST( const std::string &source,
+ const boost::filesystem::path &sourcePath,
HTMLWriter &writer )
{
! FileSourceManager manager;
! manager.setRoot(sourcePath);
! manager.setInclude("C:\\Programme\\Microsoft Visual Studio\\VC98\\INCLUDE");
! SourcePtr sourceDoc = SourcePtr( new Source( TextDocumentPtr( new PlainTextDocument( source ) ) ) );
!
! PreProcessorContext ppcontext( manager );
! PreProcessor proc( sourceDoc, ppcontext );
! ppcontext.addMacro("__cplusplus","");
!
! // Not all system headers are handled correctly at the moment - so turn off include parsing:
! proc.setOption(PreProcessor::skipIncludes);
!
! printf("Preprocess file...\n");
! std::string blankedSource = proc.process();
! printf("finished...\n");
!
! SourceASTNodePtr sourceAST = SourceASTNode::create( blankedSource, source, sourceDoc );
ParseContext context( sourceAST );
DeclarationListParser parser( context,
***************
*** 180,183 ****
--- 197,201 ----
bool succeed = true;
+ printf("Parse...\n");
try
{
***************
*** 194,200 ****
--- 212,222 ----
succeed = false;
}
+
+ printf("finished...\n");
+ printf("Dump...\n");
ASTDumpVisitor visitor( writer, sourceAST );
visitor.visitNode( sourceAST );
+ printf("finished...\n");
return succeed;
}
|