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)); }
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); }
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)); }
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)); }
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); }
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); }
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); }
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); }
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; })); }
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); }
public RuntimeMember Find(IdentifierName memberName, int parameterCount, IList <Type> parameterTypes) { return(columnAccessors.Find(memberName, parameterCount, accessor => memberName.Matches(accessor.Key))); }