Ejemplo n.º 1
0
 public ITokenMatching <ISetUp <IBox <WeakMemberReference>, Tpn.TypeProblem2.Member> > TryMake(IMatchedTokenMatching tokenMatching)
 {
     return(tokenMatching
            .OptionalHas(new KeyWordMaker("readonly"), out var readonlyToken)
            .Has(new TypeMakerAlreadyMatched())
            .Has(new NameMaker())
            .ConvertIfMatched((type, nameToken) => new MemberDefinitionPopulateScope(new NameKey(nameToken.Item), readonlyToken != default, type), tokenMatching));
 }
Ejemplo n.º 2
0
        public ITokenMatching <IPopulateScope <WeakMemberReference, ISetUpMember> > TryMake(IMatchedTokenMatching tokenMatching)
        {
            var matching = tokenMatching
                           .OptionalHas(new KeyWordMaker("readonly"), out var readonlyToken)
                           .Has(new TypeMaker(), out var type)
                           .Has(new NameMaker(), out var nameToken);

            if (matching is IMatchedTokenMatching matched)
            {
                return(TokenMatching <IPopulateScope <WeakMemberReference, ISetUpMember> > .MakeMatch(
                           matched.Tokens,
                           matched.Context,
                           new MemberDefinitionPopulateScope(new NameKey(nameToken.Item), readonlyToken != default, type)));
            }
            return(TokenMatching <IPopulateScope <WeakMemberReference, ISetUpMember> > .MakeNotMatch(
                       matching.Context));
        }