Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/c-cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
run: sudo apt-get install flex bison make libboost-all-dev libgsl-dev python3 python3-pip

- name: Checkout truth
run: git clone --branch master https://github.com/jlab/gapc-test-suite.git $GITHUB_WORKSPACE/../gapc-test-suite
run: git clone --branch plot_ntparas https://github.com/jlab/gapc-test-suite.git $GITHUB_WORKSPACE/../gapc-test-suite

- uses: actions/checkout@v3
- name: configure
Expand Down Expand Up @@ -81,7 +81,7 @@ jobs:
- name: add random Haskell lib
run: cabal install --lib random
- name: Checkout truth
run: git clone --branch master https://github.com/jlab/gapc-test-suite.git $GITHUB_WORKSPACE/../gapc-test-suite
run: git clone --branch plot_ntparas https://github.com/jlab/gapc-test-suite.git $GITHUB_WORKSPACE/../gapc-test-suite

- uses: actions/checkout@v3
- name: configure
Expand Down
30 changes: 30 additions & 0 deletions src/plot_grammar.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include "const.hh"
#include "fn_arg.hh"
#include "fn_def.hh"
#include "para_decl.hh"

static const char *COLOR_OVERLAY = "#cc5555";
static const char *COLOR_INDICES = "#555555";
Expand Down Expand Up @@ -517,6 +518,35 @@ unsigned int Symbol::Base::to_dot(unsigned int *nodeID, std::ostream &out,
if (plot_grammar > 1) {
to_dot_indices(this->left_indices, out);
out << "<td>" << *this->name;
// append non-terminal parameter to nt name, like "back (alphaLeftOuter)"
// where "back" is the NT name and "alphaLeftOuter" the single nt parameter
if (this->is(Symbol::NONTERMINAL)) {
Symbol::NT *nt = dynamic_cast<Symbol::NT*>(this);
if (nt->ntargs().size() > 0) {
out << " (";
for (std::list<Para_Decl::Base*>::const_iterator i =
nt->ntargs().begin(); i != nt->ntargs().end(); ++i) {
if ((*i)->is(Para_Decl::SIMPLE)) {
out << *dynamic_cast<Para_Decl::Simple*>(*i)->name();
} else if ((*i)->is(Para_Decl::MULTI)) {
Para_Decl::Multi *m = dynamic_cast<Para_Decl::Multi*>(*i);
out << "<";
for (std::list<Para_Decl::Simple*>::const_iterator j =
m->list().begin(); j != m->list().end(); ++j) {
out << *(*j)->name();
if (std::next(j) != m->list().end()) {
out << ", ";
}
}
out << ">";
}
if (std::next(i) != nt->ntargs().end()) {
out << ", ";
}
}
out << ")";
}
}
if (plot_grammar > 2) {
// if we want to also print out datatypes
out << "<br/><font color='" << COLOR_TYPE << "'>";
Expand Down