Exemple #1
0
            public bool Matches(string candidateName)
            {
                string baseName = candidateName.Contains(".")
                                      ? MatchName
                                      : new GracefulName(MatchName).IdentifierName.ToString();
                var typeIdentifier        = new IdentifierName(baseName);
                var typeFixtureIdentifier = new IdentifierName(baseName + "fixture");

                return(typeIdentifier.Matches(candidateName) || typeFixtureIdentifier.Matches(candidateName));
            }
Exemple #2
0
        public string Read()
        {
            int messageLength = int.Parse(Read(6));

            Read(1); // skip the colon
            string message = Read(messageLength);

            IsEnd = EndIdentifier.Matches(message);
            return(IsEnd ? null : message);
        }
Exemple #3
0
 bool MatchesName(string name)
 {
     if (memberName.Matches(name))
     {
         return(true);
     }
     if (!memberName.MatchName.StartsWith("set") && !memberName.MatchName.StartsWith("get"))
     {
         return(false);
     }
     return(new IdentifierName(memberName.MatchName.Substring(3)).Matches(name));
 }
Exemple #4
0
        public bool MatchesGetSetName(string name)
        {
            var identifier = new IdentifierName(memberName.Name);

            if (identifier.Matches(name))
            {
                return(true);
            }
            if (!identifier.MatchName.StartsWith("set") && !identifier.MatchName.StartsWith("get"))
            {
                return(false);
            }
            return(new IdentifierName(identifier.MatchName.Substring(3)).Matches(name));
        }
Exemple #5
0
 public bool TryExecute(Processor <string> processor, TypedValue instance, Tree <string> parameters, ref TypedValue result)
 {
     if (!identifier.IsEmpty && (parameters.Branches.Count < 2 || !identifier.Matches(parameters.Branches[1].Value)))
     {
         return(false);
     }
     try {
         result = new TypedValue(ExecuteOperation(processor, parameters));
     }
     catch (Exception e) {
         result = new TypedValue(Result(parameters, processor.Compose(e)));
     }
     return(true);
 }
Exemple #6
0
        public string Read()
        {
            int messageByteLength = int.Parse(stream.ReadBytes(6));

            stream.ReadBytes(1); // skip the colon
            string message = stream.ReadBytes(messageByteLength);

            if (EndIdentifier.Matches(message))
            {
                IsEnd = true;
                socket.Close();
                return(null);
            }
            return(message);
        }
Exemple #7
0
 private RuntimeMember FindMemberByName(object instance, Type targetType)
 {
     foreach (MemberInfo memberInfo in targetType.GetMembers(flags | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.FlattenHierarchy))
     {
         if (!memberName.Matches(memberInfo.Name.Replace("_", string.Empty)))
         {
             continue;
         }
         RuntimeMember runtimeMember = MakeMember(memberInfo, instance);
         if (Matches(runtimeMember))
         {
             return(runtimeMember);
         }
     }
     return(null);
 }
Exemple #8
0
        object[] GetNamedParameterList(TypedValue instance, Tree <T> parameters, RuntimeMember member, IList <string> parameterNames)
        {
            var result = new object[parameterNames.Count];

            for (int i = 0; i < parameterNames.Count; i++)
            {
                for (int j = 0; j < parameterNames.Count; j++)
                {
                    var parameterNameId = new IdentifierName(parameterNames[j]);
                    if (!parameterNameId.Matches(member.GetParameterName(i)))
                    {
                        continue;
                    }
                    result[i] = ParseParameterValue(member, instance, parameters.Branches[2 * j + 1], i);
                }
            }
            return(result);
        }
Exemple #9
0
 public RuntimeMember Find(IdentifierName memberName, int parameterCount, IList <Type> parameterTypes)
 {
     return(columnAccessors.Find(memberName, parameterCount, accessor => {
         string accessorName = accessor.Key.EndsWith("=")
                                       ? accessor.Key.Substring(0, accessor.Key.Length - 1)
                                       : accessor.Key;
         if (!memberName.Matches(accessorName))
         {
             return false;
         }
         if (currentHeader != null && currentHeader.Text.EndsWith("=") && !accessor.Key.EndsWith("="))
         {
             return false;
         }
         if (currentHeader != null && !currentHeader.Text.EndsWith("=") && accessor.Key.EndsWith("="))
         {
             return false;
         }
         return true;
     }));
 }
Exemple #10
0
        public string Read()
        {
            string lengthString = string.Empty;

            while (true)
            {
                var lengthCharacter = stream.ReadBytes(1);
                if (lengthCharacter == ":")
                {
                    break;
                }
                lengthString += lengthCharacter;
            }
            int    messageByteLength = int.Parse(lengthString);
            string message           = stream.ReadBytes(messageByteLength);

            if (EndIdentifier.Matches(message))
            {
                IsEnd = true;
                socket.Close();
                return(null);
            }
            return(message);
        }
Exemple #11
0
 public RuntimeMember Find(IdentifierName memberName, int parameterCount, IList <Type> parameterTypes)
 {
     return(columnAccessors.Find(memberName, parameterCount, accessor => memberName.Matches(accessor.Key)));
 }