void GetInfoCommand::invoke(SmtEngine* smtEngine) throw() {
try {
- vector<SExpr> v;
- v.push_back(SExpr(SExpr::Keyword(string(":") + d_flag)));
- v.push_back(smtEngine->getInfo(d_flag));
+ SExpr response = smtEngine->getInfo(d_flag);
stringstream ss;
- ss << SExpr(v);
+ ss << SExpr(SExpr::Keyword(d_flag))
+ << ' '
+ << response;
d_result = ss.str();
d_commandStatus = CommandSuccess::instance();
} catch(BadOptionException&) {
{ cmd = new GetOptionCommand(AntlrInput::tokenText($KEYWORD)); }
| /* sort declaration */
DECLARE_SORT_TOK { PARSER_STATE->checkThatLogicIsSet(); }
- symbol[name,CHECK_UNDECLARED,SYM_SORT] n=INTEGER_LITERAL
+ symbol[name,CHECK_UNDECLARED,SYM_SORT]
+ { PARSER_STATE->checkUserSymbol(name); }
+ n=INTEGER_LITERAL
{ Debug("parser") << "declare sort: '" << name
<< "' arity=" << n << std::endl;
unsigned arity = AntlrInput::tokenToUnsigned(n);
| /* sort definition */
DEFINE_SORT_TOK { PARSER_STATE->checkThatLogicIsSet(); }
symbol[name,CHECK_UNDECLARED,SYM_SORT]
+ { PARSER_STATE->checkUserSymbol(name); }
LPAREN_TOK symbolList[names,CHECK_NONE,SYM_SORT] RPAREN_TOK
{
PARSER_STATE->pushScope();
| /* function declaration */
DECLARE_FUN_TOK { PARSER_STATE->checkThatLogicIsSet(); }
symbol[name,CHECK_UNDECLARED,SYM_VARIABLE]
+ { PARSER_STATE->checkUserSymbol(name); }
LPAREN_TOK sortList[sorts] RPAREN_TOK
sortSymbol[t,CHECK_DECLARED]
{ Debug("parser") << "declare fun: '" << name << "'" << std::endl;
| /* function definition */
DEFINE_FUN_TOK { PARSER_STATE->checkThatLogicIsSet(); }
symbol[name,CHECK_UNDECLARED,SYM_VARIABLE]
+ { PARSER_STATE->checkUserSymbol(name); }
LPAREN_TOK sortedVarList[sortedVarNames] RPAREN_TOK
sortSymbol[t,CHECK_DECLARED]
{ /* add variables to parser state before parsing term */
#include "parser/parser.h"
#include "parser/smt/smt.h"
+#include <sstream>
+
namespace CVC4 {
class SExpr;
void checkThatLogicIsSet();
+ void checkUserSymbol(const std::string& name) {
+ if( strictModeEnabled() &&
+ name.length() > 0 &&
+ ( name[0] == '.' || name[0] == '@' ) ) {
+ std::stringstream ss;
+ ss << "cannot declare or define symbol `" << name << "'; symbols starting with . and @ are reserved in SMT-LIBv2";
+ parseError(ss.str());
+ }
+ }
+
private:
void addArithmeticOperators();
+
};/* class Smt2 */
}/* CVC4::parser namespace */