summaryrefslogtreecommitdiff
path: root/decoder/cfg.h
diff options
context:
space:
mode:
authorgraehl <graehl@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-08-27 19:26:31 +0000
committergraehl <graehl@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-08-27 19:26:31 +0000
commit1eab70e16f0e0d5531f3babfea2062c82f6362e1 (patch)
treea1ea1930e585b9356c6e089465baa969bb6919bb /decoder/cfg.h
parent6ddaff1341e565dd91dca7ea763d0ea4d897f4c7 (diff)
compiles
git-svn-id: https://ws10smt.googlecode.com/svn/trunk@626 ec762483-ff6d-05da-a07a-a48fb63a330f
Diffstat (limited to 'decoder/cfg.h')
-rwxr-xr-xdecoder/cfg.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/decoder/cfg.h b/decoder/cfg.h
index 9be0926d..79ae6f33 100755
--- a/decoder/cfg.h
+++ b/decoder/cfg.h
@@ -62,6 +62,28 @@ struct CFG {
void print_nt_name(std::ostream &o,NTHandle n) const {
o << nts[n].from << n;
}
+ std::string nt_name(NTHandle n) const {
+ std::ostringstream o;
+ print_nt_name(o,n);
+ return o.str();
+ }
+ void print_rhs_name(std::ostream &o,WordID w) const {
+ if (w<=0) print_nt_name(o,-w);
+ else o<<TD::Convert(w);
+ }
+ std::string rhs_name(WordID w) const {
+ if (w<=0) return nt_name(-w);
+ else return TD::Convert(w);
+ }
+ static void static_print_rhs_name(std::ostream &o,WordID w) {
+ if (w<=0) o<<'['<<-w<<']';
+ else o<<TD::Convert(w);
+ }
+ static std::string static_rhs_name(WordID w) {
+ std::ostringstream o;
+ static_print_rhs_name(o,w);
+ return o.str();
+ }
typedef std::pair<WordID,WordID> BinRhs;