1 ///////////////////////////////////////////////////////////////////////////////
2 // Copyright (c) 2000-2015 Ericsson Telecom AB
3 // All rights reserved. This program and the accompanying materials
4 // are made available under the terms of the Eclipse Public License v1.0
5 // which accompanies this distribution, and is available at
6 // http://www.eclipse.org/legal/epl-v10.html
7 ///////////////////////////////////////////////////////////////////////////////
11 #include "../common/memory.h"
14 void graph_use(Grammar
* grammar
)
16 expstring_t out
=mcopystr("digraph G {\n");
17 size_t n
=grammar
->get_nof_symbols();
18 for(size_t i
=0; i
<n
; i
++) {
19 Symbol
*lhs
=grammar
->get_symbol_byIndex(i
);
20 const SymbolSet
& ss
=lhs
->get_refs();
21 size_t n2
=ss
.get_nof_ss();
23 out
=mputprintf(out
, "%s -> { ", lhs
->get_id_dot().c_str());
24 for(size_t i2
=0; i2
<n2
; i2
++) {
25 Symbol
*s
=ss
.get_s_byIndex(i2
);
26 if(!s
->get_is_terminal())
27 out
=mputprintf(out
, "%s; ", s
->get_id_dot().c_str());
29 out
=mputstr(out
, "}\n");
32 out
=mputstr(out
, "}\n");
This page took 0.039127 seconds and 5 git commands to generate.