GCC Code Coverage Report
Directory: . Exec Total Coverage
File: src/parser/smt2/smt2_input.cpp Lines: 21 23 91.3 %
Date: 2021-03-23 Branches: 14 56 25.0 %

Line Exec Source
1
/*********************                                                        */
2
/*! \file smt2_input.cpp
3
 ** \verbatim
4
 ** Top contributors (to current version):
5
 **   Christopher L. Conway, 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/smt2/smt2_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/smt2/Smt2Lexer.h"
26
#include "parser/smt2/Smt2Parser.h"
27
#include "parser/smt2/smt2.h"
28
29
namespace CVC4 {
30
namespace parser {
31
32
/* Use lookahead=2 */
33
4648
Smt2Input::Smt2Input(AntlrInputStream& inputStream) : AntlrInput(inputStream, 2)
34
{
35
4648
  pANTLR3_INPUT_STREAM input = inputStream.getAntlr3InputStream();
36
4648
  Assert(input != NULL);
37
38
4648
  d_pSmt2Lexer = Smt2LexerNew(input);
39
4648
  if( d_pSmt2Lexer == NULL ) {
40
    throw ParserException("Failed to create SMT2 lexer.");
41
  }
42
43
4648
  setAntlr3Lexer( d_pSmt2Lexer->pLexer );
44
45
4648
  pANTLR3_COMMON_TOKEN_STREAM tokenStream = getTokenStream();
46
4648
  Assert(tokenStream != NULL);
47
48
4648
  d_pSmt2Parser = Smt2ParserNew(tokenStream);
49
4648
  if( d_pSmt2Parser == NULL ) {
50
    throw ParserException("Failed to create SMT2 parser.");
51
  }
52
53
4648
  setAntlr3Parser(d_pSmt2Parser->pParser);
54
4648
}
55
56
13944
Smt2Input::~Smt2Input() {
57
4648
  d_pSmt2Lexer->free(d_pSmt2Lexer);
58
4648
  d_pSmt2Parser->free(d_pSmt2Parser);
59
9296
}
60
61
263514
Command* Smt2Input::parseCommand() {
62
263514
  return d_pSmt2Parser->parseCommand(d_pSmt2Parser);
63
}
64
65
116
api::Term Smt2Input::parseExpr()
66
{
67
116
  return d_pSmt2Parser->parseExpr(d_pSmt2Parser);
68
}
69
70
}/* CVC4::parser namespace */
71
26673
}/* CVC4 namespace */