GCC Code Coverage Report
Directory: . Exec Total Coverage
File: src/parser/tptp/tptp_input.cpp Lines: 20 24 83.3 %
Date: 2021-03-23 Branches: 14 56 25.0 %

Line Exec Source
1
/*********************                                                        */
2
/*! \file tptp_input.cpp
3
 ** \verbatim
4
 ** Top contributors (to current version):
5
 **   Francois Bobot, Morgan Deters, Andrew Reynolds
6
 ** This file is part of the CVC4 project.
7
 ** Copyright (c) 2009-2021 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
#include "parser/tptp/tptp_input.h"
18
19
#include <antlr3.h>
20
21
#include "base/check.h"
22
#include "parser/input.h"
23
#include "parser/parser.h"
24
#include "parser/parser_exception.h"
25
#include "parser/tptp/TptpLexer.h"
26
#include "parser/tptp/TptpParser.h"
27
#include "parser/tptp/tptp.h"
28
29
namespace CVC4 {
30
namespace parser {
31
32
/* Use lookahead=2 */
33
42
TptpInput::TptpInput(AntlrInputStream& inputStream) :
34
42
  AntlrInput(inputStream, 2) {
35
42
  pANTLR3_INPUT_STREAM input = inputStream.getAntlr3InputStream();
36
42
  Assert(input != NULL);
37
38
42
  d_pTptpLexer = TptpLexerNew(input);
39
42
  if( d_pTptpLexer == NULL ) {
40
    throw ParserException("Failed to create TPTP lexer.");
41
  }
42
43
42
  setAntlr3Lexer( d_pTptpLexer->pLexer );
44
45
42
  pANTLR3_COMMON_TOKEN_STREAM tokenStream = getTokenStream();
46
42
  Assert(tokenStream != NULL);
47
48
42
  d_pTptpParser = TptpParserNew(tokenStream);
49
42
  if( d_pTptpParser == NULL ) {
50
    throw ParserException("Failed to create TPTP parser.");
51
  }
52
53
42
  setAntlr3Parser(d_pTptpParser->pParser);
54
42
}
55
56
57
126
TptpInput::~TptpInput() {
58
42
  d_pTptpLexer->free(d_pTptpLexer);
59
42
  d_pTptpParser->free(d_pTptpParser);
60
84
}
61
62
1748
Command* TptpInput::parseCommand() {
63
1748
  return d_pTptpParser->parseCommand(d_pTptpParser);
64
}
65
66
api::Term TptpInput::parseExpr()
67
{
68
  return d_pTptpParser->parseExpr(d_pTptpParser);
69
}
70
71
}/* CVC4::parser namespace */
72
26673
}/* CVC4 namespace */