From: <net...@us...> - 2002-12-30 13:57:55
|
Update of /cvsroot/cpptool/rfta/src/rftaparser In directory sc8-pr-cvs1:/tmp/cvs-serv7917/rfta/src/rftaparser Modified Files: ExpressionOperationMutatorTest.cpp ExpressionOperationMutator.cpp Log Message: -- implemented expr-list fully + tests activated Index: ExpressionOperationMutatorTest.cpp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rftaparser/ExpressionOperationMutatorTest.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ExpressionOperationMutatorTest.cpp 28 Dec 2002 10:52:50 -0000 1.2 --- ExpressionOperationMutatorTest.cpp 30 Dec 2002 13:57:53 -0000 1.3 *************** *** 91,97 **** { SourceASTNodePtr sourceAST = Testing::createAST("a=10,i=2",CPPUNIT_SOURCELINE() ); - - /* - deactiated because expression-list-parsing is not implemented. ASTNodePtr expr = sourceAST->getChildAt(0); --- 91,94 ---- *************** *** 116,120 **** 5, 3 ); - */ } --- 113,116 ---- Index: ExpressionOperationMutator.cpp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rftaparser/ExpressionOperationMutator.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ExpressionOperationMutator.cpp 28 Dec 2002 10:37:57 -0000 1.1 --- ExpressionOperationMutator.cpp 30 Dec 2002 13:57:53 -0000 1.2 *************** *** 56,59 **** --- 56,60 ---- { bool exprListDetectedBefore = false; + int lastOp = node_->getRange().getStartIndex(); // find first ',' or '(' ExpressionMutator::Tokens::iterator i = token.begin(); *************** *** 66,71 **** if ((*i).type_ == ExpressionMutator::comma) { ! // collect a expression-list element: ! if (!exprListDetectedBefore) --- 67,72 ---- if ((*i).type_ == ExpressionMutator::comma) { ! // collect a expression-list element: ! int OpStart = (*i).start_ - sourceNode_->getBlankedSourceStart(); if (!exprListDetectedBefore) *************** *** 73,95 **** exprListDetectedBefore = true; ! // add a property marking this expression as expression-list ! int OpStart = (*i).start_ - sourceNode_->getBlankedSourceStart(); ASTNodePtr property = createASTNode(ASTNodeTypes::expressionList,node_,OpStart,1); node_->setPropertyNode(ASTNodeProperties::expressionTypeProperty,property); } } i++; } - // check if a comma was found: - if (i!=token.end()) - { - // split assignment at this iterator position: - ! // stop here - further mutation can be done by request. ! return; } - // we didn't found an expression list so check for assignment expression: - splitAssignmentExpression(token); } --- 74,104 ---- exprListDetectedBefore = true; ! // add a property marking this expression as expression-list ASTNodePtr property = createASTNode(ASTNodeTypes::expressionList,node_,OpStart,1); node_->setPropertyNode(ASTNodeProperties::expressionTypeProperty,property); } + + int Start = lastOp; + int End = OpStart; + ASTNodePtr listElem = createASTNode(ASTNodeTypes::expression,node_, Start, End - Start); + node_->addChild(listElem); + + lastOp = OpStart+1; } i++; } ! if (exprListDetectedBefore) ! { ! int Start = lastOp; ! int End = node_->getRange().getEndIndex(); ! ASTNodePtr listElem = createASTNode(ASTNodeTypes::expression,node_, Start, End - Start); ! node_->addChild(listElem); ! } ! else ! { ! // we didn't found an expression list so check for assignment expression: ! splitAssignmentExpression(token); } } |