blob: 5cb5f6f44d54147e7ab7d02eb6950d50a0cde18d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
/********************* */
/*! \file tptp_input.cpp
** \verbatim
** Top contributors (to current version):
** Francois Bobot, Morgan Deters, Andrew Reynolds
** This file is part of the CVC4 project.
** Copyright (c) 2009-2021 by the authors listed in the file AUTHORS
** in the top-level source directory and their institutional affiliations.
** All rights reserved. See the file COPYING in the top-level source
** directory for licensing information.\endverbatim
**
** \brief [[ Add file-specific comments here ]].
**
** [[ Add file-specific comments here ]]
**/
#include "parser/tptp/tptp_input.h"
#include <antlr3.h>
#include "parser/input.h"
#include "parser/parser.h"
#include "parser/parser_exception.h"
#include "parser/tptp/tptp.h"
#include "parser/tptp/TptpLexer.h"
#include "parser/tptp/TptpParser.h"
namespace CVC4 {
namespace parser {
/* Use lookahead=2 */
TptpInput::TptpInput(AntlrInputStream& inputStream) :
AntlrInput(inputStream, 2) {
pANTLR3_INPUT_STREAM input = inputStream.getAntlr3InputStream();
assert( input != NULL );
d_pTptpLexer = TptpLexerNew(input);
if( d_pTptpLexer == NULL ) {
throw ParserException("Failed to create TPTP lexer.");
}
setAntlr3Lexer( d_pTptpLexer->pLexer );
pANTLR3_COMMON_TOKEN_STREAM tokenStream = getTokenStream();
assert( tokenStream != NULL );
d_pTptpParser = TptpParserNew(tokenStream);
if( d_pTptpParser == NULL ) {
throw ParserException("Failed to create TPTP parser.");
}
setAntlr3Parser(d_pTptpParser->pParser);
}
TptpInput::~TptpInput() {
d_pTptpLexer->free(d_pTptpLexer);
d_pTptpParser->free(d_pTptpParser);
}
Command* TptpInput::parseCommand() {
return d_pTptpParser->parseCommand(d_pTptpParser);
}
api::Term TptpInput::parseExpr()
{
return d_pTptpParser->parseExpr(d_pTptpParser);
}
}/* CVC4::parser namespace */
}/* CVC4 namespace */
|