[cfe-commits] r38884 - /cfe/cfe/trunk/Parse/ParseExpr.cpp
sabre at cs.uiuc.edu
sabre at cs.uiuc.edu
Wed Jul 11 09:25:28 PDT 2007
Author: sabre
Date: Wed Jul 11 11:25:28 2007
New Revision: 38884
URL: http://llvm.org/viewvc/llvm-project?rev=38884&view=rev
Log:
Implement ParseAssignmentExpression correctly
Modified:
cfe/cfe/trunk/Parse/ParseExpr.cpp
Modified: cfe/cfe/trunk/Parse/ParseExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Parse/ParseExpr.cpp?rev=38884&r1=38883&r2=38884&view=diff
==============================================================================
--- cfe/cfe/trunk/Parse/ParseExpr.cpp (original)
+++ cfe/cfe/trunk/Parse/ParseExpr.cpp Wed Jul 11 11:25:28 2007
@@ -45,11 +45,6 @@
-// Expr that doesn't include commas.
-Parser::ExprResult Parser::ParseAssignmentExpression() {
- return ParseExpression();
-}
-
/// PrecedenceLevels - These are precedences for the binary/ternary operators in
/// the C99 grammar. These have been named to relate with the C99 grammar
/// productions. Low precedences numbers bind more weakly than high numbers.
@@ -117,7 +112,7 @@
}
-/// ParseBinaryExpression - Simple precedence-based parser for binary/ternary
+/// ParseExpression - Simple precedence-based parser for binary/ternary
/// operators.
///
/// Note: we diverge from the C99 grammar when parsing the assignment-expression
@@ -200,6 +195,14 @@
return ParseRHSOfBinaryExpression(LHS, prec::Comma);
}
+// Expr that doesn't include commas.
+Parser::ExprResult Parser::ParseAssignmentExpression() {
+ ExprResult LHS = ParseCastExpression(false);
+ if (LHS.isInvalid) return LHS;
+
+ return ParseRHSOfBinaryExpression(LHS, prec::Assignment);
+}
+
/// ParseRHSOfBinaryExpression - Parse a binary expression that starts with
/// LHS and has a precedence of at least MinPrec.
Parser::ExprResult
More information about the cfe-commits
mailing list