Ejemplo n.º 1
0
        public static CodeParserTest GetParserTest(string language)
        {
            var assembly  = Assembly.GetExecutingAssembly();
            var typeArray = assembly.ExportedTypes;

            var types = (from type in typeArray
                         where type.IsSubclassOf(typeof(CodeParserTest))
                         select type).ToList();

            foreach (var type in types)
            {
                CodeParserTest codeParserTest = (CodeParserTest)Activator.CreateInstance(type);

                if (codeParserTest.Language == language)
                {
                    return(codeParserTest);
                }
            }

            return(null);
        }
Ejemplo n.º 2
0
        static void Parse(string language)
        {
            CodeParserTest codeParserTest = ParserHelper.GetParserTest(language);

            if (codeParserTest != null)
            {
                ParserInfo info = ParserManager.GetParserInfoByLanguage(language);

                if (info != null)
                {
                    codeParserTest.Parse(info);
                }
                else
                {
                    Console.WriteLine($"Can't get ParserInfo for language \"{language}\".");
                }
            }
            else
            {
                Console.WriteLine($"There's no parser test class for language \"{language}\".");
            }
        }