Пример #1
0
        public static IEnumerable <NfTypeNameParseItem> InvokeParse(Stream stream)
        {
            var input  = new AntlrInputStream(stream);
            var lexer  = new DotNetIlTypeNameLexer(input);
            var tokens = new CommonTokenStream(lexer);
            var parser = new DotNetIlTypeNameParser(tokens);

            var tree = parser.utPrius();

            var walker = new ParseTreeWalker();
            var loader = new TypeNameParseTree();

            walker.Walk(loader, tree);

            return(loader.Results);
        }
Пример #2
0
        /// <summary>
        /// Helper method to get parsed results without having a reference to NoFuture.Antlr
        /// </summary>
        /// <param name="typeName"></param>
        /// <returns></returns>
        public static NfTypeNameParseItem ParseIl(string typeName)
        {
            if (String.IsNullOrWhiteSpace(typeName))
            {
                return(null);
            }

            var rslts = TypeNameParseTree.InvokeParse(typeName);

            if (rslts == null || !rslts.Any())
            {
                return(null);
            }

            return(rslts.First());
        }