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

Line Exec Source
1
/******************************************************************************
2
 * Top contributors (to current version):
3
 *   Christopher L. Conway, Andrew Reynolds, Morgan Deters
4
 *
5
 * This file is part of the cvc5 project.
6
 *
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.
11
 * ****************************************************************************
12
 *
13
 * [[ Add one-line brief description here ]]
14
 *
15
 * [[ Add file-specific comments here ]]
16
 */
17
18
#include "parser/smt2/smt2_input.h"
19
20
#include <antlr3.h>
21
22
#include "base/check.h"
23
#include "parser/input.h"
24
#include "parser/parser.h"
25
#include "parser/parser_exception.h"
26
#include "parser/smt2/Smt2Lexer.h"
27
#include "parser/smt2/Smt2Parser.h"
28
#include "parser/smt2/smt2.h"
29
30
namespace cvc5 {
31
namespace parser {
32
33
/* Use lookahead=2 */
34
5228
Smt2Input::Smt2Input(AntlrInputStream& inputStream) : AntlrInput(inputStream, 2)
35
{
36
5228
  pANTLR3_INPUT_STREAM input = inputStream.getAntlr3InputStream();
37
5228
  Assert(input != NULL);
38
39
5228
  d_pSmt2Lexer = Smt2LexerNew(input);
40
5228
  if( d_pSmt2Lexer == NULL ) {
41
    throw ParserException("Failed to create SMT2 lexer.");
42
  }
43
44
5228
  setAntlr3Lexer( d_pSmt2Lexer->pLexer );
45
46
5228
  pANTLR3_COMMON_TOKEN_STREAM tokenStream = getTokenStream();
47
5228
  Assert(tokenStream != NULL);
48
49
5228
  d_pSmt2Parser = Smt2ParserNew(tokenStream);
50
5228
  if( d_pSmt2Parser == NULL ) {
51
    throw ParserException("Failed to create SMT2 parser.");
52
  }
53
54
5228
  setAntlr3Parser(d_pSmt2Parser->pParser);
55
5228
}
56
57
15684
Smt2Input::~Smt2Input() {
58
5228
  d_pSmt2Lexer->free(d_pSmt2Lexer);
59
5228
  d_pSmt2Parser->free(d_pSmt2Parser);
60
10456
}
61
62
277350
Command* Smt2Input::parseCommand() {
63
277350
  return d_pSmt2Parser->parseCommand(d_pSmt2Parser);
64
}
65
66
116
api::Term Smt2Input::parseExpr()
67
{
68
116
  return d_pSmt2Parser->parseExpr(d_pSmt2Parser);
69
}
70
71
}  // namespace parser
72
29265
}  // namespace cvc5