GCC Code Coverage Report
Directory: . Exec Total Coverage
File: src/parser/cvc/cvc_input.cpp Lines: 22 24 91.7 %
Date: 2021-03-23 Branches: 14 56 25.0 %

Line Exec Source
1
/*********************                                                        */
2
/*! \file cvc_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/cvc/cvc_input.h"
18
19
#include <antlr3.h>
20
21
#include "base/check.h"
22
#include "parser/antlr_input.h"
23
#include "parser/cvc/CvcLexer.h"
24
#include "parser/cvc/CvcParser.h"
25
#include "parser/parser_exception.h"
26
27
namespace CVC4 {
28
namespace parser {
29
30
/* Use lookahead=3 */
31
714
CvcInput::CvcInput(AntlrInputStream& inputStream) :
32
714
  AntlrInput(inputStream,6) {
33
714
  pANTLR3_INPUT_STREAM input = inputStream.getAntlr3InputStream();
34
714
  Assert(input != NULL);
35
36
714
  d_pCvcLexer = CvcLexerNew(input);
37
714
  if( d_pCvcLexer == NULL ) {
38
    throw ParserException("Failed to create CVC lexer.");
39
  }
40
41
714
  setAntlr3Lexer( d_pCvcLexer->pLexer );
42
43
714
  pANTLR3_COMMON_TOKEN_STREAM tokenStream = getTokenStream();
44
714
  Assert(tokenStream != NULL);
45
46
714
  d_pCvcParser = CvcParserNew(tokenStream);
47
714
  if( d_pCvcParser == NULL ) {
48
    throw ParserException("Failed to create CVC parser.");
49
  }
50
51
714
  setAntlr3Parser(d_pCvcParser->pParser);
52
714
}
53
54
55
2142
CvcInput::~CvcInput() {
56
714
  d_pCvcLexer->free(d_pCvcLexer);
57
714
  d_pCvcParser->free(d_pCvcParser);
58
1428
}
59
60
11261
Command* CvcInput::parseCommand() {
61
11261
  return d_pCvcParser->parseCommand(d_pCvcParser);
62
}
63
64
60
api::Term CvcInput::parseExpr()
65
{
66
60
  return d_pCvcParser->parseExpr(d_pCvcParser);
67
}
68
69
/*
70
pANTLR3_LEXER CvcInput::getLexer() {
71
  return d_pCvcLexer->pLexer;
72
}
73
*/
74
75
}/* CVC4::parser namespace */
76
26673
}/* CVC4 namespace */