Ejemplo n.º 1
0
 (from parameter in Parameters(invocation)
  let attr = parameter.Parameter
Ejemplo n.º 2
0
 builder.UseMiddleware(async(invocation, next) =>
 {
Ejemplo n.º 3
0
    /// <summary>Called from ParseAnInvocation2.
    /// Tries to match the current words in the source to exactly one in-scope thing which satisfies the given parameter's type.
    /// On success returns the Instance (literal value, variable which holds the value, etc.)
    /// Uses IsNameOfTypeWhich, ParseRelativeInvocation, ParseNumberOrdinalPercent, MatchToNamedStorageLocation.</summary>
    static instance ParseInvokedNoun(List <string> words, parameter satisfyMe, bool allowUnboundVariables = false)
    {
        if (index >= words.Count)
        {
            return(null);
        }
        int savedIndex = index;

        while (words[index] == "the")
        {
            index++;
        }
        theTypeWhich theTypeWhich = null;
        invocation   inv          = null;
        long?        number       = null;
        Article?     art          = null;

        if (words[index].StartsWith("__litstring"))
        {
            return (IsA(StandardType.text, satisfyMe.type)) ? null : new instance()
                   {
                       var = satisfyMe, literalString = Say(words[index++]), type = StandardType.text, toAccess = Indirectedness.literal
                   }
        }
        ;
        if ((theTypeWhich = IsNameOfTypeWhich(words)) != null && ((inv = ParseARelativeInvocation(theTypeWhich, words)) != null))
        {
            return new instance()
                   {
                       var = satisfyMe, type = theTypeWhich.type.typeid, inner = inv, toAccess = Indirectedness.nested_invocation
                   }
        }
        ;
        if (satisfyMe.isAggregate && words[index].EndsWith("ing") && (inv = ParseAGerundInvocation(satisfyMe, words)) != null)
        {
            return new instance()
                   {
                       var = satisfyMe, type = satisfyMe.type, inner = inv, toAccess = Indirectedness.nested_invocation
                   }
        }
        ;
        if ((number = ParseNumberOrdinalPercent(words)) != null)
        {
            return (!IsA(numtype.AsStandardType(), satisfyMe.type)) ? null : new instance()
                   {
                       var = satisfyMe, literalValue = number.Value, type = numtype.AsStandardType(), toAccess = Indirectedness.literal
                   }
        }
        ;
        if (allowUnboundVariables && (art = ParseArticle(words.ToArray())) != null)
        {
            index = savedIndex; // back up over the article(s) for the following function to eat

            parameter unbound = ParseNounPhraseForParameter(words.ToArray(), false);
            if (unbound == null)
            {
                return(null);
            }
            return(new instance()
            {
                var = unbound, toAccess = Indirectedness.unbound
            });
        }
        return(MatchToNamedStackLocation(words));
    }
Ejemplo n.º 4
0
 ? InvocationExpressionPreProcess(invocation, programState)
 : programState;
Ejemplo n.º 5
0
     async(invocation, next) =>
 {
Ejemplo n.º 6
0
 return(new RegisterClassHandler(invocation, method));