Ejemplo n.º 1
0
        /// <summary>
        /// Parses the specified input.
        /// </summary>
        public ControlFlowElementBase Parse(String input, ISelectorFactory selectorFactory, ICodeQueryCommandFactory factory)
        {
            Assume.NotNull(input, nameof(input));
            Assume.NotNull(factory, nameof(factory));

            var stream = new AntlrInputStream(input);
            ITokenSource lexer = new CodeQueryLexer(stream);
            ITokenStream tokens = new CommonTokenStream(lexer);
            var parser = new CodeQueryParser(tokens) {
                BuildParseTree = true
            };
            var start = parser.command();

            var visitor = new CodeQuerySyntaxTreeBuilder(selectorFactory, factory);
            return visitor.Visit(start) as ControlFlowElementBase;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Parses the specified input.
        /// </summary>
        public ControlFlowElementBase Parse(String input, ISelectorFactory selectorFactory, ICodeQueryCommandFactory factory)
        {
            Assume.NotNull(input, nameof(input));
            Assume.NotNull(factory, nameof(factory));

            var          stream = new AntlrInputStream(input);
            ITokenSource lexer  = new CodeQueryLexer(stream);
            ITokenStream tokens = new CommonTokenStream(lexer);
            var          parser = new CodeQueryParser(tokens)
            {
                BuildParseTree = true
            };
            var start = parser.command();

            var visitor = new CodeQuerySyntaxTreeBuilder(selectorFactory, factory);

            return(visitor.Visit(start) as ControlFlowElementBase);
        }