Update copyright headers.
[cvc5.git] / src / parser / smt1 / smt1_input.cpp
1 /********************* */
2 /*! \file smt1_input.cpp
3 ** \verbatim
4 ** Top contributors (to current version):
5 ** Christopher L. Conway, Morgan Deters, Tim King
6 ** This file is part of the CVC4 project.
7 ** Copyright (c) 2009-2017 by the authors listed in the file AUTHORS
8 ** in the top-level source directory) and their institutional affiliations.
9 ** All rights reserved. See the file COPYING in the top-level source
10 ** directory for licensing information.\endverbatim
11 **
12 ** \brief [[ Add file-specific comments here ]].
13 **
14 ** [[ Add file-specific comments here ]]
15 **/
16
17 // These headers must be the first two included.
18 // See the documentation in "parser/antlr_undefines.h" for more details.
19 #include <antlr3.h>
20 #include "parser/antlr_undefines.h"
21
22 #include "parser/smt1/smt1_input.h"
23
24 #include "expr/expr_manager.h"
25 #include "parser/input.h"
26 #include "parser/parser.h"
27 #include "parser/parser_exception.h"
28 #include "parser/smt1/Smt1Lexer.h"
29 #include "parser/smt1/Smt1Parser.h"
30
31 namespace CVC4 {
32 namespace parser {
33
34 /* Use lookahead=2 */
35 Smt1Input::Smt1Input(AntlrInputStream& inputStream) :
36 AntlrInput(inputStream, 2) {
37 pANTLR3_INPUT_STREAM input = inputStream.getAntlr3InputStream();
38 assert( input != NULL );
39
40 d_pSmt1Lexer = Smt1LexerNew(input);
41 if( d_pSmt1Lexer == NULL ) {
42 throw ParserException("Failed to create SMT lexer.");
43 }
44
45 setAntlr3Lexer( d_pSmt1Lexer->pLexer );
46
47 pANTLR3_COMMON_TOKEN_STREAM tokenStream = getTokenStream();
48 assert( tokenStream != NULL );
49
50 d_pSmt1Parser = Smt1ParserNew(tokenStream);
51 if( d_pSmt1Parser == NULL ) {
52 throw ParserException("Failed to create SMT parser.");
53 }
54
55 setAntlr3Parser(d_pSmt1Parser->pParser);
56 }
57
58
59 Smt1Input::~Smt1Input() {
60 d_pSmt1Lexer->free(d_pSmt1Lexer);
61 d_pSmt1Parser->free(d_pSmt1Parser);
62 }
63
64 Command* Smt1Input::parseCommand() {
65 return d_pSmt1Parser->parseCommand(d_pSmt1Parser);
66 }
67
68 Expr Smt1Input::parseExpr() {
69 return d_pSmt1Parser->parseExpr(d_pSmt1Parser);
70 }
71
72 }/* CVC4::parser namespace */
73 }/* CVC4 namespace */