• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

antonvw / wex / 20442153994

22 Dec 2025 07:39PM UTC coverage: 64.31% (-0.04%) from 64.348%
20442153994

push

github

web-flow
1131 use boostparser (#1132)

* prototype use boost::parser for unified_diff parsing

* use boost trace if log level is trace

* parsing seems OK, and action is set by semantic action

* implemented some actions

* prototype is OK

* updated comments

* now replaced the old parser by the new boost::parser

* fixed tests

* fixed compile error

* final updates

18531 of 31589 branches covered (58.66%)

Branch coverage included in aggregate %.

14764 of 20184 relevant lines covered (73.15%)

1512.67 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

20.37
/src/factory/unified-diff.cpp
1
////////////////////////////////////////////////////////////////////////////////
2
// Name:      unified-diff.cpp
3
// Purpose:   Implementation of class wex::factory::unified_diff
4
//            https://www.gnu.org/software/diffutils/manual/html_node/Detailed-Unified.html
5
// Author:    Anton van Wezenbeek
6
// Copyright: (c) 2024-2025 Anton van Wezenbeek
7
////////////////////////////////////////////////////////////////////////////////
8

9
#include <wex/core/log.h>
10
#include <wex/factory/unified-diff.h>
11

12
#include <algorithm>
13
#include <utility>
14

15
#include "unified-diff-parser.h"
16

17
wex::factory::unified_diff::unified_diff(std::string input)
19✔
18
  : m_input(std::move(input))
19✔
19
{
20
}
19✔
21

22
bool wex::factory::unified_diff::parse()
11✔
23
{
24
  return unified_diff_parser(this).parse();
11✔
25
}
26

27
void wex::factory::unified_diff::trace(const std::string& text) const
32✔
28
{
29
  if (log::get_level() != log::level_t::TRACE)
32!
30
  {
31
    return;
32✔
32
  }
33

34
  using boost::describe::operators::operator<<;
35

36
  std::stringstream str;
×
37
  str << "type: " << boost::describe::enum_to_string(m_type, "none") << " "
×
38
      << *this << " ranges: ";
×
39

40
  std::ranges::for_each(
×
41
    m_range,
×
42
    [this, &str](const auto& it)
×
43
    {
44
      str << std::to_string(it) << ",";
×
45
    });
×
46

47
  str << " text sizes: ";
×
48

49
  std::ranges::for_each(
×
50
    m_text,
×
51
    [this, &str](const auto& it)
×
52
    {
53
      str << it.size() << ",";
×
54
    });
×
55

56
  str << " paths: ";
×
57

58
  std::ranges::for_each(
×
59
    m_path,
×
60
    [this, &str](const auto& it)
×
61
    {
62
      str << it.string() << ",";
×
63
    });
×
64

65
  log::trace("unified_diff::" + text) << str.str();
×
66
}
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc