Standardizing copyright notice. Touches **ALL** sources, guys, sorry.. it's
[cvc5.git] / src / parser / tptp / tptp_input.cpp
1 /********************* */
2 /*! \file tptp_input.cpp
3 ** \verbatim
4 ** Original author: bobot
5 ** Major contributors: none
6 ** Minor contributors (to current version): mdeters
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
11 **
12 ** \brief [[ Add file-specific comments here ]].
13 **
14 ** [[ Add file-specific comments here ]]
15 **/
16
17 #include <antlr3.h>
18
19 #include "parser/tptp/tptp_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/tptp/tptp.h"
25 #include "parser/tptp/generated/TptpLexer.h"
26 #include "parser/tptp/generated/TptpParser.h"
27
28 namespace CVC4 {
29 namespace parser {
30
31 /* Use lookahead=1 */
32 TptpInput::TptpInput(AntlrInputStream& inputStream) :
33 AntlrInput(inputStream, 1) {
34 pANTLR3_INPUT_STREAM input = inputStream.getAntlr3InputStream();
35 assert( input != NULL );
36
37 d_pTptpLexer = TptpLexerNew(input);
38 if( d_pTptpLexer == NULL ) {
39 throw ParserException("Failed to create TPTP lexer.");
40 }
41
42 setAntlr3Lexer( d_pTptpLexer->pLexer );
43
44 pANTLR3_COMMON_TOKEN_STREAM tokenStream = getTokenStream();
45 assert( tokenStream != NULL );
46
47 d_pTptpParser = TptpParserNew(tokenStream);
48 if( d_pTptpParser == NULL ) {
49 throw ParserException("Failed to create TPTP parser.");
50 }
51
52 setAntlr3Parser(d_pTptpParser->pParser);
53 }
54
55
56 TptpInput::~TptpInput() {
57 d_pTptpLexer->free(d_pTptpLexer);
58 d_pTptpParser->free(d_pTptpParser);
59 }
60
61 Command* TptpInput::parseCommand()
62 throw (ParserException, TypeCheckingException) {
63 return d_pTptpParser->parseCommand(d_pTptpParser);
64 }
65
66 Expr TptpInput::parseExpr()
67 throw (ParserException, TypeCheckingException) {
68 return d_pTptpParser->parseExpr(d_pTptpParser);
69 }
70
71 }/* CVC4::parser namespace */
72 }/* CVC4 namespace */