Beispiel #1
0
        public IEnumerable <ToRoute> GetContents(IValueContext currentContext)
        {
            int counter = 0;

            IEnumerable <ToRoute> result = Enumerable.Empty <ToRoute>();
            var ps                  = new PropertySheetV3.PropertySheet((Context as ObjectNode).Root);
            var context             = ps.Children[(Context as ObjectNode).Selector];
            var propertySheetParser = new PropertySheetParser(Enumerable.Empty <Token>(), ps, "");

            foreach (var permutation in Permutations)
            {
                IEnumerable <Token> tokens = DoIt(Template).ToArray();

                if (tokens.FirstOrDefault().Type != TokenType.OpenBrace)
                {
                    tokens = open.Concat(tokens).Concat(close);
                }

                //tokens = PropertySheetTokenizer.Tokenize((currentContext ?? Context).ResolveMacrosInContext(tokens.Select(each => each.Data.ToString()).Aggregate((cur, each) => cur + each),permutation), TokenizerVersion.V3);

                tokens = PropertySheetTokenizer.Tokenize((currentContext ?? Context).ResolveMacrosInContext(
                                                             tokens.Select(each => each.Data.ToString()
                                                                           ).Aggregate((cur, each) => cur + each), permutation, true).Replace("${#", "${"), TokenizerVersion.V3);

#if DEBUG
                var tokenArray = tokens.ToArray();

                Event <Verbose> .Raise("Prefix:'{0}#{1}'".format(Prefix, counter), DoIt(tokenArray).ToArray().Select(each => (string)each.Data.ToString()).CollapseToString(""));

                Event <Debug> .Raise("Prefix:'{0}#{1}'".format(Prefix, counter), tokenArray.Select(each => (string)each.Data.ToString()).CollapseToString(""));

                Event <Debug> .Raise("Prefix:'{0}#{1}'".format(Prefix, counter), DoIt(tokenArray).ToArray().Select(each => (string)each.Data.ToString()).CollapseToString(""));

                propertySheetParser.ResetParser(tokenArray);
#else
                propertySheetParser.ResetParser(tokens);
#endif



                propertySheetParser.ParseItemAsDictionary(context, "{0}#{1}#".format(Prefix, counter++));
                result = result.Concat(context.Routes);
            }

            return(result);
        }
 public virtual void ParseText(string propertySheetText, string originalFilename)
 {
     FullPath = originalFilename;
     new PropertySheetParser(PropertySheetTokenizer.Tokenize(propertySheetText, TokenizerVersion.V3), this, originalFilename).Parse();
 }