Ejemplo n.º 1
0
func parse2graph(filename string) *gographviz.Graph {
	f, err := os.Open(filename)
	checkError(err)
	all, err := ioutil.ReadAll(f)
	checkError(err)
	g, err := gographviz.Parse(all) // *ast.Graph
	checkError(err)
	//fmt.Printf("Parsed: %v\n", g)
	ag := gographviz.NewAnalysedGraph(g)
	//fmt.Printf("Analysed: %v\n", ag)
	fmt.Printf("Written: %v\n", ag.String())
	return ag
}
Ejemplo n.º 2
0
func parser2graph(filename string) *gographviz.Graph {
	f, err := os.Open(filename)
	checkError(err)
	all, err := ioutil.ReadAll(f)
	checkError(err)
	input := string(all)
	g, err := parser.ParseString(input)
	checkError(err)
	fmt.Printf("Parsed: %v\n", g)
	ag := gographviz.NewAnalysedGraph(g)
	fmt.Printf("Analysed: %v\n", ag)
	agstr := ag.String()
	fmt.Printf("Written: %v\n", agstr)
	return ag
}