return cmd;
}
+Expr Parser::nextExpression() throw(ParserException) {
+ Debug("parser") << "nextExpression()" << std::endl;
+ Expr result;
+ if(!done()) {
+ try {
+ result = d_input->parseExpr();
+ if(result.isNull()) {
+ setDone();
+ }
+ } catch(ParserException& e) {
+ setDone();
+ throw;
+ } catch(Exception& e) {
+ setDone();
+ stringstream ss;
+ ss << e;
+ parseError( ss.str() );
+ }
+ }
+ Debug("parser") << "nextExpression() => " << result << std::endl;
+ return result;
+}
+
}/* CVC4::parser namespace */
}/* CVC4 namespace */
bool isPredicate(const std::string& name);
Command* nextCommand() throw(ParserException);
+ Expr nextExpression() throw(ParserException);
inline void parseError(const std::string& msg) throw (ParserException) {
d_input->parseError(msg);
** \brief Black box testing of CVC4::parser::Parser, including CVC, SMT and
** SMT v2 inputs.
**
- ** Black box testing of CVC4::parser::Parser, including CVC, SMT and
+ ** Black box testing of CVC4::parser::Parser, including CVC, SMT, and
** SMT v2 inputs.
**/
}
}
- /* NOTE: The check implemented here may fail if a bad expression expression string
- * has a prefix that is parseable as a good expression. E.g., the bad SMT v2 expression
- * "#b10@@@@@@" will actually return the bit-vector 10 and ignore the tail of the
- * input. It's more trouble than it's worth to check that the whole input was
- * consumed here, so just be careful to avoid valid prefixes in tests.
+ /* NOTE: The check implemented here may fail if a bad expression
+ * expression string has a prefix that is parseable as a good
+ * expression. E.g., the bad SMT v2 expression "#b10@@@@@@" will
+ * actually return the bit-vector 10 and ignore the tail of the
+ * input. It's more trouble than it's worth to check that the whole
+ * input was consumed here, so just be careful to avoid valid
+ * prefixes in tests.
*/
void tryBadExpr(const string badExpr, bool strictMode = false) {
// Debug.on("parser");
// Debug.on("parser-extra");
// cout << "Testing bad expr: '" << badExpr << "'\n";
-
+
Parser *parser =
ParserBuilder(*d_exprManager,"test")
.withStringInput(badExpr)
}
void setUp() {
-cout << "SET UP\n";
d_exprManager = new ExprManager;
}