Exemple #1
0
        static void Main(string[] args)
        {
            var tokens = File.ReadAllLines(args[0]);
            var global = new GlobalDecl();
            {
                int index = 0;
                CppDeclParser.ParseSymbols(tokens, ref index, global);
                if (index != tokens.Length)
                {
                    throw new ArgumentException("Failed to parse.");
                }
            }

            var xml = new XDocument(global.Serialize());

            xml.Save(args[1]);

            global.BuildSymbolTree(null, null);
            var grouping = ExpandChildren(global)
                           .Where(decl => decl.OverloadKey != null)
                           .GroupBy(decl => decl.OverloadKey)
                           .ToDictionary(g => g.Key, g => g.ToArray())
            ;

            foreach (var pair in grouping)
            {
                if (pair.Value.Length > 1 && pair.Value.Any(decl => !(decl is NamespaceDecl)))
                {
                    Console.WriteLine("Duplicate key founds: " + pair.Key);
                }
            }
        }
Exemple #2
0
        static SymbolDecl Convert(string input)
        {
            var tokens = input.Split(" \r\n".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
            int index  = 0;

            var decl = new GlobalDecl();

            CppDeclParser.ParseSymbols(tokens, ref index, decl);
            Assert.AreEqual(tokens.Length, index);

            TestSymbolDeclSerialization(decl);
            return(decl);
        }
Exemple #3
0
 void SymbolDecl.IVisitor.Visit(GlobalDecl decl)
 {
     throw new ArgumentOutOfRangeException();
 }