return d_pCvcParser->parseCommand(d_pCvcParser);
}
-Expr CvcInput::parseExpr() {
- return d_pCvcParser->parseExpr(d_pCvcParser);
+api::Term CvcInput::parseExpr()
+{
+ return api::Term(d_pCvcParser->parseExpr(d_pCvcParser));
}
/*
*/
Command* parseCommand() override;
- /** Parse an expression from the input. Returns a null <code>Expr</code>
+ /** Parse an expression from the input. Returns a null <code>api::Term</code>
* if there is no expression there to parse.
*
* @throws ParserException if an error is encountered during parsing.
*/
- Expr parseExpr() override;
+ api::Term parseExpr() override;
private:
/** Initialize the class. Called from the constructors once the input stream
#include <string>
#include <vector>
-#include "options/language.h"
+#include "api/cvc4cpp.h"
#include "expr/expr.h"
#include "expr/expr_manager.h"
+#include "options/language.h"
#include "parser/parser_exception.h"
namespace CVC4 {
/** Parse an expression from the input by invoking the
* implementation-specific parsing method. Returns a null
- * <code>Expr</code> if there is no expression there to parse.
+ * <code>api::Term</code> if there is no expression there to parse.
*
* @throws ParserException if an error is encountered during parsing.
*/
- virtual Expr parseExpr() = 0;
+ virtual api::Term parseExpr() = 0;
/** Set the Parser object for this input. */
virtual void setParser(Parser& parser) = 0;
return cmd;
}
-Expr Parser::nextExpression()
+api::Term Parser::nextExpression()
{
Debug("parser") << "nextExpression()" << std::endl;
d_resourceManager->spendResource(ResourceManager::Resource::ParseStep);
- Expr result;
+ api::Term result;
if (!done()) {
try {
result = d_input->parseExpr();
Command* nextCommand();
/** Parse and return the next expression. */
- Expr nextExpression();
+ api::Term nextExpression();
/** Issue a warning to the user. */
void warning(const std::string& msg) { d_input->warning(msg); }
public:
ExprStream(Parser* parser) : d_parser(parser) {}
~ExprStream() { delete d_parser; }
- Expr nextExpr() override { return d_parser->nextExpression(); }
+ Expr nextExpr() override { return d_parser->nextExpression().getExpr(); }
};/* class Parser::ExprStream */
//------------------------ operator overloading
return d_pSmt2Parser->parseCommand(d_pSmt2Parser);
}
-Expr Smt2Input::parseExpr() {
- return d_pSmt2Parser->parseExpr(d_pSmt2Parser);
+api::Term Smt2Input::parseExpr()
+{
+ return api::Term(d_pSmt2Parser->parseExpr(d_pSmt2Parser));
}
}/* CVC4::parser namespace */
*
* @throws ParserException if an error is encountered during parsing.
*/
- Expr parseExpr() override;
+ api::Term parseExpr() override;
};/* class Smt2Input */
return d_pSmt2Parser->parseSygus(d_pSmt2Parser);
}
-Expr SygusInput::parseExpr() {
- return d_pSmt2Parser->parseExpr(d_pSmt2Parser);
+api::Term SygusInput::parseExpr()
+{
+ return api::Term(d_pSmt2Parser->parseExpr(d_pSmt2Parser));
}
}/* CVC4::parser namespace */
/**
* Parse an expression from the input. Returns a null
- * <code>Expr</code> if there is no expression there to parse.
+ * <code>api::Term</code> if there is no expression there to parse.
*
* @throws ParserException if an error is encountered during parsing.
*/
- Expr parseExpr() override;
+ api::Term parseExpr() override;
};/* class SygusInput */
return d_pTptpParser->parseCommand(d_pTptpParser);
}
-Expr TptpInput::parseExpr() {
- return d_pTptpParser->parseExpr(d_pTptpParser);
+api::Term TptpInput::parseExpr()
+{
+ return api::Term(d_pTptpParser->parseExpr(d_pTptpParser));
}
}/* CVC4::parser namespace */
/**
* Parse an expression from the input. Returns a null
- * <code>Expr</code> if there is no expression there to parse.
+ * <code>api::Term</code> if there is no expression there to parse.
*
* @throws ParserException if an error is encountered during parsing.
*/
- Expr parseExpr() override;
+ api::Term parseExpr() override;
};/* class TptpInput */
<< "translating from " << inlang << " to " << outlang << " this string:" << endl
<< in << endl;
psr->setInput(Input::newStringInput(inlang, in, "internal-buffer"));
- Expr e = psr->nextExpression();
+ Expr e = psr->nextExpression().getExpr();
stringstream ss;
ss << language::SetLanguage(outlang) << expr::ExprSetDepth(-1) << e;
assert(psr->nextExpression().isNull());// next expr should be null
<< "reparsing as " << outlang << endl;
psr->setInput(Input::newStringInput(toInputLanguage(outlang), s, "internal-buffer"));
- Expr f = psr->nextExpression();
+ Expr f = psr->nextExpression().getExpr();
assert(e == f);
cout << "got same expressions " << e.getId() << " and " << f.getId() << endl
<< "==============================================" << endl;
TS_ASSERT(!parser->done());
setupContext(*parser);
TS_ASSERT(!parser->done());
- Expr e = parser->nextExpression();
+ api::Term e = parser->nextExpression();
TS_ASSERT(!e.isNull());
e = parser->nextExpression();
TS_ASSERT(parser->done());
.build();
setupContext(*parser);
TS_ASSERT(!parser->done());
- TS_ASSERT_THROWS(Expr e = parser->nextExpression();
+ TS_ASSERT_THROWS(api::Term e = parser->nextExpression();
cout << endl
<< "Bad expr succeeded." << endl
<< "Input: <<" << badExpr << ">>" << endl
Parser *parser = builder.build();
TS_ASSERT(parser != NULL);
- Expr e = parser->nextExpression();
+ api::Term e = parser->nextExpression();
TS_ASSERT(e.isNull());
delete parser;
Parser *parser = builder.build();
TS_ASSERT(parser != NULL);
- Expr e = parser->nextExpression();
+ api::Term e = parser->nextExpression();
TS_ASSERT_EQUALS(e, d_solver->getExprManager()->mkConst(true));
e = parser->nextExpression();