1 /********************* */
2 /*! \file smt1_input.cpp
4 ** Original author: cconway
5 ** Major contributors: mdeters
6 ** Minor contributors (to current version): none
7 ** This file is part of the CVC4 prototype.
8 ** Copyright (c) 2009-2012 New York University and The University of Iowa
9 ** See the file COPYING in the top-level source directory for licensing
10 ** information.\endverbatim
12 ** \brief [[ Add file-specific comments here ]].
14 ** [[ Add file-specific comments here ]]
19 #include "parser/smt1/smt1_input.h"
20 #include "expr/expr_manager.h"
21 #include "parser/input.h"
22 #include "parser/parser.h"
23 #include "parser/parser_exception.h"
24 #include "parser/smt1/generated/Smt1Lexer.h"
25 #include "parser/smt1/generated/Smt1Parser.h"
31 Smt1Input::Smt1Input(AntlrInputStream
& inputStream
) :
32 AntlrInput(inputStream
, 2) {
33 pANTLR3_INPUT_STREAM input
= inputStream
.getAntlr3InputStream();
34 assert( input
!= NULL
);
36 d_pSmt1Lexer
= Smt1LexerNew(input
);
37 if( d_pSmt1Lexer
== NULL
) {
38 throw ParserException("Failed to create SMT lexer.");
41 setAntlr3Lexer( d_pSmt1Lexer
->pLexer
);
43 pANTLR3_COMMON_TOKEN_STREAM tokenStream
= getTokenStream();
44 assert( tokenStream
!= NULL
);
46 d_pSmt1Parser
= Smt1ParserNew(tokenStream
);
47 if( d_pSmt1Parser
== NULL
) {
48 throw ParserException("Failed to create SMT parser.");
51 setAntlr3Parser(d_pSmt1Parser
->pParser
);
55 Smt1Input::~Smt1Input() {
56 d_pSmt1Lexer
->free(d_pSmt1Lexer
);
57 d_pSmt1Parser
->free(d_pSmt1Parser
);
60 Command
* Smt1Input::parseCommand() {
61 return d_pSmt1Parser
->parseCommand(d_pSmt1Parser
);
64 Expr
Smt1Input::parseExpr() {
65 return d_pSmt1Parser
->parseExpr(d_pSmt1Parser
);
68 }/* CVC4::parser namespace */