aboutsummaryrefslogtreecommitdiff
path: root/libbpkg/buildfile-scanner.cxx
blob: ec73d83fb4526d798ebea1861b1f42b820e7813c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// file      : libbpkg/buildfile-scanner.cxx -*- C++ -*-
// license   : MIT; see accompanying LICENSE file

#include <libbpkg/buildfile-scanner.hxx>

#include <string>

using namespace std;

namespace bpkg
{
  // buildfile_scanning
  //
  static inline string
  format (const string& n, uint64_t l, uint64_t c, const string& d)
  {
    string r;
    if (!n.empty ())
    {
      r += n;
      r += ':';
    }

    r += to_string (l);
    r += ':';
    r += to_string (c);
    r += ": error: ";
    r += d;
    return r;
  }

  buildfile_scanning::
  buildfile_scanning (const string& n, uint64_t l, uint64_t c, const string& d)
      : runtime_error (format (n, l, c, d)),
        name (n), line (l), column (c), description (d)
  {
  }
}