Exemplo n.º 1
0
        public override RuleAction Clone()
        {
            RuleStatementAction action = (RuleStatementAction)base.MemberwiseClone();

            action.codeDomStatement = CodeDomStatementWalker.Clone(this.codeDomStatement);
            return(action);
        }
Exemplo n.º 2
0
        public override RuleAction Clone()
        {
            RuleStatementAction newAction = (RuleStatementAction)this.MemberwiseClone();

            newAction.codeDomStatement = CodeDomStatementWalker.Clone(codeDomStatement);
            return(newAction);
        }
Exemplo n.º 3
0
        public override bool Equals(object obj)
        {
#pragma warning disable 56506
            RuleStatementAction other = obj as RuleStatementAction;
            return((other != null) && (CodeDomStatementWalker.Match(CodeDomStatement, other.CodeDomStatement)));

#pragma warning restore 56506
        }
Exemplo n.º 4
0
        // Parse:
        //              statement       --> assign-statement
        //                              --> update-statement
        //                              --> HALT
        //
        //              update-statement --> UPDATE ( "path" )
        //                               --> UPDATE ( postfix-expr )
        private RuleAction ParseStatement(ParserContext parserContext)
        {
            RuleAction action = null;
            Token statementToken = parserContext.CurrentToken;
            if (statementToken.TokenID == TokenID.Halt)
            {
                parserContext.NextToken(); // eat the "halt"
                action = new RuleHaltAction();
                parserContext.exprPositions[action] = statementToken.StartPosition;
                ValidateAction(parserContext, action);
            }
            else if (statementToken.TokenID == TokenID.Update)
            {
                string message;

                parserContext.NextToken(); // eat the "update"

                if (parserContext.CurrentToken.TokenID != TokenID.LParen)
                {
                    message = string.Format(CultureInfo.CurrentCulture, Messages.Parser_MissingLparenAfterCommand, "UPDATE");
                    throw new RuleSyntaxException(ErrorNumbers.Error_MissingLparenAfterCommand, message, parserContext.CurrentToken.StartPosition);
                }

                parserContext.NextToken(); // Eat the "("

                string pathString = null;

                Token updateArgToken = parserContext.CurrentToken;
                if (updateArgToken.TokenID == TokenID.StringLiteral)
                {
                    // Treat UPDATE("foo/bar") as a literal path.
                    pathString = (string)updateArgToken.Value;
                    parserContext.NextToken(); // Eat the path string.
                }
                else
                {
                    CodeExpression pathExpr = ParsePostfixExpression(parserContext, true, ValueCheck.Read);

                    RuleAnalysis analysis = new RuleAnalysis(validation, true);
                    RuleExpressionWalker.AnalyzeUsage(analysis, pathExpr, false, true, null);
                    ICollection<string> paths = analysis.GetSymbols();

                    if (paths.Count == 0 || paths.Count > 1)
                    {
                        // The expression did not modify anything, or it modified more than one.
                        throw new RuleSyntaxException(ErrorNumbers.Error_InvalidUpdateExpression, Messages.Parser_InvalidUpdateExpression, updateArgToken.StartPosition);
                    }
                    else
                    {
                        IEnumerator<string> enumerator = paths.GetEnumerator();
                        enumerator.MoveNext();
                        pathString = enumerator.Current;
                    }
                }

                if (parserContext.CurrentToken.TokenID != TokenID.RParen)
                    throw new RuleSyntaxException(ErrorNumbers.Error_MissingRParenAfterArgumentList, Messages.Parser_MissingRParenAfterArgumentList, parserContext.CurrentToken.StartPosition);

                parserContext.NextToken(); // Eat the ")"

                action = new RuleUpdateAction((string)pathString);
                parserContext.exprPositions[action] = statementToken.StartPosition;
                ValidateAction(parserContext, action);
            }
            else
            {
                // Try to parse a custom RuleAction.

                int savedTokenState = parserContext.SaveCurrentToken();

                Type type = TryParseTypeSpecifier(parserContext, false);

                if (type != null &&
                    parserContext.CurrentToken.TokenID == TokenID.LParen &&
                    TypeProvider.IsAssignable(typeof(RuleAction), type))
                {
                    // The statement started with a "type (", and the type derived from RuleAction.
                    // This is a custom rule action.

                    int lparenPosition = parserContext.CurrentToken.StartPosition;
                    parserContext.NextToken(); // Eat the '('

                    List<CodeExpression> arguments = ParseArgumentList(parserContext);

                    action = (RuleAction)ConstructCustomType(type, arguments, lparenPosition);

                    parserContext.exprPositions[action] = statementToken.StartPosition;
                    ValidateAction(parserContext, action);
                }
                else
                {
                    // It wasn't a custom action.
                    // In some cases it may have looked like one up to a point, such as:
                    //
                    //      MyType.MyMember(
                    //
                    // but "MyMember" is a static method.

                    // Reset the scanner state, and re-parse as an assignment.
                    parserContext.RestoreCurrentToken(savedTokenState);

                    CodeStatement statement = ParseAssignmentStatement(parserContext);
                    if (statement != null)
                    {
                        // Create a rule statement action around it.  No need to validate it, as
                        // the underlying CodeDom statement has been validated already.
                        action = new RuleStatementAction(statement);
                    }
                }
            }

            return action;
        }
Exemplo n.º 5
0
        public override bool Equals(object obj)
        {
            RuleStatementAction action = obj as RuleStatementAction;

            return((action != null) && CodeDomStatementWalker.Match(this.CodeDomStatement, action.CodeDomStatement));
        }
Exemplo n.º 6
0
		private static Rule CreateOfferCodeRule(TPromotionRule promotionRuleObj)
		{
			Rule offerCodeRule = new Rule("OfferCodeRule");
			offerCodeRule.ReevaluationBehavior = RuleReevaluationBehavior.Never;
			offerCodeRule.Priority = 10;

			RuleStatementAction offerCodeThenAction = new RuleStatementAction(
																			new CodeAssignStatement(new CodePropertyReferenceExpression(new CodePropertyReferenceExpression(
																			new CodeThisReferenceExpression(), "OutputObj"),"Message"),
																			new CodePrimitiveExpression("VALID"))
																		);
			RuleStatementAction offerCodeElseAction = new RuleStatementAction(
																			new CodeAssignStatement(new CodePropertyReferenceExpression(new CodePropertyReferenceExpression(
																			new CodeThisReferenceExpression(), "OutputObj"),"Message"),
																			new CodePrimitiveExpression("INVALID. Invalid offer code."))
																		);

			RuleCondition offerCodeCondition = new RuleExpressionCondition(
																			new CodeBinaryOperatorExpression(new CodePropertyReferenceExpression(new CodePropertyReferenceExpression(
																			new CodeThisReferenceExpression(), "InputObj"),"OfferCode"),
																			CodeBinaryOperatorType.ValueEquality,
																			new CodePrimitiveExpression(promotionRuleObj.OfferCode))
																		);
			offerCodeRule.Condition = offerCodeCondition;
			offerCodeRule.ThenActions.Add(offerCodeThenAction);
			offerCodeRule.ElseActions.Add(offerCodeElseAction);
			offerCodeRule.ElseActions.Add(new RuleHaltAction());

			return offerCodeRule;
		}
Exemplo n.º 7
0
		private static Rule CreateMaxDiscountLimitRule(TPromotionRule promotionRuleObj)
		{
			Rule maxDiscountLimitRule = new Rule("MaxDiscountLimitRule");
			maxDiscountLimitRule.ReevaluationBehavior = RuleReevaluationBehavior.Never;
			maxDiscountLimitRule.Priority = 20;

			RuleStatementAction maxDiscountLimitThenAction = new RuleStatementAction(
																			new CodeAssignStatement(new CodePropertyReferenceExpression(new CodePropertyReferenceExpression(
																			new CodeThisReferenceExpression(), "OutputObj"),"Discount"),
																			new CodePrimitiveExpression(promotionRuleObj.MaxDiscountAmount))
																		);

			RuleCondition maxDiscountLimitCondition = new RuleExpressionCondition(
																			new CodeBinaryOperatorExpression(
																				new CodeBinaryOperatorExpression(new CodePropertyReferenceExpression(new CodePropertyReferenceExpression(
																				new CodeThisReferenceExpression(), "OutputObj"),"Message"),
																				CodeBinaryOperatorType.ValueEquality,
																				new CodePrimitiveExpression("VALID")),
																			CodeBinaryOperatorType.BooleanAnd,
																				new CodeBinaryOperatorExpression(new CodePropertyReferenceExpression(new CodePropertyReferenceExpression(
																				new CodeThisReferenceExpression(), "OutputObj"),"Discount"),
																				CodeBinaryOperatorType.GreaterThanOrEqual,
																				new CodePrimitiveExpression(promotionRuleObj.MaxDiscountAmount)))
																		);
			maxDiscountLimitRule.Condition = maxDiscountLimitCondition;
			maxDiscountLimitRule.ThenActions.Add(maxDiscountLimitThenAction);

			return maxDiscountLimitRule;
		}
Exemplo n.º 8
0
		private static Rule CreateDiscountPercentRule(TPromotionRule promotionRuleObj)
		{
			Rule discountRule = new Rule("DiscountPercentRule");
			discountRule.ReevaluationBehavior = RuleReevaluationBehavior.Always;
			discountRule.Priority = 30;


			RuleStatementAction discountThenAction = new RuleStatementAction(
																			new CodeAssignStatement(new CodePropertyReferenceExpression(new CodePropertyReferenceExpression(
																			new CodeThisReferenceExpression(), "OutputObj"),"Discount"),
																			new CodeBinaryOperatorExpression(
																			new CodePropertyReferenceExpression(new CodePropertyReferenceExpression(
																			new CodeThisReferenceExpression(), "InputObj"),"OrderValue"),
																			CodeBinaryOperatorType.Multiply,
																			new CodePrimitiveExpression(promotionRuleObj.DiscountPercent/100))
																		));


			RuleStatementAction discountElseAction = new RuleStatementAction(
																			new CodeAssignStatement(new CodePropertyReferenceExpression(new CodePropertyReferenceExpression(
																			new CodeThisReferenceExpression(), "OutputObj"),"Discount"),
																			new CodePrimitiveExpression(0))
																		);

			RuleCondition discountCondition = new RuleExpressionCondition(
																			new CodeBinaryOperatorExpression(new CodePropertyReferenceExpression(new CodePropertyReferenceExpression(
																			new CodeThisReferenceExpression(), "OutputObj"),"Message"),
																			CodeBinaryOperatorType.ValueEquality,
																			new CodePrimitiveExpression("VALID"))
																		);
			discountRule.Condition = discountCondition;
			discountRule.ThenActions.Add(discountThenAction);
			discountRule.ElseActions.Add(discountElseAction);

			return discountRule;
		}
Exemplo n.º 9
0
        private ActionObject RuleObjectAction(RuleStatementAction action)
        {
            ActionObject actionObj = new ActionObject();

            CodeAssignStatement domDataValue = (CodeAssignStatement)action.CodeDomStatement;

            CodeFieldReferenceExpression expressionField = (CodeFieldReferenceExpression)domDataValue.Left;
            actionObj.field = expressionField.FieldName;

            CodePrimitiveExpression expressionValue = (CodePrimitiveExpression)domDataValue.Right;
            actionObj.value = expressionValue.Value.ToString();

            return actionObj;
        }
Exemplo n.º 10
0
		private static Rule CreateValidAdvanceBookingRule(TPromotionRule promotionRuleObj)
		{
			Rule validityAdvanceBookingRule = new Rule("ValidityAdvanceBookingRule");
			validityAdvanceBookingRule.ReevaluationBehavior = RuleReevaluationBehavior.Never;
			validityAdvanceBookingRule.Priority = 50;

			RuleStatementAction validityAdvanceBookingThenAction = new RuleStatementAction(
																			new CodeAssignStatement(new CodePropertyReferenceExpression(new CodePropertyReferenceExpression(
																			new CodeThisReferenceExpression(), "OutputObj"), "Message"),
																			new CodePrimitiveExpression("VALID"))
																		);

			RuleStatementAction validityAdvanceBookingElseAction = new RuleStatementAction(
																			new CodeAssignStatement(new CodePropertyReferenceExpression(new CodePropertyReferenceExpression(
																			new CodeThisReferenceExpression(), "OutputObj"), "Message"),
																			new CodePrimitiveExpression("INVALID"))
																		);

			RuleCondition validityAdvanceBookingCondition = new RuleExpressionCondition(
																			new CodeBinaryOperatorExpression(new CodePropertyReferenceExpression(new CodePropertyReferenceExpression(
																			new CodeThisReferenceExpression(), "InputObj"), "NumOfAdvanceBookingDays"),
																			CodeBinaryOperatorType.GreaterThanOrEqual,
																			new CodePrimitiveExpression(promotionRuleObj.MinNumOfAdvanceBookingDays))
																		);

			validityAdvanceBookingRule.Condition = validityAdvanceBookingCondition;
			validityAdvanceBookingRule.ThenActions.Add(validityAdvanceBookingThenAction);
			validityAdvanceBookingRule.ElseActions.Add(validityAdvanceBookingElseAction);
			validityAdvanceBookingRule.ElseActions.Add(new RuleHaltAction());

			return validityAdvanceBookingRule;
		}
Exemplo n.º 11
0
		private static Rule CreateValidBulkBookingRule(TPromotionRule promotionRuleObj)
		{
			Rule validityBulkBookingRule = new Rule("ValidityBulkBookingRule");
			validityBulkBookingRule.ReevaluationBehavior = RuleReevaluationBehavior.Never;
			validityBulkBookingRule.Priority = 55;

			RuleStatementAction validityBulkBookingThenAction = new RuleStatementAction(
																			new CodeAssignStatement(new CodePropertyReferenceExpression(new CodePropertyReferenceExpression(
																			new CodeThisReferenceExpression(), "OutputObj"), "Message"),
																			new CodePrimitiveExpression("VALID"))
																		);

			RuleStatementAction validityBulkBookingRouteElseAction = new RuleStatementAction(
																			new CodeAssignStatement(new CodePropertyReferenceExpression(new CodePropertyReferenceExpression(
																			new CodeThisReferenceExpression(), "OutputObj"), "Message"),
																			new CodePrimitiveExpression("INVALID. This offer is only applicable for bulk booking."))
																		);

			RuleCondition validityBulkBookingRouteCondition = new RuleExpressionCondition(
																			new CodeBinaryOperatorExpression(new CodePropertyReferenceExpression(new CodePropertyReferenceExpression(
																			new CodeThisReferenceExpression(), "InputObj"), "NumOfSeatsForBooking"),
																			CodeBinaryOperatorType.GreaterThanOrEqual,
																			new CodePrimitiveExpression(promotionRuleObj.MinNumOfSeats))
																		);

			validityBulkBookingRule.Condition = validityBulkBookingRouteCondition;
			validityBulkBookingRule.ThenActions.Add(validityBulkBookingThenAction);
			validityBulkBookingRule.ElseActions.Add(validityBulkBookingRouteElseAction);
			validityBulkBookingRule.ElseActions.Add(new RuleHaltAction());

			return validityBulkBookingRule;
		}
Exemplo n.º 12
0
		private static Rule CreateValidRouteRule(TPromotionRule promotionRuleObj)
		{
			Rule validityRouteRule = new Rule("ValidityRouteRule");
			validityRouteRule.ReevaluationBehavior = RuleReevaluationBehavior.Never;
			validityRouteRule.Priority = 60;

			RuleStatementAction validityRouteThenAction = new RuleStatementAction(
																			new CodeAssignStatement(new CodePropertyReferenceExpression(new CodePropertyReferenceExpression(
																			new CodeThisReferenceExpression(), "OutputObj"),"Message"),
																			new CodePrimitiveExpression("VALID"))
																		);

			RuleStatementAction validityRouteElseAction = new RuleStatementAction(
																			new CodeAssignStatement(new CodePropertyReferenceExpression(new CodePropertyReferenceExpression(
																			new CodeThisReferenceExpression(), "OutputObj"),"Message"),
																			new CodePrimitiveExpression("INVALID. This offer is not applicable for this route."))
																		);

			/*RuleCondition validityRouteCondition = new RuleExpressionCondition(
																			new CodeBinaryOperatorExpression(
																			new CodeMethodInvokeExpression(
																			new CodeThisReferenceExpression(),
																			"IsElementExistInArray",
																			new CodeExpression[] {new CodePropertyReferenceExpression(new CodePropertyReferenceExpression(
																			new CodeThisReferenceExpression(), "InputObj"),"RouteId"), 
																			new CodePrimitiveExpression(promotionRuleObj.RouteIDCSV)}),
																			CodeBinaryOperatorType.BooleanAnd,
																			new CodePrimitiveExpression(true))
																		);*/

			RuleCondition validityRouteCondition = new RuleExpressionCondition(
																				new CodeBinaryOperatorExpression(
																					new CodeMethodInvokeExpression(
																							new CodeMethodReferenceExpression(new CodeTypeReferenceExpression(typeof(BusinessObjects.TPromotion)), "IsElementExistInArray")
																						, new CodeExpression[] {	new CodePropertyReferenceExpression(	new CodePropertyReferenceExpression(new CodeThisReferenceExpression(), "InputObj"),"RouteId")
																																						, 	new CodePrimitiveExpression(promotionRuleObj.RouteIDCSV)}
																					)
																					, CodeBinaryOperatorType.BooleanAnd
																					, new CodePrimitiveExpression(true)
																				)
																			);

			validityRouteRule.Condition = validityRouteCondition;
			validityRouteRule.ThenActions.Add(validityRouteThenAction);
			validityRouteRule.ElseActions.Add(validityRouteElseAction);
			validityRouteRule.ElseActions.Add(new RuleHaltAction());

			return validityRouteRule;
		}
Exemplo n.º 13
0
		private static Rule CreateValidityEndDateRule(TPromotionRule promotionRuleObj)
		{
			Rule validityEndDateRule = new Rule("ValidityEndDateRule");
			validityEndDateRule.ReevaluationBehavior = RuleReevaluationBehavior.Never;
			validityEndDateRule.Priority = 80;

			RuleStatementAction validityEndDateThenAction = new RuleStatementAction(
																			new CodeAssignStatement(new CodePropertyReferenceExpression(new CodePropertyReferenceExpression(
																			new CodeThisReferenceExpression(), "OutputObj"),"Message"),
																			new CodePrimitiveExpression("VALID"))
																		);

			RuleStatementAction validityEndDateElseAction = new RuleStatementAction(
																			new CodeAssignStatement(new CodePropertyReferenceExpression(new CodePropertyReferenceExpression(
																			new CodeThisReferenceExpression(), "OutputObj"),"Message"),
																			new CodePrimitiveExpression("INVALID"))
																		);

			RuleCondition validityEndDateCondition = new RuleExpressionCondition(
																			new CodeBinaryOperatorExpression(new CodePropertyReferenceExpression(new CodePropertyReferenceExpression(
																			new CodeThisReferenceExpression(), "InputObj"),"DOJ"),
																			CodeBinaryOperatorType.LessThan,
																			new CodePrimitiveExpression(promotionRuleObj.ValidityEndDate))
																		);
			validityEndDateRule.Condition = validityEndDateCondition;
			validityEndDateRule.ThenActions.Add(validityEndDateThenAction);
			validityEndDateRule.ElseActions.Add(validityEndDateElseAction);
			validityEndDateRule.ElseActions.Add(new RuleHaltAction());

			return validityEndDateRule;
		}
Exemplo n.º 14
0
		private static Rule CreateMinTicketFareRule(TPromotionRule promotionRuleObj)
		{
			Rule minTktFareRule = new Rule("MinTicketFareRule");
			minTktFareRule.ReevaluationBehavior = RuleReevaluationBehavior.Never;
			minTktFareRule.Priority = 100;

			RuleStatementAction minTktFareThenAction = new RuleStatementAction(
																			new CodeAssignStatement(new CodePropertyReferenceExpression(new CodePropertyReferenceExpression(
																			new CodeThisReferenceExpression(), "OutputObj"),"Message"),
																			new CodePrimitiveExpression("VALID"))
																		);
			RuleStatementAction minTktFareElseAction = new RuleStatementAction(
																			new CodeAssignStatement(new CodePropertyReferenceExpression(new CodePropertyReferenceExpression(
																			new CodeThisReferenceExpression(), "OutputObj"),"Message"),
																			new CodePrimitiveExpression("INVALID. Fare should be greater than" + promotionRuleObj.MinTicketFare))
																		);

			RuleCondition minTktFareCondition = new RuleExpressionCondition(
																			new CodeBinaryOperatorExpression(new CodePropertyReferenceExpression(new CodePropertyReferenceExpression(
																			new CodeThisReferenceExpression(), "InputObj"),"OrderValue"),
																			CodeBinaryOperatorType.GreaterThanOrEqual,
																			new CodePrimitiveExpression(promotionRuleObj.MinTicketFare))
																		);
			minTktFareRule.Condition = minTktFareCondition;
			minTktFareRule.ThenActions.Add(minTktFareThenAction);
			minTktFareRule.ElseActions.Add(minTktFareElseAction);
			minTktFareRule.ElseActions.Add(new RuleHaltAction());

			return minTktFareRule;
		}
Exemplo n.º 15
0
        private Rule SetUpRule(Rule rule, RuleStatementAction action, RuleObject ruleObj)
        {
            Rule thisRule = rule.Clone();
            thisRule.ThenActions.Clear();
            thisRule.ElseActions.Clear();

            thisRule.Name = ruleObj.Name;

            thisRule.Condition = SetRuleCondition((RuleExpressionCondition)thisRule.Condition, ruleObj.Condition);

            foreach (ActionObject actionObj in ruleObj.ThenActions)
            {
                RuleStatementAction thisAction = (RuleStatementAction)action.Clone();
                thisAction = SetRuleAction(thisAction, actionObj);
                thisRule.ThenActions.Add(thisAction);
            }

            foreach (ActionObject actionObj in ruleObj.ElseActions)
            {
                RuleStatementAction thisAction = (RuleStatementAction)action.Clone();
                thisAction = SetRuleAction(thisAction, actionObj);
                thisRule.ElseActions.Add(thisAction);
            }

            return thisRule;
        }
Exemplo n.º 16
0
        private RuleStatementAction SetRuleAction(RuleStatementAction action, ActionObject actionObj)
        {
            CodeAssignStatement domDataValue = (CodeAssignStatement)action.CodeDomStatement;

            CodePropertyReferenceExpression expressionField = (CodePropertyReferenceExpression)domDataValue.Left;
            expressionField.PropertyName = actionObj.field;

            CodePrimitiveExpression expressionValue = (CodePrimitiveExpression)domDataValue.Right;
            expressionValue.Value = actionObj.value;

            return action;
        }
Exemplo n.º 17
0
		private static Rule CreateValidLastMinBookingRule(TPromotionRule promotionRuleObj)
		{
			Rule validityLastMinBookingRule = new Rule("ValidityLastMinBookingRule");
			validityLastMinBookingRule.ReevaluationBehavior = RuleReevaluationBehavior.Never;
			validityLastMinBookingRule.Priority = 45;

			RuleStatementAction validityLastMinBookingThenAction = new RuleStatementAction(
																			new CodeAssignStatement(new CodePropertyReferenceExpression(new CodePropertyReferenceExpression(
																			new CodeThisReferenceExpression(), "OutputObj"), "Message"),
																			new CodePrimitiveExpression("VALID"))
																		);

			RuleStatementAction validityLastMinBookingElseAction = new RuleStatementAction(
																			new CodeAssignStatement(new CodePropertyReferenceExpression(new CodePropertyReferenceExpression(
																			new CodeThisReferenceExpression(), "OutputObj"), "Message"),
																			new CodePrimitiveExpression("INVALID"))
																		);

			RuleCondition validityLastMinBookingCondition = new RuleExpressionCondition(
																			new CodeBinaryOperatorExpression(new CodePropertyReferenceExpression(new CodePropertyReferenceExpression(
																			new CodeThisReferenceExpression(), "InputObj"), "MinuteCountBeforeDept"),
																			CodeBinaryOperatorType.LessThanOrEqual,
																			new CodePrimitiveExpression(promotionRuleObj.LastMinuteCountBeforeDept))
																		);

			validityLastMinBookingRule.Condition = validityLastMinBookingCondition;
			validityLastMinBookingRule.ThenActions.Add(validityLastMinBookingThenAction);
			validityLastMinBookingRule.ElseActions.Add(validityLastMinBookingElseAction);
			validityLastMinBookingRule.ElseActions.Add(new RuleHaltAction());

			return validityLastMinBookingRule;
		}
 private RuleAction ParseStatement(ParserContext parserContext)
 {
     RuleAction action = null;
     Token currentToken = parserContext.CurrentToken;
     if (currentToken.TokenID == TokenID.Halt)
     {
         parserContext.NextToken();
         action = new RuleHaltAction();
         parserContext.exprPositions[action] = currentToken.StartPosition;
         this.ValidateAction(parserContext, action);
         return action;
     }
     if (currentToken.TokenID == TokenID.Update)
     {
         parserContext.NextToken();
         if (parserContext.CurrentToken.TokenID != TokenID.LParen)
         {
             string message = string.Format(CultureInfo.CurrentCulture, Messages.Parser_MissingLparenAfterCommand, new object[] { "UPDATE" });
             throw new RuleSyntaxException(0x180, message, parserContext.CurrentToken.StartPosition);
         }
         parserContext.NextToken();
         string path = null;
         Token token2 = parserContext.CurrentToken;
         if (token2.TokenID == TokenID.StringLiteral)
         {
             path = (string) token2.Value;
             parserContext.NextToken();
         }
         else
         {
             CodeExpression expression = this.ParsePostfixExpression(parserContext, true, ValueCheck.Read);
             RuleAnalysis analysis = new RuleAnalysis(this.validation, true);
             RuleExpressionWalker.AnalyzeUsage(analysis, expression, false, true, null);
             ICollection<string> symbols = analysis.GetSymbols();
             if ((symbols.Count == 0) || (symbols.Count > 1))
             {
                 throw new RuleSyntaxException(0x181, Messages.Parser_InvalidUpdateExpression, token2.StartPosition);
             }
             IEnumerator<string> enumerator = symbols.GetEnumerator();
             enumerator.MoveNext();
             path = enumerator.Current;
         }
         if (parserContext.CurrentToken.TokenID != TokenID.RParen)
         {
             throw new RuleSyntaxException(0x182, Messages.Parser_MissingRParenAfterArgumentList, parserContext.CurrentToken.StartPosition);
         }
         parserContext.NextToken();
         action = new RuleUpdateAction(path);
         parserContext.exprPositions[action] = currentToken.StartPosition;
         this.ValidateAction(parserContext, action);
         return action;
     }
     int tokenValue = parserContext.SaveCurrentToken();
     Type fromType = this.TryParseTypeSpecifier(parserContext, false);
     if (((fromType != null) && (parserContext.CurrentToken.TokenID == TokenID.LParen)) && TypeProvider.IsAssignable(typeof(RuleAction), fromType))
     {
         int startPosition = parserContext.CurrentToken.StartPosition;
         parserContext.NextToken();
         List<CodeExpression> arguments = this.ParseArgumentList(parserContext);
         action = (RuleAction) this.ConstructCustomType(fromType, arguments, startPosition);
         parserContext.exprPositions[action] = currentToken.StartPosition;
         this.ValidateAction(parserContext, action);
         return action;
     }
     parserContext.RestoreCurrentToken(tokenValue);
     CodeStatement codeDomStatement = this.ParseAssignmentStatement(parserContext);
     if (codeDomStatement != null)
     {
         action = new RuleStatementAction(codeDomStatement);
     }
     return action;
 }