line += "\n";
goto restart;
} catch(ParserException& pe) {
- d_out << pe << endl;
+ if(d_options[options::outputLanguage] == output::LANG_SMTLIB_V2) {
+ d_out << "(error \"" << pe << "\")" << endl;
+ } else {
+ d_out << pe << endl;
+ }
// We can't really clear out the sequence and abort the current line,
// because the parse error might be for the second command on the
// line. The first ones haven't yet been executed by the SmtEngine,
#include "util/output.h"
#include "util/result.h"
#include "util/statistics.h"
+#include "util/language.h"
using namespace std;
using namespace CVC4;
using namespace CVC4::main;
+using namespace CVC4::language;
/**
* CVC4's main() routine is just an exception-safe wrapper around CVC4.
#ifdef CVC4_COMPETITION_MODE
*opts[options::out] << "unknown" << endl;
#endif
- *opts[options::err] << "CVC4 Error:" << endl << e << endl;
+ if(opts[options::outputLanguage] == output::LANG_SMTLIB_V2) {
+ *opts[options::err] << "(error \"" << e << "\")" << endl;
+ } else {
+ *opts[options::err] << "CVC4 Error:" << endl << e << endl;
+ }
if(opts[options::statistics] && pExecutor != NULL) {
pTotalTime->stop();
pExecutor->flushStatistics(*opts[options::err]);
{ $cmd = new GetValueCommand(terms); }
| /* get-assignment */
GET_ASSIGNMENT_TOK { PARSER_STATE->checkThatLogicIsSet(); }
- { cmd = new GetAssignmentCommand; }
+ { cmd = new GetAssignmentCommand(); }
| /* assertion */
ASSERT_TOK { PARSER_STATE->checkThatLogicIsSet(); }
term[expr, expr2]
{ cmd = new CheckSatCommand(MK_CONST(bool(true))); }
| /* get-assertions */
GET_ASSERTIONS_TOK { PARSER_STATE->checkThatLogicIsSet(); }
- { cmd = new GetAssertionsCommand; }
+ { cmd = new GetAssertionsCommand(); }
| /* get-proof */
GET_PROOF_TOK { PARSER_STATE->checkThatLogicIsSet(); }
- { cmd = new GetProofCommand; }
+ { cmd = new GetProofCommand(); }
| /* get-unsat-core */
GET_UNSAT_CORE_TOK { PARSER_STATE->checkThatLogicIsSet(); }
- { cmd = new GetUnsatCoreCommand; }
+ { cmd = new GetUnsatCoreCommand(); }
| /* push */
PUSH_TOK { PARSER_STATE->checkThatLogicIsSet(); }
( k=INTEGER_LITERAL
| { if(PARSER_STATE->strictModeEnabled()) {
PARSER_STATE->parseError("Strict compliance mode demands an integer to be provided to PUSH. Maybe you want (push 1)?");
} else {
- cmd = new PushCommand;
+ cmd = new PushCommand();
}
} )
| POP_TOK { PARSER_STATE->checkThatLogicIsSet(); }
( k=INTEGER_LITERAL
{ unsigned n = AntlrInput::tokenToUnsigned(k);
+ if(n > PARSER_STATE->scopeLevel()) {
+ PARSER_STATE->parseError("Attempted to pop above the top stack frame.");
+ }
if(n == 0) {
cmd = new EmptyCommand();
} else if(n == 1) {
| { if(PARSER_STATE->strictModeEnabled()) {
PARSER_STATE->parseError("Strict compliance mode demands an integer to be provided to POP. Maybe you want (pop 1)?");
} else {
- cmd = new PopCommand;
+ cmd = new PopCommand();
}
} )
| EXIT_TOK
- { cmd = new QuitCommand; }
+ { cmd = new QuitCommand(); }
/* CVC4-extended SMT-LIB commands */
| extendedCommand[cmd]
cmd = new DatatypeDeclarationCommand(PARSER_STATE->mkMutualDatatypeTypes(dts)); }
| /* get model */
GET_MODEL_TOK { PARSER_STATE->checkThatLogicIsSet(); }
- { cmd = new GetModelCommand; }
+ { cmd = new GetModelCommand(); }
| ECHO_TOK
( simpleSymbolicExpr[sexpr]
{ std::stringstream ss;