protected void ThrowCompileException(string messageKey, CompileExceptionReason reason, params object[] arguments)
        {
            string messageTemplate = FleeResourceManager.Instance.GetCompileErrorString(messageKey);
            string message         = string.Format(messageTemplate, arguments);

            throw new ExpressionCompileException(message, reason);
        }
Example #2
0
		protected void ThrowCompileException(string messageKey, CompileExceptionReason reason, params object[] arguments)
		{
			var messageTemplate = FleeResourceManager.Instance.GetCompileErrorString(messageKey);
			var message = string.Format(messageTemplate, arguments);
			message = string.Concat(this.Name, ": ", message);
			throw new ExpressionCompileException(message, reason);
		}
Example #3
0
 protected void AssertCompileException(string expression, ExpressionContext context,
                                       CompileExceptionReason expectedReason = (CompileExceptionReason)(-1))
 {
     try
     {
         this.CreateDynamicExpression(expression, context);
         Assert.Fail("Compile exception expected");
     }
     catch (ExpressionCompileException expressionCompileException)
     {
         var ex   = expressionCompileException;
         var flag = expectedReason != (CompileExceptionReason)(-1);
         if (flag)
         {
             Assert.AreEqual((int)expectedReason, (int)ex.Reason,
                             string.Format("Expected reason '{0}' but got '{1}'", expectedReason, ex.Reason));
         }
     }
 }
Example #4
0
 private ExpressionCompileException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : base(info, context)
 {
     _myReason = (CompileExceptionReason)info.GetInt32("Reason");
 }
Example #5
0
 internal ExpressionCompileException(ParserLogException parseException) : base(string.Empty, parseException)
 {
     _myReason = CompileExceptionReason.SyntaxError;
 }
Example #6
0
 internal ExpressionCompileException(string message, CompileExceptionReason reason) : base(message)
 {
     _myReason = reason;
 }
Example #7
0
 internal ExpressionCompileException(string message, CompileExceptionReason reason, object[] arguments) : base(message)
 {
     Arguments = arguments;
     _myReason = reason;
 }
Example #8
0
		private ExpressionCompileException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : base(info, context)
		{
			MyReason = (CompileExceptionReason)info.GetInt32("Reason");
		}
Example #9
0
		internal ExpressionCompileException(PerCederberg.Grammatica.Runtime.ParserLogException parseException) : base(string.Empty, parseException)
		{
			MyReason = CompileExceptionReason.SyntaxError;
		}
Example #10
0
		internal ExpressionCompileException(string message, CompileExceptionReason reason) : base(message)
		{
			MyReason = reason;
		}
Example #11
0
        protected ExpressionCompileException CreateCompileException(string messageTemplate, CompileExceptionReason reason, params object[] arguments)
        {
            var message = string.Format(CultureInfo.InvariantCulture, messageTemplate, arguments);

            message = string.Concat(Name, ": ", message);
            return(new ExpressionCompileException(message, reason));
        }