Пример #1
0
        public void Should_invoke_default_parser()
        {
            var defaultParser = new List <IDefaultParser>()
            {
                new DefaultParser()
            };
            var genericParser = new List <IGenericParser>()
            {
                new GenericParser()
            };
            var gameParser = new List <IGameParser>()
            {
                new GameParser()
            };

            var manager = new ParserManager(gameParser, genericParser, defaultParser);
            var result  = manager.Parse(new ParserManagerArgs()
            {
                File     = "fake",
                GameType = "game"
            });

            result.First().File.Should().Be("default_parser");
            result.First().UsedParser.Should().Be("DefaultParser");
        }
        internal static SearchExpression ExpandParser(SearchExpressionParserArgs args)
        {
            var outerText = args.text;
            var text      = ParserUtils.SimplifyExpression(outerText);

            if (!text.StartsWith("...", System.StringComparison.Ordinal))
            {
                return(null);
            }

            var expression = ParserManager.Parse(args.With(text.Substring(3)));

            return(new SearchExpression(expression, expression.types | SearchExpressionType.Expandable, outerText, expression.innerText));
        }