GCC Code Coverage Report
Directory: . Exec Total Coverage
File: src/parser/input.cpp Lines: 20 23 87.0 %
Date: 2021-03-23 Branches: 3 6 50.0 %

Line Exec Source
1
/*********************                                                        */
2
/*! \file input.cpp
3
 ** \verbatim
4
 ** Top contributors (to current version):
5
 **   Christopher L. Conway, Tim King, Morgan Deters
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 A super-class for input language parsers.
13
 **
14
 ** A super-class for input language parsers
15
 **/
16
17
// This must be included first.
18
#include "parser/antlr_input.h"
19
20
#include "parser/input.h"
21
22
#include "base/output.h"
23
#include "parser/parser.h"
24
#include "parser/parser_exception.h"
25
26
27
using namespace std;
28
using namespace CVC4;
29
using namespace CVC4::parser;
30
using namespace CVC4::kind;
31
32
namespace CVC4 {
33
namespace parser {
34
35
InputStreamException::InputStreamException(const std::string& msg) :
36
  Exception(msg) {
37
}
38
39
149
const std::string InputStream::getName() const {
40
149
  return d_name;
41
}
42
43
5766
Input::Input(InputStream& inputStream) :
44
5766
    d_inputStream( &inputStream ) {
45
5766
}
46
47
11532
Input::~Input() {
48
5766
  delete d_inputStream;
49
5766
}
50
51
149
InputStream *Input::getInputStream() {
52
149
  return d_inputStream;
53
}
54
55
5463
Input* Input::newFileInput(InputLanguage lang,
56
                           const std::string& filename,
57
                           bool useMmap)
58
{
59
  AntlrInputStream *inputStream =
60
5463
    AntlrInputStream::newFileInputStream(filename, useMmap);
61
5463
  return AntlrInput::newInput(lang, *inputStream);
62
}
63
64
4
Input* Input::newStreamInput(InputLanguage lang,
65
                             std::istream& input,
66
                             const std::string& name,
67
                             bool lineBuffered)
68
{
69
  AntlrInputStream *inputStream =
70
4
    AntlrInputStream::newStreamInputStream(input, name, lineBuffered);
71
4
  return AntlrInput::newInput(lang, *inputStream);
72
}
73
74
299
Input* Input::newStringInput(InputLanguage lang,
75
                             const std::string& str,
76
                             const std::string& name)
77
{
78
299
  AntlrInputStream *inputStream = AntlrInputStream::newStringInputStream(str, name);
79
299
  return AntlrInput::newInput(lang, *inputStream);
80
}
81
82
}/* CVC4::parser namespace */
83
26673
}/* CVC4 namespace */