1 /********************* */
2 /*! \file tptp_input.cpp
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
12 ** \brief [[ Add file-specific comments here ]].
14 ** [[ Add file-specific comments here ]]
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"
32 TptpInput::TptpInput(AntlrInputStream
& inputStream
) :
33 AntlrInput(inputStream
, 1) {
34 pANTLR3_INPUT_STREAM input
= inputStream
.getAntlr3InputStream();
35 assert( input
!= NULL
);
37 d_pTptpLexer
= TptpLexerNew(input
);
38 if( d_pTptpLexer
== NULL
) {
39 throw ParserException("Failed to create TPTP lexer.");
42 setAntlr3Lexer( d_pTptpLexer
->pLexer
);
44 pANTLR3_COMMON_TOKEN_STREAM tokenStream
= getTokenStream();
45 assert( tokenStream
!= NULL
);
47 d_pTptpParser
= TptpParserNew(tokenStream
);
48 if( d_pTptpParser
== NULL
) {
49 throw ParserException("Failed to create TPTP parser.");
52 setAntlr3Parser(d_pTptpParser
->pParser
);
56 TptpInput::~TptpInput() {
57 d_pTptpLexer
->free(d_pTptpLexer
);
58 d_pTptpParser
->free(d_pTptpParser
);
61 Command
* TptpInput::parseCommand()
62 throw (ParserException
, TypeCheckingException
) {
63 return d_pTptpParser
->parseCommand(d_pTptpParser
);
66 Expr
TptpInput::parseExpr()
67 throw (ParserException
, TypeCheckingException
) {
68 return d_pTptpParser
->parseExpr(d_pTptpParser
);
71 }/* CVC4::parser namespace */