You can subscribe to this list here.
| 2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(37) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2003 |
Jan
(15) |
Feb
(26) |
Mar
(97) |
Apr
(224) |
May
(226) |
Jun
|
Jul
(3) |
Aug
(22) |
Sep
(48) |
Oct
|
Nov
|
Dec
(38) |
| 2004 |
Jan
(28) |
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
(37) |
Jul
|
Aug
(73) |
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <net...@us...> - 2003-12-19 20:12:08
|
Update of /cvsroot/cpptool/rfta/src/rfta
In directory sc8-pr-cvs1:/tmp/cvs-serv28412/rfta/src/rfta
Modified Files:
CodeWriterTestBase.cpp
Log Message:
-- interface change
Index: CodeWriterTestBase.cpp
===================================================================
RCS file: /cvsroot/cpptool/rfta/src/rfta/CodeWriterTestBase.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** CodeWriterTestBase.cpp 26 May 2003 21:12:33 -0000 1.9
--- CodeWriterTestBase.cpp 19 Dec 2003 20:12:05 -0000 1.10
***************
*** 49,53 ****
{
writer_.reset( new CodeModel::CodeRewriter( source_, 2 ) );
! writer_->rewrite( compound_, *document_ );
}
--- 49,53 ----
{
writer_.reset( new CodeModel::CodeRewriter( source_, 2 ) );
! writer_->rewrite( compound_, TransformList(), *document_ );
}
|
|
From: <net...@us...> - 2003-12-19 20:11:40
|
Update of /cvsroot/cpptool/rfta/src/rfta
In directory sc8-pr-cvs1:/tmp/cvs-serv28289/rfta/src/rfta
Modified Files:
CodeRewriter.cpp CodeRewriter.h
Log Message:
-- inform code rewriter about preprocessing transformations
-- OPEN: check conflics
Index: CodeRewriter.cpp
===================================================================
RCS file: /cvsroot/cpptool/rfta/src/rfta/CodeRewriter.cpp,v
retrieving revision 1.45
retrieving revision 1.46
diff -C2 -d -r1.45 -r1.46
*** CodeRewriter.cpp 29 Apr 2003 07:01:43 -0000 1.45
--- CodeRewriter.cpp 19 Dec 2003 20:11:36 -0000 1.46
***************
*** 33,40 ****
void
CodeRewriter::rewrite( const StatementPtr &statement,
TextDocument &document )
{
statement->accept( *this );
!
transforms_.apply( document );
}
--- 33,42 ----
void
CodeRewriter::rewrite( const StatementPtr &statement,
+ TransformList& preprocesstransforms,
TextDocument &document )
{
statement->accept( *this );
! // @TODO(Andre): Check conflics between statement transforms and preprocessing...
! transforms_.add(preprocesstransforms);
transforms_.apply( document );
}
Index: CodeRewriter.h
===================================================================
RCS file: /cvsroot/cpptool/rfta/src/rfta/CodeRewriter.h,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -d -r1.20 -r1.21
*** CodeRewriter.h 24 Apr 2003 16:28:30 -0000 1.20
--- CodeRewriter.h 19 Dec 2003 20:11:37 -0000 1.21
***************
*** 31,34 ****
--- 31,35 ----
void rewrite( const StatementPtr &statement,
+ TransformList& preprocesstransforms,
TextDocument &document );
|
|
From: <net...@us...> - 2003-12-19 20:08:26
|
Update of /cvsroot/cpptool/rfta/src/rfta
In directory sc8-pr-cvs1:/tmp/cvs-serv27650/rfta/src/rfta
Modified Files:
CodeModelGenerator.cpp
Log Message:
-- fix for preprocessed code where the code offsets differ
Index: CodeModelGenerator.cpp
===================================================================
RCS file: /cvsroot/cpptool/rfta/src/rfta/CodeModelGenerator.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** CodeModelGenerator.cpp 28 May 2003 07:32:48 -0000 1.1
--- CodeModelGenerator.cpp 19 Dec 2003 20:08:21 -0000 1.2
***************
*** 29,33 ****
std::string getSourceText() const
{
! return node_->getOriginalText();
}
--- 29,33 ----
std::string getSourceText() const
{
! return /*node_->getOriginalText()*/node_->getBlankedText();
}
|
|
From: <net...@us...> - 2003-12-16 13:47:03
|
Update of /cvsroot/cpptool/rfta/src/rftaparser
In directory sc8-pr-cvs1:/tmp/cvs-serv28898/src/rftaparser
Added Files:
MacroReplaceRegistration.cpp PreProcessor.cpp
PreProcessorError.cpp PreProcessorTest.cpp PreProcessorTest.h
PreProcessResolver.cpp PreProcessResolver.h
PreProcessResolverTest.cpp PreProcessResolverTest.h
Log Message:
-- files of a preprocessor implementation
--- NEW FILE: MacroReplaceRegistration.cpp ---
// //////////////////////////////////////////////////////////////////////////
// Source file MacroReplaceRegistration.cpp for class MacroReplaceRegistration
// (c)Copyright 2003, Andre Baresel
// Created: 2003/12/14
// //////////////////////////////////////////////////////////////////////////
#pragma warning( disable: 4786 )
#include <rfta/parser/MacroReplaceRegistration.h>
#include <utility>
namespace Refactoring {
void
MacroReplaceRegistration::macroReplacement( const SourceRange position,
const std::string ¯o,
const std::string &replacement )
{
MacroReplacement entry;
entry.position_ = position;
entry.macroText_ = macro;
entry.replacement_ = replacement;
macroReplacements_.push_back(entry);
}
/**
* @return number of entries in registration
*/
int
MacroReplaceRegistration::getSize() const
{
return macroReplacements_.size();
}
/**
* @return an entry of the registered replacements
* @throw std::invalid_argument if index >= size.
*/
MacroReplaceRegistration::MacroReplacement
MacroReplaceRegistration::getEntry(unsigned int index) const
{
if (index >= getSize())
throw std::invalid_argument("Index out of bound within [MacroReplaceRegistration::getEntry].");
return macroReplacements_[index];
}
struct MacroReplaceRegistration::SortPredicate
{
bool operator()( const MacroReplacement &x,
const MacroReplacement &y ) const
{
return x.position_.getStartIndex() < y.position_.getStartIndex();
}
};
/**
* does prepare the data after all replacements have been done.
*/
void
MacroReplaceRegistration::finishUpData()
{
std::stable_sort( macroReplacements_.begin(), macroReplacements_.end(), SortPredicate() );
}
/**
* @return the text delta of all macro replacements before 'position')
*/
int
MacroReplaceRegistration::getReplacementDeltaBefore(SourceRange position)
{
MacroReplacement elem;
elem.position_ = position;
MacroReplacementList::iterator pos =
std::lower_bound(macroReplacements_.begin(), macroReplacements_.end(), elem );
int sum = 0;
MacroReplacementList::iterator i = macroReplacements_.begin();
while (i != pos)
{
const MacroReplacement & val = (*i);
sum+= val.macroText_.size() - val.replacement_.size();
i++;
}
return sum;
}
bool operator<(const MacroReplaceRegistration::MacroReplacement &x,const MacroReplaceRegistration::MacroReplacement &y )
{
return x.position_.getStartIndex() < y.position_.getStartIndex();
}
} // namespace
--- NEW FILE: PreProcessor.cpp ---
// //////////////////////////////////////////////////////////////////////////
// Source file PreProcessor.h for class PreProcessor
// (c)Copyright 2003, Andre Baresel
// Created: 2003/12/13
// //////////////////////////////////////////////////////////////////////////
#include <string>
#include <rfta/parser/PreProcessor.h>
#include <xtl/Type.h>
#include <xtl/CStringView.h>
#include <rfta/parser/SourceRange.h>
#include <rfta/parser/ParserTools.h>
#include "PreProcessResolver.h"
#include <rfta/parser/NonSemanticBlanker.h>
namespace Refactoring
{
PreProcessor::PreProcessor( const std::string &textToPreProcess):
toPreProcess_(textToPreProcess)
{
}
/**
* does tokenize the string, skipping strings and symbols.
* only identifiers will be checked for macro identifiers.
*
*/
std::string
PreProcessor::process(MacroReplaceListener& listener)
{
std::string preprocessed;
std::string blanked(toPreProcess_);
// first blank the source code
PreProcessResolverPtr pResolver(new PreProcessResolver());
NonSemanticBlanker blanker(toPreProcess_, blanked, pResolver);
blanker.blank();
// now do the preprocessing
const char * start = blanked.c_str();
const char * end = start + blanked.length();
bool foundIdentifier;
const char * current = start;
do
{
const char * lastpos = current;
int identlen = 0;
foundIdentifier = false;
while (current != end && !ParserTools::isIdentifierLetter(*current))
{
current++;
}
if (current != end && ParserTools::isValidIdentifierFirstLetter(*current))
{
foundIdentifier = true;
while (current+identlen != end && ParserTools::isIdentifierLetter(*(current+identlen)))
identlen++;
}
else
// this is a number - skip:
while (current != end && ParserTools::isIdentifierLetter(*current))
current++;
if (foundIdentifier)
{
// copy the skipped characters:
preprocessed += std::string( lastpos,current-lastpos);
// do the replacement:
std::string ident(current,identlen);
if (pResolver->isMacroIdentifier(ident))
{
// replace
std::string replacement = pResolver->getMacroReplacement(ident);
preprocessed += replacement;
// register macro replacement
SourceRange position(current-start,identlen);
listener.macroReplacement(position,ident,replacement);
} else
// keep it, this is no macro
preprocessed += ident;
current+=identlen;
} else
{
// copy the last characters:
preprocessed += std::string( lastpos,(end-lastpos));
}
} while (current != end);
return preprocessed;
}
} // namespace Refactoring
--- NEW FILE: PreProcessorError.cpp ---
// //////////////////////////////////////////////////////////////////////////
// Source file PreProcessorError.h for class PreProcessorError
// (c)Copyright 2003, Andre Baresel.
// Created: 2003/12/14
// //////////////////////////////////////////////////////////////////////////
#include <rfta/parser/PreProcessorError.h>
#include <string>
namespace Refactoring
{
/// Exception thrown when an error occurs during preprocessing.
PreProcessorError::PreProcessorError( const std::string &message )
: message_(message)
, what_(message)
, std::runtime_error( std::string("Preprocessing failure: ") + message )
{
}
/// Destructor.
PreProcessorError::~PreProcessorError() throw()
{
}
const char *
PreProcessorError::what() const throw()
{
return what_.c_str();
}
} // namespace Refactoring
--- NEW FILE: PreProcessorTest.cpp ---
// //////////////////////////////////////////////////////////////////////////
// Header file PreProcessorTest.h for class PreProcessorTest
// (c)Copyright 2003, Andre Baresel
// Created: 2003/12/13
// //////////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "PreProcessorTest.h"
#include <rfta/parser/PreProcessor.h>
#include <rfta/parser/MacroReplaceRegistration.h>
namespace Refactoring
{
RFTAPARSER_TEST_SUITE_REGISTRATION( PreProcessorTest );
PreProcessorTest::PreProcessorTest()
{
}
PreProcessorTest::~PreProcessorTest()
{
}
void
PreProcessorTest::setUp()
{
}
void
PreProcessorTest::tearDown()
{
}
void
PreProcessorTest::testSimpleReplace()
{
std::string source = "#define TEXT \"String\"\n\
char * var = TEXT;\n\
";
std::string expected= " \
char * var = \"String\"; ";
// do the preprocessing (use directive information)
std::string preprocessed;
PreProcessor proc(source);
MacroReplaceRegistration registration;
preprocessed = proc.process(registration);
CPPUNIT_ASSERT_EQUAL(expected, preprocessed);
CPPUNIT_ASSERT_EQUAL_MESSAGE("Expected size of Macro-Replacement-Registration is wrong.",
1, registration.getSize());
MacroReplaceRegistration::MacroReplacement entry = registration.getEntry(0);
CPPUNIT_ASSERT_EQUAL(SourceRange(43,4),entry.position_);
}
} // namespace Refactoring
--- NEW FILE: PreProcessorTest.h ---
// //////////////////////////////////////////////////////////////////////////
// Header file PreProcessorTest.h for class PreProcessorTest
// (c)Copyright 2003, Andre Baresel
// Created: 2003/12/13
// //////////////////////////////////////////////////////////////////////////
#ifndef RFTA_PREPROCESSORTEST_H
#define RFTA_PREPROCESSORTEST_H
#include "ParserTesting.h"
namespace Refactoring
{
/// Unit tests for PreProcessor
class PreProcessorTest : public CppUnit::TestFixture
{
CPPUNIT_TEST_SUITE( PreProcessorTest );
CPPUNIT_TEST( testSimpleReplace );
CPPUNIT_TEST_SUITE_END();
public:
/*! Constructs a PreProcessorTest object.
*/
PreProcessorTest();
/// Destructor.
virtual ~PreProcessorTest();
void setUp();
void tearDown();
void testSimpleReplace();
private:
/// Prevents the use of the copy constructor.
PreProcessorTest( const PreProcessorTest &other );
/// Prevents the use of the copy operator.
void operator =( const PreProcessorTest &other );
private:
};
// Inlines methods for PreProcessorTest:
// ----------------------------------------
} // namespace Refactoring
#endif // RFTA_PREPROCESSORTEST_H
--- NEW FILE: PreProcessResolver.cpp ---
// //////////////////////////////////////////////////////////////////////////
// Source file PreProcessResolver.h for class PreProcessResolver
// (c)Copyright 2003, Andre Baresel
// Created: 2003/12/13
// //////////////////////////////////////////////////////////////////////////
#include "PreProcessResolver.h"
#include <rfta/parser/PreProcessorError.h>
#include <xtl/Type.h>
#include <xtl/CStringView.h>
#include <rfta/parser/ParserTools.h>
namespace Refactoring
{
PreProcessResolver::PreProcessResolver()
{
}
void
PreProcessResolver::parseDirective( const char *first,const char *last )
{
Xtl::CStringEnumerator en( Xtl::CStringView( first, last ) );
en.setCurrent( first );
if (strncmp(first,"#define ",8)==0)
{
// skip define keyword and spaces
first+=8;en.setCurrent( first );
ParserTools::skipSpaces(en);
Xtl::CStringView identifier;
ParserTools::tryReadIdentifier( en, identifier );
// do not understand this...
if (identifier.getLength() == 0)
ThrowPreProcessError("Do not understand syntax of this '#define' directive.");
ParserTools::skipSpaces(en);
// macro text is all but not the newline character...
addMacro(identifier.str() , std::string( en.getCurrentPos(), last-1-en.getCurrentPos()));
}
}
bool
PreProcessResolver::isMacroIdentifier( std::string identifier )
{
MacroDefMap::iterator i = macroDef_.find(identifier);
return i != macroDef_.end();
}
std::string
PreProcessResolver::getMacroReplacement( std::string macroident )
{
MacroDefMap::iterator i = macroDef_.find(macroident);
if (i == macroDef_.end())
ThrowPreProcessError(std::string("Macro '")+macroident+"'is not defined.");
return i->second;
}
void
PreProcessResolver::addMacro(std::string ident, std::string replacement)
{
macroDef_[ident] = replacement;
}
} // namespace Refactoring
--- NEW FILE: PreProcessResolver.h ---
// //////////////////////////////////////////////////////////////////////////
// Header file PreProcessResolver.h for class PreProcessResolver
// (c)Copyright 2003, Andre Baresel
// Created: 2003/12/13
// //////////////////////////////////////////////////////////////////////////
#pragma warning(disable: 4786)
#include <string>
#include <map>
#ifndef REFACTORING_PREPROCESSRESOLVER_H_INCLUDED
#define REFACTORING_PREPROCESSRESOLVER_H_INCLUDED
#include <rfta/parser/PPDirectiveListener.h>
namespace Refactoring
{
class PreProcessResolver;
typedef boost::shared_ptr<PreProcessResolver> PreProcessResolverPtr;
class PreProcessResolver: public PPDirectiveListener
{
public:
PreProcessResolver();
virtual void parseDirective( const char *first,
const char *last );
/**
* test for identifier in macro list.
*/
bool isMacroIdentifier( std::string identifier );
/**
* returns the replacement text for macro identifier
* @throw PreProcessorError if macro identifier is not defined.
*/
std::string getMacroReplacement( std::string macroident );
/**
* inserts a none parameterized macro replacement entry
*/
void addMacro(std::string ident, std::string replacement);
private:
typedef std::map< std::string , std::string > MacroDefMap;
/// storage for directives
/// 1. include information
/// 2. macro definitions
MacroDefMap macroDef_;
};
}
#endif // REFACTORING_PREPROCESSRESOLVER_H_INCLUDED
--- NEW FILE: PreProcessResolverTest.cpp ---
// //////////////////////////////////////////////////////////////////////////
// Header file PreProcessResolveTest.h for class PreProcessResolveTest
// (c)Copyright 2003, Andre Baresel
// Created: 2003/12/13
// //////////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "PreProcessResolverTest.h"
#include "PreProcessResolver.h"
namespace Refactoring
{
RFTAPARSER_TEST_SUITE_REGISTRATION( PreProcessResolveTest );
PreProcessResolveTest::PreProcessResolveTest()
{
}
PreProcessResolveTest::~PreProcessResolveTest()
{
}
void
PreProcessResolveTest::setUp()
{
}
void
PreProcessResolveTest::tearDown()
{
}
void
PreProcessResolveTest::testMacroRegister()
{
PreProcessResolver resolver;
std::string source( "#define MY \"this text\"\n");
resolver.parseDirective(source.c_str(),source.c_str()+source.size());
CPPUNIT_ASSERT( resolver.isMacroIdentifier("MY") );
CPPUNIT_ASSERT_EQUAL( resolver.getMacroReplacement("MY") , std::string("\"this text\"") );
}
void
PreProcessResolveTest::testIncludeRegister()
{
}
} // namespace Refactoring
--- NEW FILE: PreProcessResolverTest.h ---
// //////////////////////////////////////////////////////////////////////////
// Header file PreProcessResolveTest.h for class PreProcessResolveTest
// (c)Copyright 2003, Andre Baresel
// Created: 2003/12/13
// //////////////////////////////////////////////////////////////////////////
#ifndef RFTA_PREPROCESSRESOLVETEST_H
#define RFTA_PREPROCESSRESOLVETEST_H
#include "ParserTesting.h"
namespace Refactoring
{
/// Unit tests for PreProcessor
class PreProcessResolveTest : public CppUnit::TestFixture
{
CPPUNIT_TEST_SUITE( PreProcessResolveTest );
CPPUNIT_TEST( testMacroRegister );
CPPUNIT_TEST( testIncludeRegister );
CPPUNIT_TEST_SUITE_END();
public:
/*! Constructs a PreProcessResolveTest object.
*/
PreProcessResolveTest();
/// Destructor.
virtual ~PreProcessResolveTest();
void setUp();
void tearDown();
void testMacroRegister();
void testIncludeRegister();
private:
/// Prevents the use of the copy constructor.
PreProcessResolveTest( const PreProcessResolveTest &other );
/// Prevents the use of the copy operator.
void operator =( const PreProcessResolveTest &other );
private:
};
// Inlines methods for PreProcessResolveTest:
// ----------------------------------------
} // namespace Refactoring
#endif // RFTA_PREPROCESSRESOLVETEST_H
|
|
From: <net...@us...> - 2003-12-16 13:47:03
|
Update of /cvsroot/cpptool/rfta/src/rfta
In directory sc8-pr-cvs1:/tmp/cvs-serv28898/src/rfta
Added Files:
PreProcessTransform.cpp PreProcessTransform.h Transform.h
Log Message:
-- files of a preprocessor implementation
--- NEW FILE: PreProcessTransform.cpp ---
// //////////////////////////////////////////////////////////////////////////
// Implementation file PreProcessTransform.cpp for class PreProcessTransform
// (c)Copyright 2003, Andre Baresel.
// Created: 2003/12/14
// //////////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "PreProcessTransform.h"
#include <rfta/refactoring/TextDocument.h>
namespace Refactoring
{
PreProcessTransform::PreProcessTransform( const SourceRange &replaceRange, const int& lengthDelta )
: range_( replaceRange ),
lengthDelta_( lengthDelta )
{
}
PreProcessTransform::~PreProcessTransform()
{
}
int
PreProcessTransform::apply( TextDocument &document ) const
{
/** nothing to do here - keep the original text **/
return lengthDelta_;
}
void
PreProcessTransform::moveStartIndexBy( int delta )
{
range_.moveStartIndexBy( delta );
}
int
PreProcessTransform::getStartIndex()
{
return range_.getStartIndex();
}
} // namespace Refactoring
--- NEW FILE: PreProcessTransform.h ---
// //////////////////////////////////////////////////////////////////////////
// Header file PreProcessTransform.h for class PreProcessTransform
// (c)Copyright 2003, Andre Baresel.
// Created: 2003/12/14
// //////////////////////////////////////////////////////////////////////////
#ifndef RFTA_PREPROCESSTRANSFORM_H
#define RFTA_PREPROCESSTRANSFORM_H
#include <rfta/refactoring/Config.h>
#include <rfta/parser/SourceRange.h>
#include <string>
#include "Transform.h"
namespace Refactoring
{
class TextDocument;
/**
* Stores a macro replace transformation done by preprocessor.
* This is used for backtransformation of text positions in original code
*/
class PreProcessTransform: public Transform
{
public:
/*! Constructs a PreProcessTransform object.
* @para replaceRange is the position and length of the macro-use,
* @para lengthDelta is the length inserted text for the macro.
*/
PreProcessTransform( const SourceRange &replaceRange, const int &lengthDelta );
/// Destructor.
virtual ~PreProcessTransform();
/**
* does the text transformation and returns the delta-length
*/
int apply( TextDocument &document ) const;
void moveStartIndexBy( int delta );
int getStartIndex();
int getLength();
private:
SourceRange range_;
int lengthDelta_;
};
// Inlines methods for PreProcessTransform:
// -----------------------------------------
inline int
PreProcessTransform::getLength()
{
return range_.getLength();
}
} // namespace Refactoring
#endif // RFTA_PREPROCESSTRANSFORM_H
--- NEW FILE: Transform.h ---
// //////////////////////////////////////////////////////////////////////////
// Header file Transform.h for class Transform
// (c)Copyright 2003, Andre Baresel.
// Created: 2003/12/14
// //////////////////////////////////////////////////////////////////////////
#ifndef RFTA_TRANSFORM_H
#define RFTA_TRANSFORM_H
#include <rfta/refactoring/Config.h>
namespace Refactoring
{
class TextDocument;
/**
* Stores a macro replace transformation done by preprocessor.
* This is used for backtransformation of text positions in original code
*/
class Transform
{
public:
/// Destructor.
virtual ~Transform() { }
/**
* does the text transformation and returns the delta-length
*/
virtual int apply( TextDocument &document ) const = 0;
virtual void moveStartIndexBy( int delta ) = 0;
virtual int getStartIndex() = 0;
virtual int getLength() = 0;
};
// Inlines methods for Transform:
// -----------------------------------------
} // namespace Refactoring
#endif // RFTA_TRANSFORM_H
|
Update of /cvsroot/cpptool/rfta/include/rfta/parser
In directory sc8-pr-cvs1:/tmp/cvs-serv28898/include/rfta/parser
Added Files:
MacroReplaceListener.h MacroReplaceRegistration.h
PPDirectiveListener.h PreProcessor.h PreProcessorError.h
Log Message:
-- files of a preprocessor implementation
--- NEW FILE: MacroReplaceListener.h ---
// //////////////////////////////////////////////////////////////////////////
// Header file PPDirectiveListener.h for class PPDirectiveListener
// (c)Copyright 2003, Andre Baresel
// Created: 2003/12/13
// //////////////////////////////////////////////////////////////////////////
#include <string>
#include <boost/shared_ptr.hpp>
#include <rfta/parser/Config.h>
#include <rfta/parser/SourceRange.h>
#ifndef REFACTORING_MACROREPLACELISTENER_H_INCLUDED
#define REFACTORING_MACROREPLACELISTENER_H_INCLUDED
namespace Refactoring
{
class RFTAPARSER_API MacroReplaceListener;
typedef boost::shared_ptr<MacroReplaceListener> MacroReplaceListenerPtr;
class RFTAPARSER_API MacroReplaceListener
{
public:
/**
* is called whenever a replacement actions takes place
*/
virtual void macroReplacement( const SourceRange position,
const std::string ¯o,
const std::string &replacement ) =0;
};
class NullMacroReplaceListener: public MacroReplaceListener
{
public:
/**
* is called whenever a replacement actions takes place
*/
virtual void macroReplacement( const SourceRange position,
const std::string ¯o,
const std::string &replacement )
{
}
};
}
#endif // REFACTORING_MACROREPLACELISTENER_H_INCLUDED
--- NEW FILE: MacroReplaceRegistration.h ---
// //////////////////////////////////////////////////////////////////////////
// Header file MacroReplaceRegistration.h for class MacroReplaceRegistration
// (c)Copyright 2003, Andre Baresel
// Created: 2003/12/13
// //////////////////////////////////////////////////////////////////////////
#include <string>
#include <vector>
#include <boost/shared_ptr.hpp>
#include <rfta/parser/Config.h>
#include <rfta/parser/SourceRange.h>
#include "MacroReplaceListener.h"
#ifndef REFACTORING_MACROREPLACEREGISTRATION_H_INCLUDED
#define REFACTORING_MACROREPLACEREGISTRATION_H_INCLUDED
namespace Refactoring
{
class RFTAPARSER_API MacroReplaceRegistration: public MacroReplaceListener
{
public:
struct MacroReplacement;
/**
* is called whenever a replacement actions takes place
*/
virtual void macroReplacement( const SourceRange position,
const std::string ¯o,
const std::string &replacement );
/**
* @return number of entries in registration
*/
int getSize() const;
/**
* @return an entry of the registered replacements
* @throw std::invalid_argument if index >= size.
*/
MacroReplacement getEntry(unsigned int index) const;
/**
* does prepare the data after all replacements have been done.
*/
void finishUpData();
/**
* @return the text delta of all macro replacements before 'position')
*/
int getReplacementDeltaBefore(SourceRange position);
struct SortPredicate;
struct MacroReplacement {
SourceRange position_;
std::string macroText_;
std::string replacement_;
};
typedef boost::shared_ptr<MacroReplacement> MacroReplacementPtr;
private:
typedef std::vector<MacroReplacement> MacroReplacementList;
MacroReplacementList macroReplacements_;
};
}
#endif // REFACTORING_MACROREPLACEREGISTRATION_H_INCLUDED
--- NEW FILE: PPDirectiveListener.h ---
// //////////////////////////////////////////////////////////////////////////
// Header file PPDirectiveListener.h for class PPDirectiveListener
// (c)Copyright 2003, Andre Baresel
// Created: 2003/12/13
// //////////////////////////////////////////////////////////////////////////
#include <string>
#include <boost/shared_ptr.hpp>
#include <rfta/parser/Config.h>
#ifndef REFACTORING_PPDIRECTIVELISTENER_H_INCLUDED
#define REFACTORING_PPDIRECTIVELISTENER_H_INCLUDED
namespace Refactoring
{
class RFTAPARSER_API PPDirectiveListener;
typedef boost::shared_ptr<PPDirectiveListener> PPDirectiveListenerPtr;
class RFTAPARSER_API PPDirectiveListener
{
public:
virtual void parseDirective( const char *first,
const char *last ) =0;
};
class RFTAPARSER_API NullPPDirectiveListener : public PPDirectiveListener
{
public:
void parseDirective( const char *first,
const char *last )
{
}
};
}
#endif // REFACTORING_PPDIRECTIVELISTENER_H_INCLUDED
--- NEW FILE: PreProcessor.h ---
// //////////////////////////////////////////////////////////////////////////
// Header file PreProcessor.h for class PreProcessor
// (c)Copyright 2003, Andre Baresel
// Created: 2003/12/13
// //////////////////////////////////////////////////////////////////////////
#include <string>
#ifndef REFACTORING_PREPROCESSOR_H_INCLUDED
#define REFACTORING_PREPROCESSOR_H_INCLUDED
#include <rfta/parser/Config.h>
#include "MacroReplaceListener.h"
namespace Refactoring
{
class RFTAPARSER_API PreProcessor
{
public:
PreProcessor( const std::string &textToPreProcess);
/**
* @return preprocessed source, data of 'ppDirectiveParser' is used for preprocessing
* whenever a replacement takes place the listener will be called.
*/
std::string process(MacroReplaceListener& listener);
private:
std::string toPreProcess_;
};
}
#endif // REFACTORING_PREPROCESSOR_H_INCLUDED
--- NEW FILE: PreProcessorError.h ---
// //////////////////////////////////////////////////////////////////////////
// Header file PreProcessorError.h for class PreProcessorError
// (c)Copyright 2003, Andre Baresel.
// Created: 2003/12/14
// //////////////////////////////////////////////////////////////////////////
#ifndef RFTA_PREPROCESSORERROR_H
#define RFTA_PREPROCESSORERROR_H
#include <stdexcept>
#include <rfta/parser/Config.h>
namespace Refactoring
{
/// Exception thrown when an error occurs during preprocessing.
class RFTAPARSER_API PreProcessorError : public std::runtime_error
{
public:
PreProcessorError( const std::string &message );
/// Destructor.
virtual ~PreProcessorError() throw();
const char *what() const throw();
private:
std::string message_;
mutable std::string what_;
};
// Inlines methods for PreProcessorError:
// --------------------------------
} // namespace Refactoring
#define DO_STRINGIZE(s) #s
#define ThrowPreProcessError(text) \
throw PreProcessorError( std::string(__FILE__ ":" ) + std::string(text) );
#endif // RFTA_PREPROCESSORERROR_H
|
|
From: <net...@us...> - 2003-12-16 13:44:21
|
Update of /cvsroot/cpptool/rfta/src/rfta
In directory sc8-pr-cvs1:/tmp/cvs-serv28320/rfta/src/rfta
Modified Files:
TransformList.cpp TransformList.h
Log Message:
-- interface extension: overlap check
Index: TransformList.cpp
===================================================================
RCS file: /cvsroot/cpptool/rfta/src/rfta/TransformList.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** TransformList.cpp 22 Dec 2002 16:03:53 -0000 1.4
--- TransformList.cpp 16 Dec 2003 13:44:18 -0000 1.5
***************
*** 28,32 ****
void
! TransformList::add( ReplaceTextTransform &transform )
{
transforms_.push_back( TransformPtr(&transform) );
--- 28,32 ----
void
! TransformList::add( Transform &transform )
{
transforms_.push_back( TransformPtr(&transform) );
***************
*** 65,68 ****
--- 65,85 ----
{
std::stable_sort( transforms_.begin(), transforms_.end(), SortPredicate() );
+ }
+
+ /**
+ * !! Attention !! Function does only work if 'sortListByStartIndex' was called first !
+ */
+ bool
+ TransformList::hasOverlapping( const SourceRange& range)
+ {
+ Transforms::iterator it = transforms_.begin();
+ while(it != transforms_.end() && (*it)->getStartIndex()<= range.getStartIndex())
+ {
+ const TransformPtr transform = *it;
+ if (range.overlap(SourceRange(transform->getStartIndex(),transform->getLength() ) ) )
+ return true;
+ it++;
+ }
+ return false;
}
Index: TransformList.h
===================================================================
RCS file: /cvsroot/cpptool/rfta/src/rfta/TransformList.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** TransformList.h 26 Oct 2002 18:15:52 -0000 1.1
--- TransformList.h 16 Dec 2003 13:44:18 -0000 1.2
***************
*** 10,13 ****
--- 10,14 ----
#include <deque>
#include <boost/shared_ptr.hpp>
+ #include <rfta/parser/SourceRange.h>
***************
*** 15,19 ****
{
! class ReplaceTextTransform;
class TextDocument;
--- 16,20 ----
{
! class Transform;
class TextDocument;
***************
*** 30,34 ****
virtual ~TransformList();
! void add( ReplaceTextTransform &transform );
void apply( TextDocument &document );
--- 31,44 ----
virtual ~TransformList();
! void add( Transform &transform );
!
! /**
! * does check existing transformations for overlapping with given range.
! *
! * Attention: Function does only work if 'sortListByStartIndex' was called first !
! *
! * @param 'range' source range to be checked for overlapping
! */
! bool hasOverlapping( const SourceRange& range);
void apply( TextDocument &document );
***************
*** 46,50 ****
private:
! typedef boost::shared_ptr<ReplaceTextTransform> TransformPtr;
typedef std::deque<TransformPtr> Transforms;
Transforms transforms_;
--- 56,60 ----
private:
! typedef boost::shared_ptr<Transform> TransformPtr;
typedef std::deque<TransformPtr> Transforms;
Transforms transforms_;
|
|
From: <net...@us...> - 2003-12-16 13:43:37
|
Update of /cvsroot/cpptool/rfta/src/rfta
In directory sc8-pr-cvs1:/tmp/cvs-serv28151/rfta/src/rfta
Modified Files:
SplitDeclarationRefactoring.cpp SplitTempRefactoring.cpp
Log Message:
-- small interface change for blanker
Index: SplitDeclarationRefactoring.cpp
===================================================================
RCS file: /cvsroot/cpptool/rfta/src/rfta/SplitDeclarationRefactoring.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** SplitDeclarationRefactoring.cpp 26 May 2003 21:12:33 -0000 1.3
--- SplitDeclarationRefactoring.cpp 16 Dec 2003 13:43:34 -0000 1.4
***************
*** 27,31 ****
#include "CodeRewriter.h"
-
namespace Refactoring
{
--- 27,30 ----
***************
*** 54,58 ****
throw RefactoringError( RefactoringError::selectionNotInSource );
! NullPPDirectiveListener nullListener;
std::string blankedSource;
NonSemanticBlanker blanker( source, blankedSource, nullListener );
--- 53,57 ----
throw RefactoringError( RefactoringError::selectionNotInSource );
! PPDirectiveListenerPtr nullListener(new NullPPDirectiveListener());
std::string blankedSource;
NonSemanticBlanker blanker( source, blankedSource, nullListener );
Index: SplitTempRefactoring.cpp
===================================================================
RCS file: /cvsroot/cpptool/rfta/src/rfta/SplitTempRefactoring.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** SplitTempRefactoring.cpp 27 Apr 2003 22:02:03 -0000 1.8
--- SplitTempRefactoring.cpp 16 Dec 2003 13:43:34 -0000 1.9
***************
*** 48,52 ****
throw RefactoringError( RefactoringError::selectionNotInSource );
! NullPPDirectiveListener nullListener;
std::string blankedSource;
NonSemanticBlanker blanker( source, blankedSource, nullListener );
--- 48,52 ----
throw RefactoringError( RefactoringError::selectionNotInSource );
! PPDirectiveListenerPtr nullListener(new NullPPDirectiveListener());
std::string blankedSource;
NonSemanticBlanker blanker( source, blankedSource, nullListener );
|
|
From: <net...@us...> - 2003-12-16 13:33:53
|
Update of /cvsroot/cpptool/rfta/src/rftatest In directory sc8-pr-cvs1:/tmp/cvs-serv26476/rfta/src/rftatest Modified Files: SourceBuilder.cpp Log Message: -- removed unused header Index: SourceBuilder.cpp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rftatest/SourceBuilder.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** SourceBuilder.cpp 3 May 2003 17:35:46 -0000 1.1 --- SourceBuilder.cpp 16 Dec 2003 13:33:50 -0000 1.2 *************** *** 3,8 **** // Created: 2002/11/27 // ////////////////////////////////////////////////////////////////////////// - - #include "stdafx.h" #include <rfta/test/SourceBuilder.h> --- 3,6 ---- |
|
From: <net...@us...> - 2003-12-16 13:32:48
|
Update of /cvsroot/cpptool/rfta/src/rfta
In directory sc8-pr-cvs1:/tmp/cvs-serv26348/rfta/src/rfta
Modified Files:
SourceBasedTestBase.h
Log Message:
-- small interface change for blanker
Index: SourceBasedTestBase.h
===================================================================
RCS file: /cvsroot/cpptool/rfta/src/rfta/SourceBasedTestBase.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** SourceBasedTestBase.h 15 May 2003 16:29:12 -0000 1.8
--- SourceBasedTestBase.h 16 Dec 2003 13:32:45 -0000 1.9
***************
*** 62,66 ****
{
std::string blankedSource;
! NullPPDirectiveListener nullListener;
NonSemanticBlanker blanker( source_, blankedSource, nullListener );
blanker.blank();
--- 62,66 ----
{
std::string blankedSource;
! PPDirectiveListenerPtr nullListener(new NullPPDirectiveListener());
NonSemanticBlanker blanker( source_, blankedSource, nullListener );
blanker.blank();
|
|
From: <net...@us...> - 2003-12-16 13:29:05
|
Update of /cvsroot/cpptool/rfta/src/rftaparser
In directory sc8-pr-cvs1:/tmp/cvs-serv25781/rfta/src/rftaparser
Modified Files:
SourceASTNode.cpp
Log Message:
-- disabled test for equal length of 'preprocessed' and 'orginal' source.
Index: SourceASTNode.cpp
===================================================================
RCS file: /cvsroot/cpptool/rfta/src/rftaparser/SourceASTNode.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** SourceASTNode.cpp 4 May 2003 07:34:06 -0000 1.8
--- SourceASTNode.cpp 16 Dec 2003 13:29:01 -0000 1.9
***************
*** 36,41 ****
--- 36,44 ----
, blankedSourceStart_( blankedSource_.c_str() )
{
+ /*
+ TODO: AndreBaresel: why is this check needed ? For preprocessed code that length can differ !!
if ( blankedSource_.length() != realSource_.length() )
throw std::invalid_argument( "blanked & real length do not match." );
+ */
}
|
|
From: <net...@us...> - 2003-12-16 13:28:04
|
Update of /cvsroot/cpptool/rfta/src/rftaparser In directory sc8-pr-cvs1:/tmp/cvs-serv25666/rfta/src/rftaparser Modified Files: rftaparser.dsp Log Message: -- additional files for preprocessor Index: rftaparser.dsp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rftaparser/rftaparser.dsp,v retrieving revision 1.57 retrieving revision 1.58 diff -C2 -d -r1.57 -r1.58 *** rftaparser.dsp 6 Sep 2003 21:38:54 -0000 1.57 --- rftaparser.dsp 16 Dec 2003 13:28:01 -0000 1.58 *************** *** 1669,1679 **** # End Source File # End Group # Begin Source File ! SOURCE=..\..\include\rfta\parser\Config.h # End Source File # Begin Source File ! SOURCE=.\Makefile.am # End Source File # Begin Source File --- 1669,1686 ---- # End Source File # End Group + # Begin Group "PreProcess" + + # PROP Default_Filter "" # Begin Source File ! SOURCE=..\..\include\rfta\parser\MacroReplaceListener.h # End Source File # Begin Source File ! SOURCE=.\MacroReplaceRegistration.cpp ! # End Source File ! # Begin Source File ! ! SOURCE=..\..\include\rfta\parser\MacroReplaceRegistration.h # End Source File # Begin Source File *************** *** 1684,1687 **** --- 1691,1731 ---- SOURCE=..\..\include\rfta\parser\NonSemanticBlanker.h + # End Source File + # Begin Source File + + SOURCE=..\..\include\rfta\parser\PPDirectiveListener.h + # End Source File + # Begin Source File + + SOURCE=.\PreProcessor.cpp + # End Source File + # Begin Source File + + SOURCE=..\..\include\rfta\parser\PreProcessor.h + # End Source File + # Begin Source File + + SOURCE=.\PreProcessorError.cpp + # End Source File + # Begin Source File + + SOURCE=..\..\include\rfta\parser\PreProcessorError.h + # End Source File + # Begin Source File + + SOURCE=.\PreProcessResolver.cpp + # End Source File + # Begin Source File + + SOURCE=.\PreProcessResolver.h + # End Source File + # End Group + # Begin Source File + + SOURCE=..\..\include\rfta\parser\Config.h + # End Source File + # Begin Source File + + SOURCE=.\Makefile.am # End Source File # Begin Source File |
|
From: <net...@us...> - 2003-12-16 13:27:52
|
Update of /cvsroot/cpptool/rfta/src/rfta In directory sc8-pr-cvs1:/tmp/cvs-serv25638/rfta/src/rfta Modified Files: rfta.dsp Log Message: -- additional files for preprocessor Index: rfta.dsp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rfta/rfta.dsp,v retrieving revision 1.53 retrieving revision 1.54 diff -C2 -d -r1.53 -r1.54 *** rfta.dsp 15 Sep 2003 09:14:42 -0000 1.53 --- rfta.dsp 16 Dec 2003 13:27:49 -0000 1.54 *************** *** 311,314 **** --- 311,322 ---- # Begin Source File + SOURCE=.\PreProcessTransform.cpp + # End Source File + # Begin Source File + + SOURCE=.\PreProcessTransform.h + # End Source File + # Begin Source File + SOURCE=.\ReplaceTextTransform.cpp # End Source File *************** *** 324,327 **** --- 332,339 ---- SOURCE=..\..\include\rfta\refactoring\TextDocument.h + # End Source File + # Begin Source File + + SOURCE=.\Transform.h # End Source File # Begin Source File |
|
From: <net...@us...> - 2003-12-16 13:27:32
|
Update of /cvsroot/cpptool/rfta/src/rfta
In directory sc8-pr-cvs1:/tmp/cvs-serv25598/rfta/src/rfta
Modified Files:
ReplaceTextTransform.h
Log Message:
-- has now a super class "Transform"
Index: ReplaceTextTransform.h
===================================================================
RCS file: /cvsroot/cpptool/rfta/src/rfta/ReplaceTextTransform.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** ReplaceTextTransform.h 7 Mar 2003 09:31:44 -0000 1.5
--- ReplaceTextTransform.h 16 Dec 2003 13:27:29 -0000 1.6
***************
*** 10,13 ****
--- 10,14 ----
#include <rfta/parser/SourceRange.h>
#include <string>
+ #include "Transform.h"
namespace Refactoring
***************
*** 18,22 ****
/// Replace a piece of text by another one.
! class ReplaceTextTransform
{
public:
--- 19,23 ----
/// Replace a piece of text by another one.
! class ReplaceTextTransform: public Transform
{
public:
***************
*** 35,38 ****
--- 36,41 ----
int getStartIndex();
+ int getLength();
+
private:
SourceRange range_;
***************
*** 44,47 ****
--- 47,56 ----
// Inlines methods for ReplaceTextTransform:
// -----------------------------------------
+
+ inline int
+ ReplaceTextTransform::getLength()
+ {
+ return range_.getLength();
+ }
|
|
From: <net...@us...> - 2003-12-16 13:26:16
|
Update of /cvsroot/cpptool/rfta/src/rfta
In directory sc8-pr-cvs1:/tmp/cvs-serv25341/rfta/src/rfta
Modified Files:
RenameTempRefactoring.cpp RenameTempRefactoringTest.cpp
Log Message:
-- added preprocessor implementation
-- tests Macro usage
Index: RenameTempRefactoring.cpp
===================================================================
RCS file: /cvsroot/cpptool/rfta/src/rfta/RenameTempRefactoring.cpp,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** RenameTempRefactoring.cpp 24 Aug 2003 21:00:37 -0000 1.17
--- RenameTempRefactoring.cpp 16 Dec 2003 13:26:10 -0000 1.18
***************
*** 10,16 ****
#include "IdentifierResolverContext.h"
#include "ReplaceTextTransform.h"
! #include "TransformList.h"
#include <rfta/parser/MaxLODMutator.h>
! #include <rfta/parser/NonSemanticBlanker.h>
#include <rfta/parser/ParseContext.h>
#include <rfta/parser/ParserError.h>
--- 10,16 ----
#include "IdentifierResolverContext.h"
#include "ReplaceTextTransform.h"
! #include "PreProcessTransform.h"
#include <rfta/parser/MaxLODMutator.h>
! #include <rfta/parser/PreProcessor.h>
#include <rfta/parser/ParseContext.h>
#include <rfta/parser/ParserError.h>
***************
*** 21,24 ****
--- 21,25 ----
#include <rfta/refactoring/RefactoringError.h>
#include <rfta/refactoring/TextDocument.h>
+ #include <rfta/parser/MacroReplaceRegistration.h>
***************
*** 66,74 ****
if ( temporaryLocation_ >= source.length() )
throw RefactoringError( RefactoringError::selectionNotInSource );
! NullPPDirectiveListener nullListener;
! std::string blankedSource;
! NonSemanticBlanker blanker( source, blankedSource, nullListener );
! blanker.blank();
int start_at = temporaryLocation_;
--- 67,85 ----
if ( temporaryLocation_ >= source.length() )
throw RefactoringError( RefactoringError::selectionNotInSource );
+
+ PreProcessor proc( source );
+ MacroReplaceRegistration registration;
+ std::string blankedSource = proc.process(registration);
+ registration.finishUpData();
! // fix source offset after preprocessing (macros might have moved the position)
! temporaryLocation_ -= registration.getReplacementDeltaBefore(SourceRange( temporaryLocation_, 1 ));
!
! int idx;
! for (idx=0; idx < registration.getSize(); idx++)
! {
! MacroReplaceRegistration::MacroReplacement entry = registration.getEntry(idx);
! transforms_.add( *new PreProcessTransform( entry.position_, entry.macroText_.size() - entry.replacement_.size() ) );
! }
int start_at = temporaryLocation_;
***************
*** 130,134 ****
RenameTempRefactoring::apply( const std::string &newTemporaryName )
{
- TransformList transforms;
for ( ToolsBox::ASTNodes::const_iterator it = occurrences_.begin();
it != occurrences_.end();
--- 141,144 ----
***************
*** 136,144 ****
{
SourceRange range = (*it)->getRange();
! transforms.add( *new ReplaceTextTransform( range,
newTemporaryName ) );
}
! transforms.apply( getDocument() );
}
--- 146,154 ----
{
SourceRange range = (*it)->getRange();
! transforms_.add( *new ReplaceTextTransform( range,
newTemporaryName ) );
}
! transforms_.apply( getDocument() );
}
***************
*** 168,171 ****
--- 178,190 ----
context,
occurrences_ );
+ // check all text replacements for overlapping with MACRO replacements:
+ for ( ToolsBox::ASTNodes::const_iterator it = occurrences_.begin();
+ it != occurrences_.end();
+ ++it )
+ {
+ const SourceRange& range = (*it)->getRange();
+ if (transforms_.hasOverlapping(range))
+ throw RefactoringError( RefactoringError::unableToRefactoreBecauseOfMacros );
+ }
}
catch ( NotLocalVariableIdentifierError & )
Index: RenameTempRefactoringTest.cpp
===================================================================
RCS file: /cvsroot/cpptool/rfta/src/rfta/RenameTempRefactoringTest.cpp,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** RenameTempRefactoringTest.cpp 10 May 2003 10:55:14 -0000 1.16
--- RenameTempRefactoringTest.cpp 16 Dec 2003 13:26:10 -0000 1.17
***************
*** 59,64 ****
{
builder_->add(
"{"
! " double x = getPrice();" );
builder_->addKeyingMid( " ", "x", " += x * rate;", "selection" );
builder_->add(
--- 59,65 ----
{
builder_->add(
+ "#define DBL double\n"
"{"
! " DBL x = getPrice();" );
builder_->addKeyingMid( " ", "x", " += x * rate;", "selection" );
builder_->add(
***************
*** 69,74 ****
std::string expectedSource(
"{"
! " double price = getPrice();"
" price += price * rate;"
" return price * getQuantity();"
--- 70,76 ----
std::string expectedSource(
+ "#define DBL double\n"
"{"
! " DBL price = getPrice();"
" price += price * rate;"
" return price * getQuantity();"
|
|
From: <net...@us...> - 2003-12-16 13:26:16
|
Update of /cvsroot/cpptool/rfta/include/rfta/refactoring
In directory sc8-pr-cvs1:/tmp/cvs-serv25341/rfta/include/rfta/refactoring
Modified Files:
RenameTempRefactoring.h
Log Message:
-- added preprocessor implementation
-- tests Macro usage
Index: RenameTempRefactoring.h
===================================================================
RCS file: /cvsroot/cpptool/rfta/include/rfta/refactoring/RenameTempRefactoring.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** RenameTempRefactoring.h 10 May 2003 10:55:15 -0000 1.12
--- RenameTempRefactoring.h 16 Dec 2003 13:26:11 -0000 1.13
***************
*** 10,13 ****
--- 10,14 ----
#include <rfta/refactoring/RefactoringBase.h>
#include <rfta/refactoring/ToolsBox.h>
+ #include "TransformList.h"
namespace Refactoring
***************
*** 55,58 ****
--- 56,60 ----
ToolsBox::ASTNodes occurrences_;
ASTNodePtr localeVariableNode_;
+ TransformList transforms_;
};
|
|
From: <net...@us...> - 2003-12-16 13:25:19
|
Update of /cvsroot/cpptool/rfta/include/rfta/refactoring
In directory sc8-pr-cvs1:/tmp/cvs-serv25165/rfta/include/rfta/refactoring
Modified Files:
RefactoringError.h
Log Message:
-- additional error type for Macro / Refactoring conflics
Index: RefactoringError.h
===================================================================
RCS file: /cvsroot/cpptool/rfta/include/rfta/refactoring/RefactoringError.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** RefactoringError.h 15 May 2003 16:24:28 -0000 1.3
--- RefactoringError.h 16 Dec 2003 13:25:16 -0000 1.4
***************
*** 26,30 ****
initializerValueNotSupported, //< exception thrown in InlineTemp
variableIsAssigned, //< exception thrown in InlineTemp
! unableToParse //< refactoring operation has been aborded because of a parser error
};
--- 26,31 ----
initializerValueNotSupported, //< exception thrown in InlineTemp
variableIsAssigned, //< exception thrown in InlineTemp
! unableToParse, //< refactoring operation has been aborded because of a parser error
! unableToRefactoreBecauseOfMacros //< refactoring operation touches the contens of macros
};
|
|
From: <net...@us...> - 2003-12-16 13:25:19
|
Update of /cvsroot/cpptool/rfta/src/rfta
In directory sc8-pr-cvs1:/tmp/cvs-serv25165/rfta/src/rfta
Modified Files:
RefactoringError.cpp
Log Message:
-- additional error type for Macro / Refactoring conflics
Index: RefactoringError.cpp
===================================================================
RCS file: /cvsroot/cpptool/rfta/src/rfta/RefactoringError.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** RefactoringError.cpp 15 May 2003 16:24:29 -0000 1.5
--- RefactoringError.cpp 16 Dec 2003 13:25:16 -0000 1.6
***************
*** 47,50 ****
--- 47,52 ----
case unableToParse:
return "refactoring tool was not able to parse the source.";
+ case unableToRefactoreBecauseOfMacros:
+ return "unable to process since refactoring operation touches the contens of macros.";
}
|
|
From: <net...@us...> - 2003-12-16 13:24:39
|
Update of /cvsroot/cpptool/rfta/src/rftaparser
In directory sc8-pr-cvs1:/tmp/cvs-serv25032/rfta/src/rftaparser
Modified Files:
NonSemanticBlankerTest.cpp NonSemanticBlankerTest.h
Log Message:
-- small interface change for blanker
Index: NonSemanticBlankerTest.cpp
===================================================================
RCS file: /cvsroot/cpptool/rfta/src/rftaparser/NonSemanticBlankerTest.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** NonSemanticBlankerTest.cpp 27 Oct 2002 19:13:09 -0000 1.2
--- NonSemanticBlankerTest.cpp 16 Dec 2003 13:24:36 -0000 1.3
***************
*** 21,25 ****
{
std::string blanked(source);
! NonSemanticBlanker blanker(source, blanked, *listener);
blanker.blank();
CppUnit::Message message("blanking failed",
--- 21,25 ----
{
std::string blanked(source);
! NonSemanticBlanker blanker(source, blanked, listener);
blanker.blank();
CppUnit::Message message("blanking failed",
***************
*** 47,56 ****
NonSemanticBlankerTest::setUp()
{
! listener = new NullPPDirectiveListener;
};
void
NonSemanticBlankerTest::tearDown()
{
- delete listener;
};
void
--- 47,55 ----
NonSemanticBlankerTest::setUp()
{
! listener = PPDirectiveListenerPtr(new NullPPDirectiveListener);
};
void
NonSemanticBlankerTest::tearDown()
{
};
void
***************
*** 61,65 ****
std::string blanked("asdf");
! NonSemanticBlanker blanker(source, blanked, *listener);
blanker.blank();
CPPUNIT_ASSERT_EQUAL(source, blanked);
--- 60,64 ----
std::string blanked("asdf");
! NonSemanticBlanker blanker(source, blanked, listener);
blanker.blank();
CPPUNIT_ASSERT_EQUAL(source, blanked);
Index: NonSemanticBlankerTest.h
===================================================================
RCS file: /cvsroot/cpptool/rfta/src/rftaparser/NonSemanticBlankerTest.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** NonSemanticBlankerTest.h 27 Oct 2002 19:53:47 -0000 1.3
--- NonSemanticBlankerTest.h 16 Dec 2003 13:24:36 -0000 1.4
***************
*** 8,16 ****
#include "ParserTesting.h"
namespace Refactoring
{
- class PPDirectiveListener;
/// Unit tests for NonSemanticBlankerTest
--- 8,16 ----
#include "ParserTesting.h"
+ #include <rfta/parser/PPDirectiveListener.h>
namespace Refactoring
{
/// Unit tests for NonSemanticBlankerTest
***************
*** 47,51 ****
private:
! PPDirectiveListener* listener;
void blankerTest(const std::string& source, const std::string& wanted,
--- 47,51 ----
private:
! PPDirectiveListenerPtr listener;
void blankerTest(const std::string& source, const std::string& wanted,
|
|
From: <net...@us...> - 2003-12-16 13:24:23
|
Update of /cvsroot/cpptool/rfta/include/rfta/parser
In directory sc8-pr-cvs1:/tmp/cvs-serv24992/rfta/include/rfta/parser
Modified Files:
NonSemanticBlanker.h
Log Message:
-- small interface change for blanker
-- comments
Index: NonSemanticBlanker.h
===================================================================
RCS file: /cvsroot/cpptool/rfta/include/rfta/parser/NonSemanticBlanker.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** NonSemanticBlanker.h 27 Oct 2002 19:31:46 -0000 1.3
--- NonSemanticBlanker.h 16 Dec 2003 13:24:20 -0000 1.4
***************
*** 5,30 ****
#include <string>
namespace Refactoring
! {
!
! class RFTAPARSER_API PPDirectiveListener
! {
! public:
! virtual void parseDirective( const char *first,
! const char *last ) =0;
! };
!
!
! class RFTAPARSER_API NullPPDirectiveListener : public PPDirectiveListener
! {
! public:
! void parseDirective( const char *first,
! const char *last )
! {
! }
! };
!
!
class RFTAPARSER_API NonSemanticBlanker
{
--- 5,12 ----
#include <string>
+ #include "PPDirectiveListener.h"
namespace Refactoring
! {
class RFTAPARSER_API NonSemanticBlanker
{
***************
*** 32,36 ****
NonSemanticBlanker( const std::string &textToBlank,
std::string &blanked,
! PPDirectiveListener &ppDirectiveParser );
void blank();
--- 14,18 ----
NonSemanticBlanker( const std::string &textToBlank,
std::string &blanked,
! PPDirectiveListenerPtr ppDirectiveParser );
void blank();
***************
*** 49,53 ****
const char *textEnd_;
std::string &blanked_;
! PPDirectiveListener &ppDirectiveParser_;
bool newLine_;
const char* current_;
--- 31,35 ----
const char *textEnd_;
std::string &blanked_;
! PPDirectiveListenerPtr ppDirectiveParser_;
bool newLine_;
const char* current_;
|
|
From: <net...@us...> - 2003-12-16 13:24:23
|
Update of /cvsroot/cpptool/rfta/src/rftaparser
In directory sc8-pr-cvs1:/tmp/cvs-serv24992/rfta/src/rftaparser
Modified Files:
NonSemanticBlanker.cpp
Log Message:
-- small interface change for blanker
-- comments
Index: NonSemanticBlanker.cpp
===================================================================
RCS file: /cvsroot/cpptool/rfta/src/rftaparser/NonSemanticBlanker.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** NonSemanticBlanker.cpp 8 Nov 2002 07:46:49 -0000 1.6
--- NonSemanticBlanker.cpp 16 Dec 2003 13:24:20 -0000 1.7
***************
*** 7,11 ****
NonSemanticBlanker::NonSemanticBlanker( const std::string &textToBlank,
std::string &blanked,
! PPDirectiveListener &ppDirectiveParser )
: blanked_( blanked )
, ppDirectiveParser_( ppDirectiveParser )
--- 7,11 ----
NonSemanticBlanker::NonSemanticBlanker( const std::string &textToBlank,
std::string &blanked,
! PPDirectiveListenerPtr ppDirectiveParser )
: blanked_( blanked )
, ppDirectiveParser_( ppDirectiveParser )
***************
*** 118,122 ****
}
! ppDirectiveParser_.parseDirective( start, current );
int length = current - start;
--- 118,122 ----
}
! ppDirectiveParser_->parseDirective( start, current );
int length = current - start;
***************
*** 146,150 ****
}
else
! blanksStringsAndPreprocessorDirectives();
}
}
--- 146,150 ----
}
else
! blanksStringsAndPreprocessorDirectives();
}
}
***************
*** 154,189 ****
NonSemanticBlanker::blanksStringsAndPreprocessorDirectives( )
{
! char c(*current_);
switch ( c )
! {
! case ' ':
! ++current_;
! break;
! case '\t':
! blanked_[ current_++ - textStart_ ] = ' ';
! break;
! case '\n':
! case '\r':
! current_ = blanksNewLine( current_ );
! newLine_ = true;
! break;
! case '"':
! current_ = blanksString( current_, '"' );
! break;
! case '\'':
! current_ = blanksString( current_, '\'' );
! break;
! case '#':
! if ( newLine_ )
! {
! current_ = blanksPreprocessorDirective( current_ );
! break;
! }
! // missing break, this is correct
! default:
! newLine_ = false;
! ++current_;
! break;
! }
}
--- 154,189 ----
NonSemanticBlanker::blanksStringsAndPreprocessorDirectives( )
{
! char c(*current_);
switch ( c )
! {
! case ' ':
! ++current_;
! break;
! case '\t':
! blanked_[ current_++ - textStart_ ] = ' ';
! break;
! case '\n':
! case '\r':
! current_ = blanksNewLine( current_ );
! newLine_ = true;
! break;
! case '"':
! current_ = blanksString( current_, '"' );
! break;
! case '\'':
! current_ = blanksString( current_, '\'' );
! break;
! case '#':
! if ( newLine_ )
! {
! current_ = blanksPreprocessorDirective( current_ );
! break;
! }
! // missing break, this is correct
! default:
! newLine_ = false;
! ++current_;
! break;
! }
}
|
|
From: <net...@us...> - 2003-12-16 13:24:10
|
Update of /cvsroot/cpptool/rfta/src/rfta
In directory sc8-pr-cvs1:/tmp/cvs-serv24964/rfta/src/rfta
Modified Files:
InlineTempRefactoring.cpp
Log Message:
-- small interface change for blanker
-- comments
Index: InlineTempRefactoring.cpp
===================================================================
RCS file: /cvsroot/cpptool/rfta/src/rfta/InlineTempRefactoring.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** InlineTempRefactoring.cpp 15 May 2003 16:26:29 -0000 1.9
--- InlineTempRefactoring.cpp 16 Dec 2003 13:24:06 -0000 1.10
***************
*** 67,71 ****
// blank the source code
! NullPPDirectiveListener nullListener;
std::string blankedSource;
NonSemanticBlanker blanker( source, blankedSource, nullListener );
--- 67,71 ----
// blank the source code
! PPDirectiveListenerPtr nullListener(new NullPPDirectiveListener());
std::string blankedSource;
NonSemanticBlanker blanker( source, blankedSource, nullListener );
***************
*** 355,359 ****
--- 355,361 ----
{
newtext = initValue_->getOriginalText();
+ // remove leading spaces
while (isspace(newtext[0])) newtext.erase(0,1);
+ // remove spaces at the end of the string
while (isspace(newtext[newtext.length()-1])) newtext.erase(newtext.length()-1,1);
}
|
|
From: <net...@us...> - 2003-12-16 13:23:21
|
Update of /cvsroot/cpptool/rfta/src/rfta
In directory sc8-pr-cvs1:/tmp/cvs-serv24872/rfta/src/rfta
Modified Files:
IdentifierResolverContext.cpp IdentifierResolverContext.h
Log Message:
-- template for class resolving (empty for the moment because other things are more important now)
Index: IdentifierResolverContext.cpp
===================================================================
RCS file: /cvsroot/cpptool/rfta/src/rfta/IdentifierResolverContext.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** IdentifierResolverContext.cpp 15 Sep 2003 09:19:35 -0000 1.12
--- IdentifierResolverContext.cpp 16 Dec 2003 13:23:18 -0000 1.13
***************
*** 75,78 ****
--- 75,83 ----
}
+ void
+ IdentifierResolverContext::declareClass( const ASTNodePtr &specifierNode)
+ {
+ }
+
bool
Index: IdentifierResolverContext.h
===================================================================
RCS file: /cvsroot/cpptool/rfta/src/rfta/IdentifierResolverContext.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** IdentifierResolverContext.h 15 Sep 2003 09:19:35 -0000 1.8
--- IdentifierResolverContext.h 16 Dec 2003 13:23:18 -0000 1.9
***************
*** 59,62 ****
--- 59,64 ----
void resolveUnqualifiedIdentifier( const ASTNodePtr &identifierNode );
+ void declareClass( const ASTNodePtr &specifierNode);
+
void enterNamedSubScope(std::string name);
void leaveNamedSubScope();
|
|
From: <net...@us...> - 2003-12-16 13:22:25
|
Update of /cvsroot/cpptool/rfta/src/rftaparser
In directory sc8-pr-cvs1:/tmp/cvs-serv24636/rfta/src/rftaparser
Modified Files:
EnumBodyParser.cpp EnumBodyParserTest.cpp
Log Message:
-- additional ast nodes for symbols.
Index: EnumBodyParser.cpp
===================================================================
RCS file: /cvsroot/cpptool/rfta/src/rftaparser/EnumBodyParser.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** EnumBodyParser.cpp 3 May 2003 17:43:44 -0000 1.1
--- EnumBodyParser.cpp 16 Dec 2003 13:22:21 -0000 1.2
***************
*** 72,76 ****
{
ASTNodePtr constantNode = createASTNode( ASTNodeTypes::enumConstant, bodyNode, identifier );
! ASTNodePtr identifierNode = createASTNode( ASTNodeTypes::variableIdentifier, constantNode, identifier );
constantNode->setPropertyNode( ASTNodeProperties::variableNameProperty, identifierNode );
return constantNode;
--- 72,76 ----
{
ASTNodePtr constantNode = createASTNode( ASTNodeTypes::enumConstant, bodyNode, identifier );
! ASTNodePtr identifierNode = createASTNode( ASTNodeTypes::localScopeIdentifier, constantNode, identifier );
constantNode->setPropertyNode( ASTNodeProperties::variableNameProperty, identifierNode );
return constantNode;
Index: EnumBodyParserTest.cpp
===================================================================
RCS file: /cvsroot/cpptool/rfta/src/rftaparser/EnumBodyParserTest.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** EnumBodyParserTest.cpp 3 May 2003 20:40:22 -0000 1.2
--- EnumBodyParserTest.cpp 16 Dec 2003 13:22:21 -0000 1.3
***************
*** 110,114 ****
ASTNodePtr identifierNode = constantNode->getProperty( ASTNodeProperties::variableNameProperty );
RFTA_ASSERT_NODE_HAS( identifierNode,
! ASTNodeTypes::variableIdentifier,
builder_->getStartIndex(identifierKey),
builder_->getLength(identifierKey),
--- 110,114 ----
ASTNodePtr identifierNode = constantNode->getProperty( ASTNodeProperties::variableNameProperty );
RFTA_ASSERT_NODE_HAS( identifierNode,
! ASTNodeTypes::localScopeIdentifier,
builder_->getStartIndex(identifierKey),
builder_->getLength(identifierKey),
|
|
From: <net...@us...> - 2003-12-16 13:21:54
|
Update of /cvsroot/cpptool/rfta/src/rftaparser
In directory sc8-pr-cvs1:/tmp/cvs-serv24535/rfta/src/rftaparser
Modified Files:
CPPParser.cpp
Log Message:
-- small interface change for blanker
Index: CPPParser.cpp
===================================================================
RCS file: /cvsroot/cpptool/rfta/src/rftaparser/CPPParser.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** CPPParser.cpp 29 Apr 2003 22:00:54 -0000 1.2
--- CPPParser.cpp 16 Dec 2003 13:21:51 -0000 1.3
***************
*** 76,85 ****
CPPParser::CPPParser( const std::string &source )
{
! NullPPDirectiveListener nullListener;
std::string blankedSource;
! NonSemanticBlanker blanker( source, blankedSource, nullListener );
blanker.blank();
! sourceNode_ = SourceASTNode::create( blankedSource, source );
}
--- 76,85 ----
CPPParser::CPPParser( const std::string &source )
{
! PPDirectiveListenerPtr pNullListener( new NullPPDirectiveListener() );
std::string blankedSource;
! NonSemanticBlanker blanker( source, blankedSource, pNullListener );
blanker.blank();
! sourceNode_ = SourceASTNode::create( blankedSource, source );
}
|