Esempio n. 1
0
        public Expression ParseAttributeExpression(TokenLookup token, string source, string attribute)
        {
            var subsitutedSource = token.ResolveSubsitutions(source, attribute);
            var expression       = Parser.Parse(Lexer.ReadSource(subsitutedSource));

            return(expression);
        }
Esempio n. 2
0
        public ExpressionLookup(
            ICollection <NiObjectSchema> niObjects,
            ICollection <CompoundSchema> compounds,
            TokenLookup token
            )
        {
            var fields = niObjects
                         .SelectMany(ni => ni.Fields)
                         .Concat(compounds.SelectMany(c => c.Fields));

            Conditions = fields
                         .Where(f => f.Condition != null)
                         .ToDictionary(f => f, f =>
                                       ParseAttributeExpression(token, f.Condition, "cond"));
            VersionConditions = fields
                                .Where(f => f.VersionCondition != null)
                                .ToDictionary(f => f, f =>
                                              ParseAttributeExpression(token, f.VersionCondition, "vercond"));
            Arguments = fields
                        .Where(f => f.Argument != null)
                        .ToDictionary(f => f, f =>
                                      ParseAttributeExpression(token, f.Argument, "arg"));

            Dimensions = fields
                         .Where(f => f.IsMultiDimensional)
                         .ToDictionary(f => f, f =>
                                       f.Dimensions
                                       .Select((d, i) =>
                                               ParseAttributeExpression(token, d, $"arr{i + 1}"))
                                       .ToList());
        }