private ParserCombinator GetCombinator()
        {
            if (combinator != null)
            {
                return(combinator);
            }

            var lazyComb = new Lazy <ParserCombinator>(() => combinator);
            var parsers  = new IParser[]
            {
                new WhereParser(lazyComb),
                new AdditionParser(lazyComb),
                new SubtractionParser(lazyComb),
                new MultiplicationParser(lazyComb),
                new DivisionParser(lazyComb),
                new UnaryMinusParser(lazyComb),
                new CallParser(lazyComb),
                new PowerParser(lazyComb),
                new NumericParser(lazyComb),
                new ParameterParser(lazyComb),
                new BracketParser(lazyComb)
            };

            combinator = new ParserCombinator(parsers);
            return(combinator);
        }
Exemple #2
0
        public Resolver Initialize()
        {
            var parser      = new ParserCombinator(new StartStriper(), new EndStriper(), new PageParser());
            var wordCounter = new WordCounterService(new WordCounter(), parser, new FileStoreReader());

            _resolver.Register(wordCounter);

            return(_resolver);
        }
Exemple #3
0
        public WordCounterService(WordCounter wordCounter, ParserCombinator textParser, IStoreReader storeReader)
        {
            if (wordCounter == null)
            {
                throw new ArgumentNullException("wordCounter");
            }

            if (textParser == null)
            {
                throw new ArgumentNullException("textParser");
            }

            if (storeReader == null)
            {
                throw new ArgumentNullException("storeReader");
            }

            _wordCounter = wordCounter;
            _textParser  = textParser;
            _storeReader = storeReader;
        }
Exemple #4
0
 public Drawer(ParserCombinator parser, FunctionDrawer fDrawer)
 {
     this.parser  = parser;
     this.fDrawer = fDrawer;
 }