* For example, (_ bv5 1) is now an error instead of being silently truncated.
* Probably inappropriate for 1.0.x because it changes exception specifications.
inline BitVector AntlrInput::tokenToBitvector(pANTLR3_COMMON_TOKEN number, pANTLR3_COMMON_TOKEN size) {
std::string number_str = tokenTextSubstr(number, 2);
- return BitVector(tokenToUnsigned(size), Integer(number_str));
+ unsigned sz = tokenToUnsigned(size);
+ Integer val(number_str);
+ if(val.modByPow2(sz) != val) {
+ std::stringstream ss;
+ ss << "Overflow in bitvector construction (specified bitvector size " << sz << " too small to hold value " << tokenText(number) << ")";
+ throw std::invalid_argument(ss.str());
+ }
+ return BitVector(sz, val);
}
}/* CVC4::parser namespace */
d_pCvcParser->free(d_pCvcParser);
}
-Command* CvcInput::parseCommand()
- throw (ParserException, TypeCheckingException) {
+Command* CvcInput::parseCommand() {
return d_pCvcParser->parseCommand(d_pCvcParser);
}
-Expr CvcInput::parseExpr()
- throw (ParserException, TypeCheckingException) {
+Expr CvcInput::parseExpr() {
return d_pCvcParser->parseExpr(d_pCvcParser);
}
*
* @throws ParserException if an error is encountered during parsing.
*/
- Command* parseCommand()
- throw(ParserException, TypeCheckingException);
+ Command* parseCommand();
/** Parse an expression from the input. Returns a null <code>Expr</code>
* if there is no expression there to parse.
*
* @throws ParserException if an error is encountered during parsing.
*/
- Expr parseExpr()
- throw(ParserException, TypeCheckingException);
+ Expr parseExpr();
private:
*
* @throws ParserException if an error is encountered during parsing.
*/
- virtual Command* parseCommand()
- throw (ParserException, TypeCheckingException) = 0;
+ virtual Command* parseCommand() = 0;
/**
* Issue a warning to the user, with source file, line, and column info.
*
* @throws ParserException if an error is encountered during parsing.
*/
- virtual Expr parseExpr()
- throw (ParserException, TypeCheckingException) = 0;
+ virtual Expr parseExpr() = 0;
/** Set the Parser object for this input. */
virtual void setParser(Parser& parser) = 0;
} catch(ParserException& e) {
setDone();
throw;
- } catch(Exception& e) {
+ } catch(exception& e) {
setDone();
- stringstream ss;
- // set the language of the stream, otherwise if it contains
- // Exprs or Types it prints in the AST language
- OutputLanguage outlang =
- language::toOutputLanguage(d_input->getLanguage());
- ss << Expr::setlanguage(outlang) << e;
- parseError( ss.str() );
+ parseError(e.what());
}
}
}
} catch(ParserException& e) {
setDone();
throw;
- } catch(Exception& e) {
+ } catch(exception& e) {
setDone();
- stringstream ss;
- ss << e;
- parseError( ss.str() );
+ parseError(e.what());
}
}
Debug("parser") << "nextExpression() => " << result << std::endl;
d_pSmt1Parser->free(d_pSmt1Parser);
}
-Command* Smt1Input::parseCommand()
- throw (ParserException, TypeCheckingException) {
+Command* Smt1Input::parseCommand() {
return d_pSmt1Parser->parseCommand(d_pSmt1Parser);
}
-Expr Smt1Input::parseExpr()
- throw (ParserException, TypeCheckingException) {
+Expr Smt1Input::parseExpr() {
return d_pSmt1Parser->parseExpr(d_pSmt1Parser);
}
*
* @throws ParserException if an error is encountered during parsing.
*/
- Command* parseCommand()
- throw(ParserException, TypeCheckingException);
+ Command* parseCommand();
/**
* Parse an expression from the input. Returns a null
*
* @throws ParserException if an error is encountered during parsing.
*/
- Expr parseExpr()
- throw(ParserException, TypeCheckingException);
+ Expr parseExpr();
private:
d_pSmt2Parser->free(d_pSmt2Parser);
}
-Command* Smt2Input::parseCommand()
- throw (ParserException, TypeCheckingException) {
+Command* Smt2Input::parseCommand() {
return d_pSmt2Parser->parseCommand(d_pSmt2Parser);
}
-Expr Smt2Input::parseExpr()
- throw (ParserException, TypeCheckingException) {
+Expr Smt2Input::parseExpr() {
return d_pSmt2Parser->parseExpr(d_pSmt2Parser);
}
*
* @throws ParserException if an error is encountered during parsing.
*/
- Command* parseCommand()
- throw(ParserException, TypeCheckingException);
+ Command* parseCommand();
/**
* Parse an expression from the input. Returns a null
*
* @throws ParserException if an error is encountered during parsing.
*/
- Expr parseExpr()
- throw(ParserException, TypeCheckingException);
+ Expr parseExpr();
};/* class Smt2Input */
d_pTptpParser->free(d_pTptpParser);
}
-Command* TptpInput::parseCommand()
- throw (ParserException, TypeCheckingException) {
+Command* TptpInput::parseCommand() {
return d_pTptpParser->parseCommand(d_pTptpParser);
}
-Expr TptpInput::parseExpr()
- throw (ParserException, TypeCheckingException) {
+Expr TptpInput::parseExpr() {
return d_pTptpParser->parseExpr(d_pTptpParser);
}
*
* @throws ParserException if an error is encountered during parsing.
*/
- Command* parseCommand()
- throw(ParserException, TypeCheckingException);
+ Command* parseCommand();
/**
* Parse an expression from the input. Returns a null
*
* @throws ParserException if an error is encountered during parsing.
*/
- Expr parseExpr()
- throw(ParserException, TypeCheckingException);
+ Expr parseExpr();
};/* class TptpInput */