Example #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.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine("Duplicate key founds: " + pair.Key);
                    Console.ResetColor();
                }
            }
        }
Example #2
0
 public void Visit(GlobalDecl decl)
 {
     Deserialize(decl);
 }
 public void Visit(GlobalDecl decl)
 {
 }
 public void Visit(GlobalDecl decl)
 {
     this.Result = "";
 }
Example #5
0
 public void Visit(GlobalDecl decl)
 {
     this.Result = "";
 }
Example #6
0
 public void Visit(GlobalDecl decl)
 {
     Serialize(decl);
 }
Example #7
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;
        }
 public void Visit(GlobalDecl decl)
 {
 }