[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: playground/devtools/kdevelop4-extra-plugins/python/parser
From: Andreas Pakulat <apaku () gmx ! de>
Date: 2008-01-07 9:29:39
Message-ID: 1199698179.924028.6629.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 758229 by apaku:
implement shiftexpr
M +32 -0 astbuilder.cpp
--- trunk/playground/devtools/kdevelop4-extra-plugins/python/parser/astbuilder.cpp #758228:758229
@@ -1262,6 +1262,38 @@
void AstBuilder::visitShiftExpr(PythonParser::ShiftExprAst *node)
{
qDebug() << "visitShiftExpr start";
+ visitNode( node->arithExpr );
+ if( count > 0 )
+ {
+ Q_ASSERT( count == node->arithExprListSequence->count() );
+ BinaryExpressionAst* ast = createAst<BinaryExpressionAst>( node );
+ ast->lhs = safeNodeCast<ExpressionAst>( mNodeStack.pop() );
+ count = node->shiftOpListSequence->count();
+ BinaryExpressionAst* cur = ast;
+ for( int i = 0; i < count; i++ )
+ {
+ switch( node->shiftOpListSequence->at( i )->element->shiftOp )
+ {
+ case PythonParser::LeftShiftOp:
+ cur->opType = ArithmeticExpressionAst::BinaryLeftShift;
+ break;
+ case PythonParser::RightShiftOp:
+ cur->opType = ArithmeticExpressionAst::BinaryRightShift;
+ break;
+ }
+ visitNode( node->arithExprListSequence->at( i )->element );
+ if( i == count - 1 )
+ {
+ cur->rhs = safeNodeCast<ExpressionAst>( mNodeStack.pop() );
+ }else
+ {
+ cur->rhs = createAst<BinaryExpressionAst>( node->arithExprListSequence->at( i )->element );
+ cur = cur->rhs;
+ cur->lhs = safeNodeCast<ExpressionAst>( mNodeStack.pop() );
+ }
+ }
+ mNodeStack.push( ast );
+ }
qDebug() << "visitShiftExpr end";
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic