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

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