コード例 #1
0
        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);
        }
コード例 #2
0
ファイル: Bootstraper.cs プロジェクト: florimm/Talks
        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);
        }
コード例 #3
0
ファイル: WordCounterService.cs プロジェクト: florimm/Talks
        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;
        }
コード例 #4
0
 public Drawer(ParserCombinator parser, FunctionDrawer fDrawer)
 {
     this.parser  = parser;
     this.fDrawer = fDrawer;
 }