summaryrefslogtreecommitdiff
path: root/src/pretty_printing.h
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2018-08-14 11:29:34 -0700
committerGitHub <noreply@github.com>2018-08-14 11:29:34 -0700
commit15b4a4c66fdad9a31bfb3912673378c1c9cf7e1c (patch)
treedea56d226fffa2fb832e6981a930efc3f9a7f0d8 /src/pretty_printing.h
parent9f8fa5a14d3b48c650c2574529fd95c329cb5358 (diff)
downloadbinaryen-15b4a4c66fdad9a31bfb3912673378c1c9cf7e1c.tar.gz
binaryen-15b4a4c66fdad9a31bfb3912673378c1c9cf7e1c.tar.bz2
binaryen-15b4a4c66fdad9a31bfb3912673378c1c9cf7e1c.zip
Print Stack IR in proper .wat format (#1630)
This now makes --generate-stack-ir --print-stack-ir emit a fully valid .wat wasm file, in stacky format.
Diffstat (limited to 'src/pretty_printing.h')
-rw-r--r--src/pretty_printing.h15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/pretty_printing.h b/src/pretty_printing.h
index f1ba944f4..c5d755dcc 100644
--- a/src/pretty_printing.h
+++ b/src/pretty_printing.h
@@ -62,16 +62,21 @@ inline std::ostream& printText(std::ostream &o, const char *str) {
return o << '"';
}
-inline std::ostream& printOpening(std::ostream &o, const char *str, bool major=false) {
- o << '(';
- major ? prepareMajorColor(o) : prepareColor(o);
+inline std::ostream& printMajor(std::ostream &o, const char *str, bool major=false) {
+ prepareMajorColor(o);
o << str;
restoreNormalColor(o);
return o;
}
-inline std::ostream& printMinorOpening(std::ostream &o, const char *str) {
- o << '(';
+inline std::ostream& printMedium(std::ostream &o, const char *str, bool major=false) {
+ prepareColor(o);
+ o << str;
+ restoreNormalColor(o);
+ return o;
+}
+
+inline std::ostream& printMinor(std::ostream &o, const char *str) {
prepareMinorColor(o);
o << str;
restoreNormalColor(o);