AntlrInputStream*
AntlrInputStream::newFileInputStream(const std::string& name,
bool useMmap)
- throw (InputStreamException) {
+ throw (InputStreamException, AssertionException) {
pANTLR3_INPUT_STREAM input = NULL;
if( useMmap ) {
input = MemoryMappedInputBufferNew(name);
AntlrInputStream*
AntlrInputStream::newStreamInputStream(std::istream& input,
const std::string& name)
- throw (InputStreamException) {
+ throw (InputStreamException, AssertionException) {
// Since these are all NULL on entry, realloc will be called
char *basep = NULL, *boundp = NULL, *cp = NULL;
AntlrInputStream*
AntlrInputStream::newStringInputStream(const std::string& input,
const std::string& name)
- throw (InputStreamException) {
+ throw (InputStreamException, AssertionException) {
char* inputStr = strdup(input.c_str());
char* nameStr = strdup(name.c_str());
AlwaysAssert( inputStr!=NULL && nameStr!=NULL );
default:
Unhandled(lang);
}
+
return input;
}
}
void AntlrInput::parseError(const std::string& message)
- throw (ParserException) {
+ throw (ParserException, AssertionException) {
Debug("parser") << "Throwing exception: "
<< getInputStream()->getName() << ":"
<< d_lexer->getLine(d_lexer) << "."
*/
static AntlrInputStream* newFileInputStream(const std::string& name,
bool useMmap = false)
- throw (InputStreamException);
+ throw (InputStreamException, AssertionException);
/** Create an input from an istream. */
static AntlrInputStream* newStreamInputStream(std::istream& input,
const std::string& name)
- throw (InputStreamException);
+ throw (InputStreamException, AssertionException);
/** Create a string input.
*
*/
static AntlrInputStream* newStringInputStream(const std::string& input,
const std::string& name)
- throw (InputStreamException);
+ throw (InputStreamException, AssertionException);
};
class Parser;
/**
* Throws a <code>ParserException</code> with the given message.
*/
- void parseError(const std::string& msg) throw (ParserException);
+ void parseError(const std::string& msg)
+ throw (ParserException, AssertionException);
/** Set the ANTLR3 lexer for this input. */
void setAntlr3Lexer(pANTLR3_LEXER pLexer);
d_pCvcParser->free(d_pCvcParser);
}
-Command* CvcInput::parseCommand() throw (ParserException) {
+Command* CvcInput::parseCommand()
+ throw (ParserException, AssertionException) {
return d_pCvcParser->parseCommand(d_pCvcParser);
}
-Expr CvcInput::parseExpr() throw (ParserException) {
+Expr CvcInput::parseExpr()
+ throw (ParserException, AssertionException) {
return d_pCvcParser->parseExpr(d_pCvcParser);
}
*
* @throws ParserException if an error is encountered during parsing.
*/
- Command* parseCommand() throw(ParserException);
+ Command* parseCommand() throw(ParserException, AssertionException);
/** 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);
+ Expr parseExpr() throw(ParserException, AssertionException);
private:
Input* Input::newFileInput(InputLanguage lang,
const std::string& filename,
bool useMmap)
- throw (InputStreamException) {
+ throw (InputStreamException, AssertionException) {
AntlrInputStream *inputStream =
AntlrInputStream::newFileInputStream(filename,useMmap);
return AntlrInput::newInput(lang,*inputStream);
Input* Input::newStreamInput(InputLanguage lang,
std::istream& input,
const std::string& name)
- throw (InputStreamException) {
+ throw (InputStreamException, AssertionException) {
AntlrInputStream *inputStream =
AntlrInputStream::newStreamInputStream(input,name);
return AntlrInput::newInput(lang,*inputStream);
Input* Input::newStringInput(InputLanguage lang,
const std::string& str,
const std::string& name)
- throw (InputStreamException) {
+ throw (InputStreamException, AssertionException) {
AntlrInputStream *inputStream = AntlrInputStream::newStringInputStream(str,name);
return AntlrInput::newInput(lang,*inputStream);
}
static Input* newFileInput(InputLanguage lang,
const std::string& filename,
bool useMmap=false)
- throw (InputStreamException);
+ throw (InputStreamException, AssertionException);
/** Create an input for the given stream.
*
static Input* newStreamInput(InputLanguage lang,
std::istream& input,
const std::string& name)
- throw (InputStreamException);
+ throw (InputStreamException, AssertionException);
/** Create an input for the given string
*
static Input* newStringInput(InputLanguage lang,
const std::string& input,
const std::string& name)
- throw (InputStreamException);
+ throw (InputStreamException, AssertionException);
public:
*
* @throws ParserException if an error is encountered during parsing.
*/
- virtual Command* parseCommand() throw(ParserException) = 0;
+ virtual Command* parseCommand()
+ throw (ParserException, AssertionException) = 0;
/**
* Throws a <code>ParserException</code> with the given message.
*/
- virtual void parseError(const std::string& msg) throw (ParserException) = 0;
+ virtual void parseError(const std::string& msg)
+ throw (ParserException, AssertionException) = 0;
/** Parse an
* expression from the input by invoking the implementation-specific
*
* @throws ParserException if an error is encountered during parsing.
*/
- virtual Expr parseExpr() throw(ParserException) = 0;
+ virtual Expr parseExpr()
+ throw (ParserException, AssertionException) = 0;
/** Set the Parser object for this input. */
virtual void setParser(Parser& parser) = 0;
#ifndef __CVC4__PARSER__PARSER_OPTIONS_H
#define __CVC4__PARSER__PARSER_OPTIONS_H
+#include <iostream>
+
namespace CVC4 {
namespace parser {
LANG_AUTO
};/* enum InputLanguage */
+inline std::ostream& operator<<(std::ostream& out, InputLanguage lang) {
+ switch(lang) {
+ case LANG_SMTLIB:
+ out << "LANG_SMTLIB";
+ break;
+ case LANG_SMTLIB_V2:
+ out << "LANG_SMTLIB_V2";
+ break;
+ case LANG_CVC4:
+ out << "LANG_CVC4";
+ break;
+ case LANG_AUTO:
+ out << "LANG_AUTO";
+ break;
+ default:
+ out << "undefined_language";
+ }
+
+ return out;
+}
+
}/* CVC4::parser namespace */
}/* CVC4 namespace */
d_pSmtParser->free(d_pSmtParser);
}
-Command* SmtInput::parseCommand() throw (ParserException) {
+Command* SmtInput::parseCommand()
+ throw (ParserException, AssertionException) {
return d_pSmtParser->parseCommand(d_pSmtParser);
}
-Expr SmtInput::parseExpr() throw (ParserException) {
+Expr SmtInput::parseExpr()
+ throw (ParserException, AssertionException) {
return d_pSmtParser->parseExpr(d_pSmtParser);
}
*
* @throws ParserException if an error is encountered during parsing.
*/
- Command* parseCommand() throw(ParserException);
+ Command* parseCommand() throw(ParserException, AssertionException);
/**
* Parse an expression from the input. Returns a null
*
* @throws ParserException if an error is encountered during parsing.
*/
- Expr parseExpr() throw(ParserException);
+ Expr parseExpr() throw(ParserException, AssertionException);
private:
d_pSmt2Parser->free(d_pSmt2Parser);
}
-Command* Smt2Input::parseCommand() throw (ParserException) {
+Command* Smt2Input::parseCommand()
+ throw (ParserException, AssertionException) {
return d_pSmt2Parser->parseCommand(d_pSmt2Parser);
}
-Expr Smt2Input::parseExpr() throw (ParserException) {
+Expr Smt2Input::parseExpr()
+ throw (ParserException, AssertionException) {
return d_pSmt2Parser->parseExpr(d_pSmt2Parser);
}
*
* @throws ParserException if an error is encountered during parsing.
*/
- Command* parseCommand() throw(ParserException);
+ Command* parseCommand() throw(ParserException, AssertionException);
/**
* Parse an expression from the input. Returns a null
*
* @throws ParserException if an error is encountered during parsing.
*/
- Expr parseExpr() throw(ParserException);
+ Expr parseExpr() throw(ParserException, AssertionException);
};/* class Smt2Input */