public void BuildAllObjectTypeAntlr() { var tree = IddTree.Tree(); ObjectNameListener listener = new ObjectNameListener(); ParseTreeWalker walker = new ParseTreeWalker(); walker.Walk(listener, tree); string typeLines = string.Join("", listener.types.Select(s => $" {s} |\n")); string output = $"fragment object_type : \n{typeLines}"; File.WriteAllText("/home/mitch/repos/idf-plus/antlr/types.g4", output); }
public void BuildDefaultFiles() { IddParser.IddContext tree = IddTree.Tree(); ParseTreeWalker walker = new ParseTreeWalker(); IddListener listener = new IddListener(); walker.Walk(listener, tree); string directory = "/home/mitch/tmp/ep_94"; foreach (var obj in listener.allObjects) { string filepath = $"{directory}/{obj.Name}.idf"; File.WriteAllText(filepath, obj.PrintDefaultObject()); } }