diff --git a/src/DynamicExpresso.Core/DynamicExpresso.Core.csproj b/src/DynamicExpresso.Core/DynamicExpresso.Core.csproj index 29140fc..4382d88 100644 --- a/src/DynamicExpresso.Core/DynamicExpresso.Core.csproj +++ b/src/DynamicExpresso.Core/DynamicExpresso.Core.csproj @@ -24,4 +24,19 @@ + + + ResXFileCodeGenerator + ErrorMessages.Designer.cs + + + + + + True + True + ErrorMessages.resx + + + diff --git a/src/DynamicExpresso.Core/Exceptions/AssignmentOperatorDisabledException.cs b/src/DynamicExpresso.Core/Exceptions/AssignmentOperatorDisabledException.cs index e13fdbe..f069690 100644 --- a/src/DynamicExpresso.Core/Exceptions/AssignmentOperatorDisabledException.cs +++ b/src/DynamicExpresso.Core/Exceptions/AssignmentOperatorDisabledException.cs @@ -1,5 +1,6 @@ using System; using System.Runtime.Serialization; +using DynamicExpresso.Resources; namespace DynamicExpresso.Exceptions { @@ -7,7 +8,7 @@ namespace DynamicExpresso.Exceptions public class AssignmentOperatorDisabledException : ParseException { public AssignmentOperatorDisabledException(string operatorString, int position) - : base(string.Format("Assignment operator '{0}' not allowed", operatorString), position) + : base(string.Format(ErrorMessages.AssignmentOperatorNotAllowed, operatorString), position) { OperatorString = operatorString; } diff --git a/src/DynamicExpresso.Core/Exceptions/DuplicateParameterException.cs b/src/DynamicExpresso.Core/Exceptions/DuplicateParameterException.cs index 765545a..d5a49d2 100644 --- a/src/DynamicExpresso.Core/Exceptions/DuplicateParameterException.cs +++ b/src/DynamicExpresso.Core/Exceptions/DuplicateParameterException.cs @@ -1,5 +1,6 @@ using System; using System.Runtime.Serialization; +using DynamicExpresso.Resources; namespace DynamicExpresso.Exceptions { @@ -7,7 +8,7 @@ namespace DynamicExpresso.Exceptions public class DuplicateParameterException : DynamicExpressoException { public DuplicateParameterException(string identifier) - : base(string.Format("The parameter '{0}' was defined more than once", identifier)) + : base(string.Format(ErrorMessages.DuplicateParameter, identifier)) { Identifier = identifier; } diff --git a/src/DynamicExpresso.Core/Exceptions/NoApplicableMethodException.cs b/src/DynamicExpresso.Core/Exceptions/NoApplicableMethodException.cs index 2925542..4298d69 100644 --- a/src/DynamicExpresso.Core/Exceptions/NoApplicableMethodException.cs +++ b/src/DynamicExpresso.Core/Exceptions/NoApplicableMethodException.cs @@ -1,5 +1,6 @@ using System; using System.Runtime.Serialization; +using DynamicExpresso.Resources; namespace DynamicExpresso.Exceptions { @@ -7,7 +8,7 @@ namespace DynamicExpresso.Exceptions public class NoApplicableMethodException : ParseException { public NoApplicableMethodException(string methodName, string methodTypeName, int position) - : base(string.Format("No applicable method '{0}' exists in type '{1}'", methodName, methodTypeName), position) + : base(string.Format(ErrorMessages.InvalidMethodCall2, methodName, methodTypeName), position) { MethodTypeName = methodTypeName; MethodName = methodName; diff --git a/src/DynamicExpresso.Core/Exceptions/ReflectionNotAllowedException.cs b/src/DynamicExpresso.Core/Exceptions/ReflectionNotAllowedException.cs index a8b5508..9604c3e 100644 --- a/src/DynamicExpresso.Core/Exceptions/ReflectionNotAllowedException.cs +++ b/src/DynamicExpresso.Core/Exceptions/ReflectionNotAllowedException.cs @@ -1,5 +1,6 @@ using System; using System.Runtime.Serialization; +using DynamicExpresso.Resources; namespace DynamicExpresso.Exceptions { @@ -7,7 +8,7 @@ namespace DynamicExpresso.Exceptions public class ReflectionNotAllowedException : ParseException { public ReflectionNotAllowedException() - : base("Reflection expression not allowed. To enable reflection use Interpreter.EnableReflection().", 0) + : base(ErrorMessages.ReflectionNotAllowed, 0) { } diff --git a/src/DynamicExpresso.Core/Exceptions/UnknownIdentifierException.cs b/src/DynamicExpresso.Core/Exceptions/UnknownIdentifierException.cs index dab591f..6591e4c 100644 --- a/src/DynamicExpresso.Core/Exceptions/UnknownIdentifierException.cs +++ b/src/DynamicExpresso.Core/Exceptions/UnknownIdentifierException.cs @@ -1,5 +1,6 @@ using System; using System.Runtime.Serialization; +using DynamicExpresso.Resources; namespace DynamicExpresso.Exceptions { @@ -7,7 +8,7 @@ namespace DynamicExpresso.Exceptions public class UnknownIdentifierException : ParseException { public UnknownIdentifierException(string identifier, int position) - : base(string.Format("Unknown identifier '{0}'", identifier), position) + : base(string.Format(ErrorMessages.UnknownIdentifier, identifier), position) { Identifier = identifier; } diff --git a/src/DynamicExpresso.Core/Interpreter.cs b/src/DynamicExpresso.Core/Interpreter.cs index 74c81ce..4a8b05e 100644 --- a/src/DynamicExpresso.Core/Interpreter.cs +++ b/src/DynamicExpresso.Core/Interpreter.cs @@ -6,6 +6,7 @@ using System.Linq; using System.Linq.Expressions; using DynamicExpresso.Exceptions; +using DynamicExpresso.Resources; namespace DynamicExpresso { @@ -134,7 +135,7 @@ public Interpreter SetDefaultNumberType(DefaultNumberType defaultNumberType) } /// - /// Allows to enable/disable assignment operators. + /// Allows to enable/disable assignment operators. /// For security when expression are generated by the users is more safe to disable assignment operators. /// /// @@ -278,7 +279,7 @@ public Interpreter SetIdentifier(Identifier identifier) throw new ArgumentNullException(nameof(identifier)); if (LanguageConstants.ReservedKeywords.Contains(identifier.Name)) - throw new InvalidOperationException($"{identifier.Name} is a reserved word"); + throw new InvalidOperationException(string.Format(ErrorMessages.ReservedWord, identifier.Name)); _settings.Identifiers[identifier.Name] = identifier; diff --git a/src/DynamicExpresso.Core/Lambda.cs b/src/DynamicExpresso.Core/Lambda.cs index 707f51d..23b8f91 100644 --- a/src/DynamicExpresso.Core/Lambda.cs +++ b/src/DynamicExpresso.Core/Lambda.cs @@ -5,6 +5,7 @@ using System.Reflection; using System.Runtime.ExceptionServices; using DynamicExpresso.Reflection; +using DynamicExpresso.Resources; namespace DynamicExpresso { @@ -87,7 +88,7 @@ public object Invoke(params object[] args) if (args != null) { if (declaredParameters.Length != args.Length) - throw new InvalidOperationException("Arguments count mismatch."); + throw new InvalidOperationException(ErrorMessages.ArgumentCountMismatch); for (var i = 0; i < args.Length; i++) { diff --git a/src/DynamicExpresso.Core/Parsing/InterpreterExpression.cs b/src/DynamicExpresso.Core/Parsing/InterpreterExpression.cs index 75d5dfb..1dc98a9 100644 --- a/src/DynamicExpresso.Core/Parsing/InterpreterExpression.cs +++ b/src/DynamicExpresso.Core/Parsing/InterpreterExpression.cs @@ -4,6 +4,7 @@ using System.Linq.Expressions; using DynamicExpresso.Exceptions; using DynamicExpresso.Reflection; +using DynamicExpresso.Resources; namespace DynamicExpresso.Parsing { @@ -35,7 +36,7 @@ public InterpreterExpression(ParserArguments parserArguments, string expressionT { if (settings.Identifiers.ContainsKey(myParameter.Name)) { - throw new ParseException($"A local or parameter named '{myParameter.Name}' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter", myParameter.Position); + throw new ParseException(string.Format(ErrorMessages.DuplicateLocalParameterDeclaration, myParameter.Name), myParameter.Position); } } diff --git a/src/DynamicExpresso.Core/Parsing/Parser.cs b/src/DynamicExpresso.Core/Parsing/Parser.cs index 5118524..eb61acd 100644 --- a/src/DynamicExpresso.Core/Parsing/Parser.cs +++ b/src/DynamicExpresso.Core/Parsing/Parser.cs @@ -175,7 +175,7 @@ private ParameterWithPosition[] ParseLambdaParameterList() } if (!hasOpenParen && parameters.Length > 1) - throw new ParseException("Multiple lambda parameters detected, but with no surrounding parenthesis", _parsePosition); + throw new ParseException(ErrorMessages.MultipleLambdaParametersWithoutBrace, _parsePosition); return parameters; } @@ -508,7 +508,7 @@ public bool IsShiftOperator(out ExpressionType shiftType) // << could be a token, but is not for symmetry else if (_token.id == TokenId.LessThan && _parseChar == '<') { - NextToken(); // consume next < + NextToken(); // consume next < shiftType = ExpressionType.LeftShift; return true; } @@ -1397,7 +1397,7 @@ private Type ParseKnownType() private bool TryParseKnownType(string name, out Type type) { - // if the type is unknown, we need to restart parsing + // if the type is unknown, we need to restart parsing var originalPos = _token.pos; // the name might reference a generic type, with an aliased name (e.g. List = MyList instead of List`1) @@ -1433,7 +1433,7 @@ private Type ParseKnownGenericType(string name, Type type) return null; if (rank != type.GetGenericArguments().Length) - throw new ArgumentException($"The number of generic arguments provided doesn't equal the arity of the generic type definition."); + throw new ArgumentException(ErrorMessages.GenericArgumentCountMismatch); // there are actual type arguments: instantiate the proper generic type if (typeArguments.All(_ => _ != null)) @@ -1959,7 +1959,7 @@ private Expression GenerateGreaterThan(Expression left, Expression right) return GenerateBinary(ExpressionType.GreaterThan, left, right); } - + private Expression GenerateGreaterThanEqual(Expression left, Expression right) { @@ -2533,7 +2533,7 @@ private void NextToken() if (_parsePosition == _expressionTextLength) { if (_token.id == TokenId.End) - throw new InvalidOperationException("NextToken called when already at the end of the expression"); + throw new InvalidOperationException(ErrorMessages.NextTokenAtEnd); t = TokenId.End; break; diff --git a/src/DynamicExpresso.Core/ReferenceType.cs b/src/DynamicExpresso.Core/ReferenceType.cs index 5019b75..f166421 100644 --- a/src/DynamicExpresso.Core/ReferenceType.cs +++ b/src/DynamicExpresso.Core/ReferenceType.cs @@ -3,6 +3,7 @@ using System.Linq; using System.Reflection; using DynamicExpresso.Reflection; +using DynamicExpresso.Resources; namespace DynamicExpresso { @@ -30,7 +31,7 @@ public ReferenceType(string name, Type type) var genericType = type.GetGenericTypeDefinition(); var genericTypeName = genericType.Name.Substring(0, genericType.Name.IndexOf('`')); genericTypeName += $"<{new string(',', genericType.GetGenericArguments().Length - 1)}>"; - throw new ArgumentException($"Generic type must be referenced via its generic definition: {genericTypeName}"); + throw new ArgumentException(string.Format(ErrorMessages.GenericTypeReference, genericTypeName)); } Type = type; diff --git a/src/DynamicExpresso.Core/Resources/ErrorMessages.Designer.cs b/src/DynamicExpresso.Core/Resources/ErrorMessages.Designer.cs index 7e0643d..d85515b 100644 --- a/src/DynamicExpresso.Core/Resources/ErrorMessages.Designer.cs +++ b/src/DynamicExpresso.Core/Resources/ErrorMessages.Designer.cs @@ -1,7 +1,6 @@ -//------------------------------------------------------------------------------ +//------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.30319.42000 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -12,552 +11,428 @@ namespace DynamicExpresso.Resources { using System; - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [System.Diagnostics.DebuggerNonUserCodeAttribute()] + [System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class ErrorMessages { - private static global::System.Resources.ResourceManager resourceMan; + private static System.Resources.ResourceManager resourceMan; - private static global::System.Globalization.CultureInfo resourceCulture; + private static System.Globalization.CultureInfo resourceCulture; - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] internal ErrorMessages() { } - - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { - get { - if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("DynamicExpresso.Resources.ErrorMessages", typeof(ErrorMessages).Assembly); + + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)] + internal static System.Resources.ResourceManager ResourceManager { + get { + if (object.Equals(null, resourceMan)) { + System.Resources.ResourceManager temp = new System.Resources.ResourceManager("DynamicExpresso.Resources.ErrorMessages", typeof(ErrorMessages).Assembly); resourceMan = temp; } return resourceMan; } } - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)] + internal static System.Globalization.CultureInfo Culture { get { return resourceCulture; } set { resourceCulture = value; } - } - - /// - /// Looks up a localized string similar to Ambiguous invocation of indexer in type '{0}'. - /// - internal static string AmbiguousIndexerInvocation { + } + + internal static string AmbiguousIndexerInvocation { get { return ResourceManager.GetString("AmbiguousIndexerInvocation", resourceCulture); } } - /// - /// Looks up a localized string similar to Ambiguous invocation of method '{0}' in type '{1}'. - /// internal static string AmbiguousMethodInvocation { get { return ResourceManager.GetString("AmbiguousMethodInvocation", resourceCulture); } } - - /// - /// Looks up a localized string similar to Ambiguous invocation of user defined operator '{0}' in type '{1}'. - /// - internal static string AmbiguousUnaryOperatorInvocation - { - get - { - return ResourceManager.GetString("AmbiguousUnaryOperatorInvocation", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Ambiguous invocation of user defined operator '{0}' in types '{1}' and '{2}'. - /// - internal static string AmbiguousBinaryOperatorInvocation - { - get - { - return ResourceManager.GetString("AmbiguousBinaryOperatorInvocation", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Ambiguous invocation of delegate (multiple overloads found). - /// - internal static string AmbiguousDelegateInvocation - { - get - { - return ResourceManager.GetString("AmbiguousDelegateInvocation", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Argument list incompatible with delegate expression. - /// + internal static string ArgsIncompatibleWithDelegate { get { return ResourceManager.GetString("ArgsIncompatibleWithDelegate", resourceCulture); } } - /// - /// Looks up a localized string similar to Argument list incompatible with lambda expression. - /// internal static string ArgsIncompatibleWithLambda { get { return ResourceManager.GetString("ArgsIncompatibleWithLambda", resourceCulture); } } - /// - /// Looks up a localized string similar to Both of the types '{0}' and '{1}' convert to the other. - /// internal static string BothTypesConvertToOther { get { return ResourceManager.GetString("BothTypesConvertToOther", resourceCulture); } } - /// - /// Looks up a localized string similar to A value of type '{0}' cannot be converted to type '{1}'. - /// internal static string CannotConvertValue { get { return ResourceManager.GetString("CannotConvertValue", resourceCulture); } } - /// - /// Looks up a localized string similar to ']' or ',' expected. - /// internal static string CloseBracketOrCommaExpected { get { return ResourceManager.GetString("CloseBracketOrCommaExpected", resourceCulture); } } - /// - /// Looks up a localized string similar to ')' or ',' expected. - /// internal static string CloseParenOrCommaExpected { get { return ResourceManager.GetString("CloseParenOrCommaExpected", resourceCulture); } } - /// - /// Looks up a localized string similar to ')' or operator expected. - /// internal static string CloseParenOrOperatorExpected { get { return ResourceManager.GetString("CloseParenOrOperatorExpected", resourceCulture); } } - - /// - /// Looks up a localized string similar to '=' expected. - /// - internal static string EqualExpected - { - get - { - return ResourceManager.GetString("EqualExpected", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to ':' expected. - /// + internal static string ColonExpected { get { return ResourceManager.GetString("ColonExpected", resourceCulture); } } - /// - /// Looks up a localized string similar to Digit expected. - /// internal static string DigitExpected { get { return ResourceManager.GetString("DigitExpected", resourceCulture); } } - /// - /// Looks up a localized string similar to '.' or '(' expected. - /// internal static string DotOrOpenParenExpected { get { return ResourceManager.GetString("DotOrOpenParenExpected", resourceCulture); } } - /// - /// Looks up a localized string similar to Expression expected. - /// internal static string ExpressionExpected { get { return ResourceManager.GetString("ExpressionExpected", resourceCulture); } } - /// - /// Looks up a localized string similar to Expression must be writable. - /// internal static string ExpressionMustBeWritable { get { return ResourceManager.GetString("ExpressionMustBeWritable", resourceCulture); } } - /// - /// Looks up a localized string similar to The first expression must be of type 'Boolean'. - /// internal static string FirstExprMustBeBool { get { return ResourceManager.GetString("FirstExprMustBeBool", resourceCulture); } } - /// - /// Looks up a localized string similar to {0} (at index {1}).. - /// internal static string Format { get { return ResourceManager.GetString("Format", resourceCulture); } } - /// - /// Looks up a localized string similar to Identifier expected. - /// internal static string IdentifierExpected { get { return ResourceManager.GetString("IdentifierExpected", resourceCulture); } } - /// - /// Looks up a localized string similar to Operator '{0}' incompatible with operand type '{1}'. - /// internal static string IncompatibleOperand { get { return ResourceManager.GetString("IncompatibleOperand", resourceCulture); } } - /// - /// Looks up a localized string similar to Operator '{0}' incompatible with operand types '{1}' and '{2}'. - /// internal static string IncompatibleOperands { get { return ResourceManager.GetString("IncompatibleOperands", resourceCulture); } } - /// - /// Looks up a localized string similar to Incorrect number of indexes. - /// internal static string IncorrectNumberOfIndexes { get { return ResourceManager.GetString("IncorrectNumberOfIndexes", resourceCulture); } } - /// - /// Looks up a localized string similar to Syntax error '{0}'. - /// internal static string InvalidCharacter { get { return ResourceManager.GetString("InvalidCharacter", resourceCulture); } } - /// - /// Looks up a localized string similar to Character literal must contain exactly one character. - /// internal static string InvalidCharacterLiteral { get { return ResourceManager.GetString("InvalidCharacterLiteral", resourceCulture); } } - /// - /// Looks up a localized string similar to Invalid character escape sequence. - /// internal static string InvalidEscapeSequence { get { return ResourceManager.GetString("InvalidEscapeSequence", resourceCulture); } } - /// - /// Looks up a localized string similar to Array index must be an integer expression. - /// internal static string InvalidIndex { get { return ResourceManager.GetString("InvalidIndex", resourceCulture); } } - /// - /// Looks up a localized string similar to Invalid integer literal '{0}'. - /// internal static string InvalidIntegerLiteral { get { return ResourceManager.GetString("InvalidIntegerLiteral", resourceCulture); } } - /// - /// Looks up a localized string similar to No applicable method exists in type '{0}'. - /// internal static string InvalidMethodCall { get { return ResourceManager.GetString("InvalidMethodCall", resourceCulture); } } - - /// - /// Looks up a localized string similar to Params array type is not an array, element not found - /// - internal static string ParamsArrayTypeNotAnArray - { - get - { - return ResourceManager.GetString("ParamsArrayTypeNotAnArray", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to The type arguments for method '{0}' cannot be inferred from the usage. - /// - internal static string MethodTypeParametersCantBeInferred - { - get - { - return ResourceManager.GetString("MethodTypeParametersCantBeInferred", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Invalid real literal '{0}'. - /// - internal static string InvalidRealLiteral { + + internal static string InvalidRealLiteral { get { return ResourceManager.GetString("InvalidRealLiteral", resourceCulture); } } - /// - /// Looks up a localized string similar to Neither of the types '{0}' and '{1}' converts to the other. - /// internal static string NeitherTypeConvertsToOther { get { return ResourceManager.GetString("NeitherTypeConvertsToOther", resourceCulture); } } - /// - /// Looks up a localized string similar to No applicable constructor exists in type '{0}'. - /// internal static string NoApplicableConstructor { get { return ResourceManager.GetString("NoApplicableConstructor", resourceCulture); } - } - - /// - /// Looks up a localized string similar to Ambiguous invocation of constructor in type '{0}'. - /// - internal static string AmbiguousConstructorInvocation - { - get - { - return ResourceManager.GetString("AmbiguousConstructorInvocation", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to No applicable indexer exists in type '{0}'. - /// - internal static string NoApplicableIndexer { + } + + internal static string NoApplicableIndexer { get { return ResourceManager.GetString("NoApplicableIndexer", resourceCulture); } } - /// - /// Looks up a localized string similar to '(' expected. - /// internal static string OpenParenExpected { get { return ResourceManager.GetString("OpenParenExpected", resourceCulture); } } - - /// - /// Looks up a localized string similar to '{' expected. - /// - internal static string OpenCurlyBracketExpected - { - get - { - return ResourceManager.GetString("OpenCurlyBracketExpected", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to '}' expected. - /// - internal static string CloseCurlyBracketExpected - { - get - { - return ResourceManager.GetString("CloseCurlyBracketExpected", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to '>' expected. - /// - internal static string CloseTypeArgumentListExpected - { - get - { - return ResourceManager.GetString("CloseTypeArgumentListExpected", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Syntax error. - /// + internal static string SyntaxError { get { return ResourceManager.GetString("SyntaxError", resourceCulture); } } - /// - /// Looks up a localized string similar to Type '{0}' has no nullable form. - /// internal static string TypeHasNoNullableForm { get { return ResourceManager.GetString("TypeHasNoNullableForm", resourceCulture); } } - /// - /// Looks up a localized string similar to Type identifier expected. - /// internal static string TypeIdentifierExpected { get { return ResourceManager.GetString("TypeIdentifierExpected", resourceCulture); } } - /// - /// Looks up a localized string similar to The 'typeof' keyword requires a type as an argument. - /// internal static string TypeofRequiresAType { get { return ResourceManager.GetString("TypeofRequiresAType", resourceCulture); } } - /// - /// Looks up a localized string similar to The 'typeof' keyword requires 1 argument. - /// internal static string TypeofRequiresOneArg { get { return ResourceManager.GetString("TypeofRequiresOneArg", resourceCulture); } } - /// - /// Looks up a localized string similar to No property or field '{0}' exists in type '{1}'. - /// internal static string UnknownPropertyOrField { get { return ResourceManager.GetString("UnknownPropertyOrField", resourceCulture); } } - /// - /// Looks up a localized string similar to Unterminated string literal. - /// internal static string UnterminatedStringLiteral { get { return ResourceManager.GetString("UnterminatedStringLiteral", resourceCulture); } } - - /// - /// Looks up a localized string similar to Unterminated string literal. - /// + internal static string InvalidOperation { get { return ResourceManager.GetString("InvalidOperation", resourceCulture); } } - - /// - /// Looks up a localized string similar to Multidimensional arrays are not supported. - /// - internal static string UnsupportedMultidimensionalArrays - { - get - { - return ResourceManager.GetString("UnsupportedMultidimensionalArrays", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Invalid initializer member declarator. - /// - internal static string InvalidInitializerMemberDeclarator { - get { - return ResourceManager.GetString("InvalidInitializerMemberDeclarator", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Cannot initialize type '{0}' with a collection initializer because it does not implement '{1}'. - /// - internal static string CollectionInitializationNotSupported { - get { - return ResourceManager.GetString("CollectionInitializationNotSupported", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to The best overloaded Add method '{0}.Add' for the collection initializer has some invalid arguments. - /// - internal static string UnableToFindAppropriateAddMethod { - get { - return ResourceManager.GetString("UnableToFindAppropriateAddMethod", resourceCulture); - } - } - - } + + internal static string AmbiguousBinaryOperatorInvocation { + get { + return ResourceManager.GetString("AmbiguousBinaryOperatorInvocation", resourceCulture); + } + } + + internal static string AmbiguousUnaryOperatorInvocation { + get { + return ResourceManager.GetString("AmbiguousUnaryOperatorInvocation", resourceCulture); + } + } + + internal static string AmbiguousDelegateInvocation { + get { + return ResourceManager.GetString("AmbiguousDelegateInvocation", resourceCulture); + } + } + + internal static string CloseCurlyBracketExpected { + get { + return ResourceManager.GetString("CloseCurlyBracketExpected", resourceCulture); + } + } + + internal static string OpenCurlyBracketExpected { + get { + return ResourceManager.GetString("OpenCurlyBracketExpected", resourceCulture); + } + } + + internal static string EqualExpected { + get { + return ResourceManager.GetString("EqualExpected", resourceCulture); + } + } + + internal static string CloseTypeArgumentListExpected { + get { + return ResourceManager.GetString("CloseTypeArgumentListExpected", resourceCulture); + } + } + + internal static string MethodTypeParametersCantBeInferred { + get { + return ResourceManager.GetString("MethodTypeParametersCantBeInferred", resourceCulture); + } + } + + internal static string ParamsArrayTypeNotAnArray { + get { + return ResourceManager.GetString("ParamsArrayTypeNotAnArray", resourceCulture); + } + } + + internal static string AmbiguousConstructorInvocation { + get { + return ResourceManager.GetString("AmbiguousConstructorInvocation", resourceCulture); + } + } + + internal static string UnsupportedMultidimensionalArrays { + get { + return ResourceManager.GetString("UnsupportedMultidimensionalArrays", resourceCulture); + } + } + + internal static string InvalidInitializerMemberDeclarator { + get { + return ResourceManager.GetString("InvalidInitializerMemberDeclarator", resourceCulture); + } + } + + internal static string CollectionInitializationNotSupported { + get { + return ResourceManager.GetString("CollectionInitializationNotSupported", resourceCulture); + } + } + + internal static string UnableToFindAppropriateAddMethod { + get { + return ResourceManager.GetString("UnableToFindAppropriateAddMethod", resourceCulture); + } + } + + internal static string ReservedWord { + get { + return ResourceManager.GetString("ReservedWord", resourceCulture); + } + } + + internal static string ArgumentCountMismatch { + get { + return ResourceManager.GetString("ArgumentCountMismatch", resourceCulture); + } + } + + internal static string GenericTypeReference { + get { + return ResourceManager.GetString("GenericTypeReference", resourceCulture); + } + } + + internal static string AssignmentOperatorNotAllowed { + get { + return ResourceManager.GetString("AssignmentOperatorNotAllowed", resourceCulture); + } + } + + internal static string DuplicateParameter { + get { + return ResourceManager.GetString("DuplicateParameter", resourceCulture); + } + } + + internal static string InvalidMethodCall2 { + get { + return ResourceManager.GetString("InvalidMethodCall2", resourceCulture); + } + } + + internal static string ReflectionNotAllowed { + get { + return ResourceManager.GetString("ReflectionNotAllowed", resourceCulture); + } + } + + internal static string UnknownIdentifier { + get { + return ResourceManager.GetString("UnknownIdentifier", resourceCulture); + } + } + + internal static string DuplicateLocalParameterDeclaration { + get { + return ResourceManager.GetString("DuplicateLocalParameterDeclaration", resourceCulture); + } + } + + internal static string MultipleLambdaParametersWithoutBrace { + get { + return ResourceManager.GetString("MultipleLambdaParametersWithoutBrace", resourceCulture); + } + } + + internal static string GenericArgumentCountMismatch { + get { + return ResourceManager.GetString("GenericArgumentCountMismatch", resourceCulture); + } + } + + internal static string NextTokenAtEnd { + get { + return ResourceManager.GetString("NextTokenAtEnd", resourceCulture); + } + } + } } diff --git a/src/DynamicExpresso.Core/Resources/ErrorMessages.de.resx b/src/DynamicExpresso.Core/Resources/ErrorMessages.de.resx index cc3a5d1..65e6b45 100644 --- a/src/DynamicExpresso.Core/Resources/ErrorMessages.de.resx +++ b/src/DynamicExpresso.Core/Resources/ErrorMessages.de.resx @@ -177,4 +177,40 @@ Nicht-beendetes Zeichenfolgenliteral + + {0} ist ein reserviertes Wort + + + Argumentzahl unpassend + + + Generische Typen müssen mittels generischer Definition referenziert werden: {0} + + + Zuweisungsoperator '{0}' ist nicht erlaubt + + + Der Parameter '{0}' wurde mehrmals definiert + + + Keine zutreffende Methode '{0}' gefunden im Typ '{1}' + + + Spiegelungsausdrücke sind nicht erlaubt. Aktivieren Sie Spiegelung mittels Interpreter.EnableReflection(). + + + Unbekannter Bezeichner '{0}' + + + Eine locale Variable oder Parameter '{0}' kann nicht in dieser Zugriffsebene deklariert werden, da dieser Name bereits in einer höheren Zugriffsebene verwendet wird, um eine lokale Variable oder Parameter zu definieren + + + Mehrere Lambda-Funktionsparameter erkannt, aber keine umgebenden Klammern gegeben + + + Die Anzahl an Typargumenten für den generischen Typ stimmt nicht mit der Stelligkeit der Definition überein + + + NextToken wurde am Ende des Ausdrucks aufgerufen + diff --git a/src/DynamicExpresso.Core/Resources/ErrorMessages.resx b/src/DynamicExpresso.Core/Resources/ErrorMessages.resx index 9a3ea95..f5ed85f 100644 --- a/src/DynamicExpresso.Core/Resources/ErrorMessages.resx +++ b/src/DynamicExpresso.Core/Resources/ErrorMessages.resx @@ -1,17 +1,17 @@  - @@ -276,4 +276,40 @@ The best overloaded Add method '{0}.Add' for the collection initializer has some invalid arguments - \ No newline at end of file + + {0} is a reserved word + + + Arguments count mismatch + + + Generic type must be referenced via its generic definition: {0} + + + Assignment operator '{0}' not allowed + + + The parameter '{0}' was defined more than once + + + No applicable method '{0}' exists in type '{1}' + + + Reflection expression not allowed. To enable reflection use Interpreter.EnableReflection(). + + + Unknown identifier '{0}' + + + A local or parameter named '{0}' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter + + + Multiple lambda parameters detected, but with no surrounding parenthesis + + + The number of generic arguments provided doesn't equal the arity of the generic type definition + + + NextToken called when already at the end of the expression + +