diff --git a/.github/workflows/c-cpp.yml b/.github/workflows/c-cpp.yml index f6ffdf46b..6737b7751 100644 --- a/.github/workflows/c-cpp.yml +++ b/.github/workflows/c-cpp.yml @@ -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 @@ -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 diff --git a/src/plot_grammar.cc b/src/plot_grammar.cc index f07dbb074..e5735be74 100644 --- a/src/plot_grammar.cc +++ b/src/plot_grammar.cc @@ -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"; @@ -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 << "" << *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(this); + if (nt->ntargs().size() > 0) { + out << " ("; + for (std::list::const_iterator i = + nt->ntargs().begin(); i != nt->ntargs().end(); ++i) { + if ((*i)->is(Para_Decl::SIMPLE)) { + out << *dynamic_cast(*i)->name(); + } else if ((*i)->is(Para_Decl::MULTI)) { + Para_Decl::Multi *m = dynamic_cast(*i); + out << "<"; + for (std::list::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 << "
";