using System; using System.Collections.Generic; namespace GitHub.DistributedTask.Expressions { internal static class ExpressionConstants { static ExpressionConstants() { AddFunction("and", 2, Int32.MaxValue); AddFunction("coalesce", 2, Int32.MaxValue); AddFunction("contains", 2, 2); AddFunction("containsValue", 2, 2); AddFunction("endsWith", 2, 2); AddFunction("eq", 2, 2); AddFunction("format", 1, Byte.MaxValue); AddFunction("gt", 2, 2); AddFunction("ge", 2, 2); AddFunction("lt", 2, 2); AddFunction("join", 2, 2); AddFunction("le", 2, 2); AddFunction("in", 2, Int32.MaxValue); AddFunction("not", 1, 1); AddFunction("ne", 2, 2); AddFunction("notIn", 2, Int32.MaxValue); AddFunction("or", 2, Int32.MaxValue); AddFunction("startsWith", 2, 2); AddFunction("xor", 2, 2); } private static void AddFunction(String name, Int32 minParameters, Int32 maxParameters) where T : FunctionNode, new() { WellKnownFunctions.Add(name, new FunctionInfo(name, minParameters, maxParameters)); } internal static readonly String DateTimeFormat = @"yyyy\-MM\-dd\ HH\:mm\:sszzz"; internal static readonly Int32 MaxDepth = 50; internal static readonly Int32 MaxLength = 21000; // Under 85,000 large object heap threshold, even if .NET switches to UTF-32 internal static readonly String NumberFormat = "0.#######"; internal static readonly Dictionary WellKnownFunctions = new Dictionary(StringComparer.OrdinalIgnoreCase); // Punctuation internal const Char StartIndex = '['; internal const Char StartParameter = '('; internal const Char EndIndex = ']'; internal const Char EndParameter = ')'; internal const Char Separator = ','; internal const Char Dereference = '.'; internal const Char Wildcard = '*'; } }