mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-22 03:09:33 -06:00
restore graphvizParseTree
This commit is contained in:
@@ -23,6 +23,8 @@ libpgf_la_SOURCES = \
|
||||
pgf/typechecker.h \
|
||||
pgf/linearizer.cxx \
|
||||
pgf/linearizer.h \
|
||||
pgf/graphviz.cxx \
|
||||
pgf/graphviz.h \
|
||||
pgf/data.cxx \
|
||||
pgf/data.h \
|
||||
pgf/expr.cxx \
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include "printer.h"
|
||||
#include "typechecker.h"
|
||||
#include "linearizer.h"
|
||||
#include "graphviz.h"
|
||||
|
||||
static void
|
||||
pgf_exn_clear(PgfExn* err)
|
||||
@@ -2065,3 +2066,27 @@ void pgf_set_concrete_flag(PgfDB *db, PgfConcrRevision revision,
|
||||
concr->cflags = cflags;
|
||||
} PGF_API_END
|
||||
}
|
||||
|
||||
PGF_API PgfText *
|
||||
pgf_graphviz_parse_tree(PgfDB *db, PgfConcrRevision revision,
|
||||
PgfExpr expr, PgfMarshaller *m,
|
||||
PgfGraphvizOptions* opts,
|
||||
PgfExn *err)
|
||||
{
|
||||
PGF_API_BEGIN {
|
||||
DB_scope scope(db, READER_SCOPE);
|
||||
|
||||
ref<PgfConcr> concr = PgfDB::revision2concr(revision);
|
||||
|
||||
PgfLinearizationGraphvizOutput out;
|
||||
PgfLinearizer linearizer(concr, m);
|
||||
m->match_expr(&linearizer, expr);
|
||||
linearizer.reverse_and_label();
|
||||
if (linearizer.resolve()) {
|
||||
linearizer.linearize(&out);
|
||||
return out.generate_graphviz(opts);
|
||||
}
|
||||
} PGF_API_END
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -672,4 +672,23 @@ void pgf_set_concrete_flag(PgfDB *db, PgfConcrRevision revision,
|
||||
PgfMarshaller *m,
|
||||
PgfExn *err);
|
||||
|
||||
typedef struct {
|
||||
int noLeaves;
|
||||
int noFun;
|
||||
int noCat;
|
||||
int noDep;
|
||||
const char *nodeFont;
|
||||
const char *leafFont;
|
||||
const char *nodeColor;
|
||||
const char *leafColor;
|
||||
const char *nodeEdgeStyle;
|
||||
const char *leafEdgeStyle;
|
||||
} PgfGraphvizOptions;
|
||||
|
||||
PGF_API PgfText *
|
||||
pgf_graphviz_parse_tree(PgfDB *db, PgfConcrRevision revision,
|
||||
PgfExpr expr, PgfMarshaller *m,
|
||||
PgfGraphvizOptions* opts,
|
||||
PgfExn *err);
|
||||
|
||||
#endif // PGF_H_
|
||||
|
||||
Reference in New Issue
Block a user