summaryrefslogtreecommitdiff
path: root/src/printer
diff options
context:
space:
mode:
authorMorgan Deters <mdeters@cs.nyu.edu>2013-12-24 13:25:30 -0500
committerMorgan Deters <mdeters@cs.nyu.edu>2013-12-24 13:25:30 -0500
commita70dfd183b52f50d132d8b17425c7089a77004e7 (patch)
tree41d783cff1f6097bd76b77c561bbd77111317437 /src/printer
parent371fa29e5742a58581481f3d7d94a8116a814447 (diff)
parente23a40c0d121209afecff21ce5c6ed6e644bfb0e (diff)
Merge branch '1.3.x'
Conflicts: NEWS
Diffstat (limited to 'src/printer')
-rw-r--r--src/printer/cvc/cvc_printer.cpp2
-rw-r--r--src/printer/printer.h16
2 files changed, 16 insertions, 2 deletions
diff --git a/src/printer/cvc/cvc_printer.cpp b/src/printer/cvc/cvc_printer.cpp
index 49ded4ecb..ca463d10b 100644
--- a/src/printer/cvc/cvc_printer.cpp
+++ b/src/printer/cvc/cvc_printer.cpp
@@ -80,7 +80,7 @@ void CvcPrinter::toStream(std::ostream& out, TNode n, int depth, bool types, boo
// null
if(n.getKind() == kind::NULL_EXPR) {
- out << "NULL";
+ out << "null";
return;
}
diff --git a/src/printer/printer.h b/src/printer/printer.h
index a7ae8c447..9ddac096d 100644
--- a/src/printer/printer.h
+++ b/src/printer/printer.h
@@ -54,7 +54,21 @@ public:
/** Get the Printer for a given OutputLanguage */
static Printer* getPrinter(OutputLanguage lang) throw() {
if(lang == language::output::LANG_AUTO) {
- lang = language::output::LANG_CVC4; // default
+ // Infer the language to use for output.
+ //
+ // Options can be null in certain circumstances (e.g., when printing
+ // the singleton "null" expr. So we guard against segfault
+ if(&Options::current() != NULL) {
+ if(options::outputLanguage.wasSetByUser()) {
+ lang = options::outputLanguage();
+ }
+ if(lang == language::output::LANG_AUTO && options::inputLanguage.wasSetByUser()) {
+ lang = language::toOutputLanguage(options::inputLanguage());
+ }
+ }
+ if(lang == language::output::LANG_AUTO) {
+ lang = language::output::LANG_CVC4; // default
+ }
}
if(d_printers[lang] == NULL) {
d_printers[lang] = makePrinter(lang);
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback