public VccAtomicOpBlock(List <Statement> statements, VccAtomicOp atomicOp, ISourceLocation sourceLocation) : base(statements, sourceLocation) { this.atomicOp = atomicOp; }
private Expression ParseSpecCastExpression(TokenSet followers, bool savedInSpecCode, SourceLocationBuilder slb) { if (this.CurrentTokenStartsTypeExpression()) { TypeExpression targetType = this.ParseTypeExpression(followers | Token.RightParenthesis); this.SkipOutOfSpecBlock(savedInSpecCode, TS.UnaryStart | followers); var valueToCast = this.ParseUnaryExpression(followers); slb.UpdateToSpan(valueToCast.SourceLocation); return new VccCast(valueToCast, targetType, slb); } if (this.currentToken == Token.Unchecked) { this.GetNextToken(); this.SkipOutOfSpecBlock(savedInSpecCode, TS.UnaryStart | followers); var uncheckedExpr = this.ParseUnaryExpression(followers); slb.UpdateToSpan(uncheckedExpr.SourceLocation); return new UncheckedExpression(uncheckedExpr, slb); } if (this.currentToken == Token.Identifier) { var id = this.scanner.GetIdentifierString(); //if (id.StartsWith("\\") && this.castlikeFunctions.ContainsKey(id.Substring(1))) // id = id.Substring(1); if (id == "atomic_op" || this.castlikeFunctions.ContainsKey(id)) { var methodName = id == "atomic_op" ? "" : this.castlikeFunctions[id]; var savedResultIsKeyword = this.resultIsAKeyword; this.resultIsAKeyword = (id == "atomic_op"); var isVarArgs = methodName.StartsWith("\\castlike_va_"); this.GetNextToken(); List<Expression> exprs = this.currentToken == Token.RightParenthesis ? new List<Expression>() : this.ParseExpressionList(Token.Comma, followers | Token.RightParenthesis); this.resultIsAKeyword = savedResultIsKeyword; this.SkipOutOfSpecBlock(savedInSpecCode, TS.UnaryStart | followers); if (isVarArgs) { slb.UpdateToSpan(this.scanner.SourceLocationOfLastScannedToken); var argList = new VccMethodCall(this.GetSimpleNameFor("\\argument_tuple"), exprs.ToArray(), slb.GetSourceLocation()); exprs.Clear(); exprs.Add(argList); } var expr = this.ParseUnaryExpression(followers); slb.UpdateToSpan(expr.SourceLocation); if (id == "atomic_op") { exprs.Add(expr); var atomicOp = new VccAtomicOp(this.GetSimpleNameFor("_vcc_atomic_op"), exprs.AsReadOnly(), slb); var atomicOpBlock = new VccAtomicOpBlock(new List<Statement>(0), atomicOp, slb); return new BlockExpression(atomicOpBlock, atomicOp, slb); } exprs.Insert(0, expr); return new VccMethodCall(this.GetSimpleNameFor(methodName), exprs, slb); } this.HandleError(Error.SyntaxError, this.scanner.GetTokenSource()); this.SkipOutOfSpecBlock(savedInSpecCode, followers); return new DummyExpression(slb); } this.HandleError(Error.SyntaxError, this.scanner.GetTokenSource()); this.SkipOutOfSpecBlock(savedInSpecCode, followers); return new DummyExpression(slb); }