/// ParseAssignmentStmt /// [R732]: /// assignment-stmt := /// variable = expr Parser::StmtResult Parser::ParseAssignmentStmt() { ExprResult LHS = ParsePrimaryExpr(true); if(LHS.isInvalid()) return StmtError(); SourceLocation Loc = Tok.getLocation(); if(!ConsumeIfPresent(tok::equal)) { Diag.Report(getExpectedLoc(),diag::err_expected_equal); return StmtError(); } ExprResult RHS = ParseExpectedFollowupExpression("="); if(RHS.isInvalid()) return StmtError(); return Actions.ActOnAssignmentStmt(Context, Loc, LHS, RHS, StmtLabel); }
// ParseLevel1Expr - Level-1 expressions are primaries optionally operated on by // defined unary operators. // // R702: // level-1-expr := // [ defined-unary-op ] primary // R703: // defined-unary-op := // . letter [ letter ] ... . Parser::ExprResult Parser::ParseLevel1Expr() { SourceLocation OpLoc = Tok.getLocation(); IdentifierInfo *II = 0; if (IsPresent(tok::defined_operator) && !IsNextToken(tok::l_paren)) { II = Tok.getIdentifierInfo(); Lex(); } ExprResult E = ParsePrimaryExpr(); if (E.isInvalid()) return E; if (II) E = DefinedUnaryOperatorExpr::Create(Context, OpLoc, E.take(), II); return E; }