[opengtl-commits] [427] support for *= et /= |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/opengtl-commits Archives
]
Revision: 427
Author: cyrille
Date: 2008-10-06 14:36:55 +0200 (Mon, 06 Oct 2008)
Log Message:
-----------
support for *= et /=
Modified Paths:
--------------
trunk/OpenGTL/OpenGTL/GTLCore/ParserBase_p.cpp
trunk/OpenGTL/OpenGTL/GTLCore/Token_p.cpp
trunk/OpenGTL/OpenGTL/GTLCore/Token_p.h
trunk/OpenGTL/OpenShiva/OpenShiva/Lexer_p.cpp
Modified: trunk/OpenGTL/OpenGTL/GTLCore/ParserBase_p.cpp
===================================================================
--- trunk/OpenGTL/OpenGTL/GTLCore/ParserBase_p.cpp 2008-10-06 12:17:44 UTC (rev 426)
+++ trunk/OpenGTL/OpenGTL/GTLCore/ParserBase_p.cpp 2008-10-06 12:36:55 UTC (rev 427)
@@ -479,7 +479,7 @@
AST::Expression* ParserBase::parseBinaryOperator( bool _constantExpression, AST::Expression* _lhs)
{
- GTL_ASSERT(_lhs);
+ if( not _lhs) return 0;
Token binOp = d->currentToken;
GTL_DEBUG( "parseBinaryOperator: " << binOp )
getNextToken();
@@ -1420,7 +1420,7 @@
delete rhs;
return 0;
}
- if( token.type == Token::EQUAL or token.type == Token::PLUSEQUAL or token.type == Token::MINUSEQUAL)
+ if( token.type == Token::EQUAL or token.type == Token::PLUSEQUAL or token.type == Token::MINUSEQUAL or token.type == Token::MULTIPLYEQUAL or token.type == Token::DIVIDEEQUAL)
{
rhs = d->compiler->convertCenter()->createConvertExpression( rhs, lhs->type() );
if( not rhs )
@@ -1438,6 +1438,10 @@
rhs = new AST::AdditionBinaryExpression( new AST::ProxyExpression(ve), rhs );
} else if(token.type == Token::MINUSEQUAL) {
rhs = new AST::SubstractionBinaryExpression( new AST::ProxyExpression(ve), rhs );
+ } else if(token.type == Token::MULTIPLYEQUAL) {
+ rhs = new AST::MultiplicationBinaryExpression( new AST::ProxyExpression(ve), rhs );
+ } else if(token.type == Token::DIVIDEEQUAL) {
+ rhs = new AST::DivisionBinaryExpression( new AST::ProxyExpression(ve), rhs );
}
return new AST::AssignementBinaryExpression( ve, rhs );
}
Modified: trunk/OpenGTL/OpenGTL/GTLCore/Token_p.cpp
===================================================================
--- trunk/OpenGTL/OpenGTL/GTLCore/Token_p.cpp 2008-10-06 12:17:44 UTC (rev 426)
+++ trunk/OpenGTL/OpenGTL/GTLCore/Token_p.cpp 2008-10-06 12:36:55 UTC (rev 427)
@@ -62,6 +62,10 @@
return "+=";
case Token::MINUSEQUAL:
return "-=";
+ case Token::MULTIPLYEQUAL:
+ return "*=";
+ case Token::DIVIDEEQUAL:
+ return "/=";
case Token::DIFFERENT:
return "!=";
case Token::AND:
@@ -261,6 +265,8 @@
case Token::EQUAL:
case Token::PLUSEQUAL:
case Token::MINUSEQUAL:
+ case Token::MULTIPLYEQUAL:
+ case Token::DIVIDEEQUAL:
return ASSIGNEMENT_PRIORITY;
case Token::OR:
return OR_PRIORITY;
Modified: trunk/OpenGTL/OpenGTL/GTLCore/Token_p.h
===================================================================
--- trunk/OpenGTL/OpenGTL/GTLCore/Token_p.h 2008-10-06 12:17:44 UTC (rev 426)
+++ trunk/OpenGTL/OpenGTL/GTLCore/Token_p.h 2008-10-06 12:36:55 UTC (rev 427)
@@ -54,6 +54,8 @@
EQUALEQUAL, ///< ==
PLUSEQUAL, ///< +=
MINUSEQUAL, ///< -=
+ MULTIPLYEQUAL, ///< *=
+ DIVIDEEQUAL, ///< /=
DIFFERENT, ///< !=
AND, ///< and &&
OR, ///< or ||
Modified: trunk/OpenGTL/OpenShiva/OpenShiva/Lexer_p.cpp
===================================================================
--- trunk/OpenGTL/OpenShiva/OpenShiva/Lexer_p.cpp 2008-10-06 12:17:44 UTC (rev 426)
+++ trunk/OpenGTL/OpenShiva/OpenShiva/Lexer_p.cpp 2008-10-06 12:36:55 UTC (rev 427)
@@ -115,8 +115,8 @@
CHAR_IS_TOKEN_OR_TOKEN_OR_TOKEN( '>', '=', '>', SUPPERIOR, SUPPERIOREQUAL, RIGHTSHIFT );
CHAR_IS_TOKEN_OR_TOKEN_OR_TOKEN( '+', '+', '=', PLUS, PLUSPLUS, PLUSEQUAL );
CHAR_IS_TOKEN_OR_TOKEN_OR_TOKEN( '-', '-', '=', MINUS, MINUSMINUS, MINUSEQUAL );
- CHAR_IS_TOKEN( '*', MULTIPLY );
- CHAR_IS_TOKEN( '/', DIVIDE );
+ CHAR_IS_TOKEN_OR_TOKEN( '*', '=', MULTIPLY, MULTIPLYEQUAL);
+ CHAR_IS_TOKEN_OR_TOKEN( '/', '=', DIVIDE, DIVIDEEQUAL);
CHAR_IS_TOKEN( '%', MODULO );
CHAR_IS_TOKEN( '~', TILDE );
}